Botan 2.13.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 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 explicit PKCS5_PBKDF1(HashFunction* hash) : m_hash(hash) {}
31
32 std::string name() const override
33 {
34 return "PBKDF1(" + m_hash->name() + ")";
35 }
36
37 PBKDF* clone() const override
38 {
39 return new PKCS5_PBKDF1(m_hash->clone());
40 }
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
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:28
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan::PKCS5_PBKDF1
Definition: pbkdf1.h:23
Botan::PKCS5_PBKDF1::name
std::string name() const override
Definition: pbkdf1.h:32
Botan::PBKDF::pbkdf
virtual size_t pbkdf(uint8_t out[], size_t out_len, const std::string &passphrase, const uint8_t salt[], size_t salt_len, size_t iterations, std::chrono::milliseconds msec) const =0
Botan::PKCS5_PBKDF1::PKCS5_PBKDF1
PKCS5_PBKDF1(HashFunction *hash)
Definition: pbkdf1.h:30
Botan::PKCS5_PBKDF1::clone
PBKDF * clone() const override
Definition: pbkdf1.h:37
salt_len
size_t salt_len
Definition: x509_obj.cpp:25
Botan
Definition: alg_id.cpp:13
Botan::HashFunction
Definition: hash.h:20
m_hash
std::unique_ptr< HashFunction > m_hash
Definition: tpm.cpp:446
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:139
hash
MechanismType hash
Definition: p11_mechanism.cpp:64
Botan::PBKDF
Definition: pbkdf.h:24