/src/botan/build/include/botan/pbkdf1.h
Line | Count | Source (jump to first uncovered line) |
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 | | BOTAN_FUTURE_INTERNAL_HEADER(pbkdf1.h) |
15 | | |
16 | | namespace Botan { |
17 | | |
18 | | /** |
19 | | * PKCS #5 v1 PBKDF, aka PBKDF1 |
20 | | * Can only generate a key up to the size of the hash output. |
21 | | * Unless needed for backwards compatibility, use PKCS5_PBKDF2 |
22 | | */ |
23 | | class BOTAN_PUBLIC_API(2,0) PKCS5_PBKDF1 final : public PBKDF |
24 | | { |
25 | | public: |
26 | | /** |
27 | | * Create a PKCS #5 instance using the specified hash function. |
28 | | * @param hash pointer to a hash function object to use |
29 | | */ |
30 | 0 | explicit PKCS5_PBKDF1(HashFunction* hash) : m_hash(hash) {} |
31 | | |
32 | | std::string name() const override |
33 | 0 | { |
34 | 0 | return "PBKDF1(" + m_hash->name() + ")"; |
35 | 0 | } |
36 | | |
37 | | PBKDF* clone() const override |
38 | 0 | { |
39 | 0 | return new PKCS5_PBKDF1(m_hash->clone()); |
40 | 0 | } |
41 | | |
42 | | size_t pbkdf(uint8_t output_buf[], size_t output_len, |
43 | | const std::string& passphrase, |
44 | | const uint8_t salt[], size_t salt_len, |
45 | | size_t iterations, |
46 | | std::chrono::milliseconds msec) const override; |
47 | | private: |
48 | | std::unique_ptr<HashFunction> m_hash; |
49 | | }; |
50 | | |
51 | | } |
52 | | |
53 | | #endif |