Botan  2.6.0
Crypto and TLS for C++11
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_PUBLIC_API(2,0) 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
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
std::string name() const override
Definition: pbkdf1.h:30
PKCS5_PBKDF1(HashFunction *hash)
Definition: pbkdf1.h:28
PBKDF * clone() const override
Definition: pbkdf1.h:35
size_t salt_len
Definition: x509_obj.cpp:26
Definition: alg_id.cpp:13
MechanismType hash