3
* (C) 1999-2007,2014 Jack Lloyd
5
* Botan is released under the Simplified BSD License (see license.txt)
8
#ifndef BOTAN_PBE_PKCS_v20_H_
9
#define BOTAN_PBE_PKCS_v20_H_
11
#include <botan/alg_id.h>
16
class RandomNumberGenerator;
19
* Encrypt with PBES2 from PKCS #5 v2.0
20
* @param key_bits the input
21
* @param passphrase the passphrase to use for encryption
22
* @param msec how many milliseconds to run PBKDF2
23
* @param cipher specifies the block cipher to use to encrypt
24
* @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)")
25
* @param rng a random number generator
27
std::pair<AlgorithmIdentifier, std::vector<uint8_t>>
28
BOTAN_PUBLIC_API(2,0) pbes2_encrypt(const secure_vector<uint8_t>& key_bits,
29
const std::string& passphrase,
30
std::chrono::milliseconds msec,
31
const std::string& cipher,
32
const std::string& digest,
33
RandomNumberGenerator& rng);
36
* Encrypt with PBES2 from PKCS #5 v2.0
37
* @param key_bits the input
38
* @param passphrase the passphrase to use for encryption
39
* @param msec how many milliseconds to run PBKDF2
40
* @param out_iterations_if_nonnull if not null, set to the number
41
* of PBKDF iterations used
42
* @param cipher specifies the block cipher to use to encrypt
43
* @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)")
44
* @param rng a random number generator
46
std::pair<AlgorithmIdentifier, std::vector<uint8_t>>
47
BOTAN_PUBLIC_API(2,1) pbes2_encrypt_msec(const secure_vector<uint8_t>& key_bits,
48
const std::string& passphrase,
49
std::chrono::milliseconds msec,
50
size_t* out_iterations_if_nonnull,
51
const std::string& cipher,
52
const std::string& digest,
53
RandomNumberGenerator& rng);
56
* Encrypt with PBES2 from PKCS #5 v2.0
57
* @param key_bits the input
58
* @param passphrase the passphrase to use for encryption
59
* @param iterations how many iterations to run PBKDF2
60
* @param cipher specifies the block cipher to use to encrypt
61
* @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)")
62
* @param rng a random number generator
64
std::pair<AlgorithmIdentifier, std::vector<uint8_t>>
65
BOTAN_PUBLIC_API(2,1) pbes2_encrypt_iter(const secure_vector<uint8_t>& key_bits,
66
const std::string& passphrase,
68
const std::string& cipher,
69
const std::string& digest,
70
RandomNumberGenerator& rng);
73
* Decrypt a PKCS #5 v2.0 encrypted stream
74
* @param key_bits the input
75
* @param passphrase the passphrase to use for decryption
76
* @param params the PBES2 parameters
78
secure_vector<uint8_t>
79
BOTAN_PUBLIC_API(2,0) pbes2_decrypt(const secure_vector<uint8_t>& key_bits,
80
const std::string& passphrase,
81
const std::vector<uint8_t>& params);