Botan
1.11.15
|
00001 /* 00002 * PKCS #5 v2.0 PBE 00003 * (C) 1999-2007,2014 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_PBE_PKCS_v20_H__ 00009 #define BOTAN_PBE_PKCS_v20_H__ 00010 00011 #include <botan/secmem.h> 00012 #include <botan/transform.h> 00013 #include <botan/alg_id.h> 00014 #include <chrono> 00015 00016 namespace Botan { 00017 00018 /** 00019 * Encrypt with PBES2 from PKCS #5 v2.0 00020 * @param passphrase the passphrase to use for encryption 00021 * @param msec how many milliseconds to run PBKDF2 00022 * @param cipher specifies the block cipher to use to encrypt 00023 * @param digest specifies the PRF to use with PBKDF2 (eg "HMAC(SHA-1)") 00024 * @param rng a random number generator 00025 */ 00026 std::pair<AlgorithmIdentifier, std::vector<byte>> 00027 BOTAN_DLL pbes2_encrypt(const secure_vector<byte>& key_bits, 00028 const std::string& passphrase, 00029 std::chrono::milliseconds msec, 00030 const std::string& cipher, 00031 const std::string& digest, 00032 RandomNumberGenerator& rng); 00033 00034 /** 00035 * Decrypt a PKCS #5 v2.0 encrypted stream 00036 * @param key_bits the input 00037 * @param passphrase the passphrase to use for decryption 00038 * @param params the PBES2 parameters 00039 */ 00040 secure_vector<byte> 00041 BOTAN_DLL pbes2_decrypt(const secure_vector<byte>& key_bits, 00042 const std::string& passphrase, 00043 const std::vector<byte>& params); 00044 00045 } 00046 00047 #endif