Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

pbes2.h
Go to the documentation of this file.
1 /*
2 * PKCS #5 v2.0 PBE
3 * (C) 1999-2007,2014 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_PBE_PKCS_v20_H__
9 #define BOTAN_PBE_PKCS_v20_H__
10
11 #include <botan/rng.h>
12 #include <botan/alg_id.h>
13 #include <chrono>
14
15 namespace Botan {
16
17 /**
18 * Encrypt with PBES2 from PKCS #5 v2.0
19 * @param key_bits the input
20 * @param passphrase the passphrase to use for encryption
21 * @param msec how many milliseconds to run PBKDF2
22 * @param cipher specifies the block cipher to use to encrypt
23 * @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)")
24 * @param rng a random number generator
25 */
26 std::pair<AlgorithmIdentifier, std::vector<uint8_t>>
27 BOTAN_DLL pbes2_encrypt(const secure_vector<uint8_t>& key_bits,
28 const std::string& passphrase,
29 std::chrono::milliseconds msec,
30 const std::string& cipher,
31 const std::string& digest,
32 RandomNumberGenerator& rng);
33
34 /**
35 * Encrypt with PBES2 from PKCS #5 v2.0
36 * @param key_bits the input
37 * @param passphrase the passphrase to use for encryption
38 * @param msec how many milliseconds to run PBKDF2
39 * @param out_iterations_if_nonnull if not null, set to the number
40 * of PBKDF iterations used
41 * @param cipher specifies the block cipher to use to encrypt
42 * @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)")
43 * @param rng a random number generator
44 */
45 std::pair<AlgorithmIdentifier, std::vector<uint8_t>>
46 BOTAN_DLL pbes2_encrypt_msec(const secure_vector<uint8_t>& key_bits,
47 const std::string& passphrase,
48 std::chrono::milliseconds msec,
49 size_t* out_iterations_if_nonnull,
50 const std::string& cipher,
51 const std::string& digest,
52 RandomNumberGenerator& rng);
53
54 /**
55 * Encrypt with PBES2 from PKCS #5 v2.0
56 * @param key_bits the input
57 * @param passphrase the passphrase to use for encryption
58 * @param iterations how many iterations to run PBKDF2
59 * @param cipher specifies the block cipher to use to encrypt
60 * @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)")
61 * @param rng a random number generator
62 */
63 std::pair<AlgorithmIdentifier, std::vector<uint8_t>>
64 BOTAN_DLL pbes2_encrypt_iter(const secure_vector<uint8_t>& key_bits,
65 const std::string& passphrase,
66 size_t iterations,
67 const std::string& cipher,
68 const std::string& digest,
69 RandomNumberGenerator& rng);
70
71 /**
72 * Decrypt a PKCS #5 v2.0 encrypted stream
73 * @param key_bits the input
74 * @param passphrase the passphrase to use for decryption
75 * @param params the PBES2 parameters
76 */
77 secure_vector<uint8_t>
78 BOTAN_DLL pbes2_decrypt(const secure_vector<uint8_t>& key_bits,
79 const std::string& passphrase,
80 const std::vector<uint8_t>& params);
81
82 }
83
84 #endif
Botan::pbes2_encrypt_iter
std::pair< AlgorithmIdentifier, std::vector< uint8_t > > pbes2_encrypt_iter(const secure_vector< uint8_t > &key_bits, const std::string &passphrase, size_t pbkdf_iter, const std::string &cipher, const std::string &digest, RandomNumberGenerator &rng)
Definition: pbes2.cpp:153
Botan::pbes2_encrypt_msec
std::pair< AlgorithmIdentifier, std::vector< uint8_t > > pbes2_encrypt_msec(const secure_vector< uint8_t > &key_bits, const std::string &passphrase, std::chrono::milliseconds msec, size_t *out_iterations_if_nonnull, const std::string &cipher, const std::string &digest, RandomNumberGenerator &rng)
Definition: pbes2.cpp:134
Botan
Definition: alg_id.cpp:13
Botan::pbes2_decrypt
secure_vector< uint8_t > pbes2_decrypt(const secure_vector< uint8_t > &key_bits, const std::string &passphrase, const std::vector< uint8_t > &params)
Definition: pbes2.cpp:164
Botan::pbes2_encrypt
std::pair< AlgorithmIdentifier, std::vector< uint8_t > > pbes2_encrypt(const secure_vector< uint8_t > &key_bits, const std::string &passphrase, std::chrono::milliseconds msec, const std::string &cipher, const std::string &digest, RandomNumberGenerator &rng)
Definition: pbes2.cpp:121