Botan  1.10.9
pbkdf1.h
Go to the documentation of this file.
1 /*
2 * PBKDF1
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
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 compatability, use PKCS5_PBKDF2
20 */
21 class BOTAN_DLL PKCS5_PBKDF1 : public PBKDF
22  {
23  public:
24  /**
25  * Create a PKCS #5 instance using the specified hash function.
26  * @param hash_in pointer to a hash function object to use
27  */
28  PKCS5_PBKDF1(HashFunction* hash_in) : hash(hash_in) {}
29 
30  /**
31  * Copy constructor
32  * @param other the object to copy
33  */
34  PKCS5_PBKDF1(const PKCS5_PBKDF1& other) :
35  PBKDF(), hash(other.hash->clone()) {}
36 
37  ~PKCS5_PBKDF1() { delete hash; }
38 
39  std::string name() const
40  {
41  return "PBKDF1(" + hash->name() + ")";
42  }
43 
44  PBKDF* clone() const
45  {
46  return new PKCS5_PBKDF1(hash->clone());
47  }
48 
49  OctetString derive_key(size_t output_len,
50  const std::string& passphrase,
51  const byte salt[], size_t salt_len,
52  size_t iterations) const;
53  private:
54  HashFunction* hash;
55  };
56 
57 }
58 
59 #endif
PKCS5_PBKDF1(const PKCS5_PBKDF1 &other)
Definition: pbkdf1.h:34
unsigned char byte
Definition: types.h:22
PBKDF * clone() const
Definition: pbkdf1.h:44
PKCS5_PBKDF1(HashFunction *hash_in)
Definition: pbkdf1.h:28
std::string name() const
Definition: pbkdf1.h:39