Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

pbkdf1.h
Go to the documentation of this file.
1 /*
2 * PBKDF1
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_PBKDF1_H__
9 #define BOTAN_PBKDF1_H__
10
11 #include <botan/pbkdf.h>
12 #include <botan/hash.h>
13
14 namespace Botan {
15
16 /**
17 * PKCS #5 v1 PBKDF, aka PBKDF1
18 * Can only generate a key up to the size of the hash output.
19 * Unless needed for backwards compatibility, use PKCS5_PBKDF2
20 */
21 class BOTAN_DLL PKCS5_PBKDF1 final : public PBKDF
22 {
23 public:
24 /**
25 * Create a PKCS #5 instance using the specified hash function.
26 * @param hash pointer to a hash function object to use
27 */
28 explicit PKCS5_PBKDF1(HashFunction* hash) : m_hash(hash) {}
29
30 std::string name() const override
31 {
32 return "PBKDF1(" + m_hash->name() + ")";
33 }
34
35 PBKDF* clone() const override
36 {
37 return new PKCS5_PBKDF1(m_hash->clone());
38 }
39
40 size_t pbkdf(uint8_t output_buf[], size_t output_len,
41 const std::string& passphrase,
42 const uint8_t salt[], size_t salt_len,
43 size_t iterations,
44 std::chrono::milliseconds msec) const override;
45 private:
46 std::unique_ptr<HashFunction> m_hash;
47 };
48
49 }
50
51 #endif
Botan::PKCS5_PBKDF1
Definition: pbkdf1.h:21
Botan::PKCS5_PBKDF1::name
std::string name() const override
Definition: pbkdf1.h:30
Botan::PKCS5_PBKDF1::PKCS5_PBKDF1
PKCS5_PBKDF1(HashFunction *hash)
Definition: pbkdf1.h:28
Botan::PKCS5_PBKDF1::clone
PBKDF * clone() const override
Definition: pbkdf1.h:35
Botan
Definition: alg_id.cpp:13
Botan::HashFunction
Definition: hash.h:19
m_hash
std::unique_ptr< HashFunction > m_hash
Definition: tpm.cpp:439
hash
MechanismType hash
Definition: p11_mechanism.cpp:63
Botan::PBKDF
Definition: pbkdf.h:22