Botan: src/pbkdf/pbkdf2/pbkdf2.h Source File

Botan 1.10.17

pbkdf2.h
Go to the documentation of this file.
1 /*
2 * PBKDF2
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_PBKDF2_H__
9 #define BOTAN_PBKDF2_H__
10
11 #include <botan/pbkdf.h>
12 #include <botan/mac.h>
13
14 namespace Botan {
15
16 /**
17 * PKCS #5 PBKDF2
18 */
19 class BOTAN_DLL PKCS5_PBKDF2 : public PBKDF
20 {
21 public:
22 std::string name() const
23 {
24 return "PBKDF2(" + mac->name() + ")";
25 }
26
27 PBKDF* clone() const
28 {
29 return new PKCS5_PBKDF2(mac->clone());
30 }
31
32 OctetString derive_key(size_t output_len,
33 const std::string& passphrase,
34 const byte salt[], size_t salt_len,
35 size_t iterations) const;
36
37 /**
38 * Create a PKCS #5 instance using the specified message auth code
39 * @param mac_fn the MAC to use
40 */
41 PKCS5_PBKDF2(MessageAuthenticationCode* mac_fn) : mac(mac_fn) {}
42
43 /**
44 * Destructor
45 */
46 ~PKCS5_PBKDF2() { delete mac; }
47 private:
48 MessageAuthenticationCode* mac;
49 };
50
51 }
52
53 #endif
Botan::OctetString
Definition: symkey.h:19
Botan::PKCS5_PBKDF2
Definition: pbkdf2.h:19
Botan::PKCS5_PBKDF2::clone
PBKDF * clone() const
Definition: pbkdf2.h:27
Botan::PKCS5_PBKDF2::name
std::string name() const
Definition: pbkdf2.h:22
Botan::MessageAuthenticationCode
Definition: mac.h:20
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::PKCS5_PBKDF2::PKCS5_PBKDF2
PKCS5_PBKDF2(MessageAuthenticationCode *mac_fn)
Definition: pbkdf2.h:41
Botan
Definition: algo_base.h:14
Botan::PKCS5_PBKDF2::~PKCS5_PBKDF2
~PKCS5_PBKDF2()
Definition: pbkdf2.h:46
Botan::PBKDF
Definition: pbkdf.h:21