Botan 1.10.17

kdf.cpp
Go to the documentation of this file.
1 /*
2 * KDF Base Class
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #include <botan/kdf.h>
9
10 namespace Botan {
11
12 /*
13 * Derive a key
14 */
15 SecureVector<byte> KDF::derive_key(size_t key_len,
16 const MemoryRegion<byte>& secret,
17 const std::string& salt) const
18 {
19 return derive_key(key_len, &secret[0], secret.size(),
20 reinterpret_cast<const byte*>(salt.data()),
21 salt.length());
22 }
23
24 /*
25 * Derive a key
26 */
27 SecureVector<byte> KDF::derive_key(size_t key_len,
28 const MemoryRegion<byte>& secret,
29 const byte salt[], size_t salt_len) const
30 {
31 return derive_key(key_len, &secret[0], secret.size(),
32 salt, salt_len);
33 }
34
35 /*
36 * Derive a key
37 */
38 SecureVector<byte> KDF::derive_key(size_t key_len,
39 const MemoryRegion<byte>& secret,
40 const MemoryRegion<byte>& salt) const
41 {
42 return derive_key(key_len, &secret[0], secret.size(),
43 &salt[0], salt.size());
44 }
45
46 /*
47 * Derive a key
48 */
49 SecureVector<byte> KDF::derive_key(size_t key_len,
50 const byte secret[], size_t secret_len,
51 const std::string& salt) const
52 {
53 return derive_key(key_len, secret, secret_len,
54 reinterpret_cast<const byte*>(salt.data()),
55 salt.length());
56 }
57
58 /*
59 * Derive a key
60 */
61 SecureVector<byte> KDF::derive_key(size_t key_len,
62 const byte secret[], size_t secret_len,
63 const byte salt[], size_t salt_len) const
64 {
65 return derive(key_len, secret, secret_len, salt, salt_len);
66 }
67
68 }
Botan::KDF::derive_key
SecureVector< byte > derive_key(size_t key_len, const MemoryRegion< byte > &secret, const std::string &salt="") const
Definition: kdf.cpp:15
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::MemoryRegion< byte >
Botan
Definition: algo_base.h:14
Botan::MemoryRegion::size
size_t size() const
Definition: secmem.h:29
Botan::SecureVector< byte >