Botan: src/pbkdf/pgps2k/pgp_s2k.h Source File

Botan 1.10.16

pgp_s2k.h
Go to the documentation of this file.
1 /*
2 * OpenPGP PBKDF
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_OPENPGP_S2K_H__
9 #define BOTAN_OPENPGP_S2K_H__
10
11 #include <botan/pbkdf.h>
12 #include <botan/hash.h>
13
14 namespace Botan {
15
16 /**
17 * OpenPGP's S2K
18 */
19 class BOTAN_DLL OpenPGP_S2K : public PBKDF
20 {
21 public:
22 /**
23 * @param hash_in the hash function to use
24 */
25 OpenPGP_S2K(HashFunction* hash_in) : hash(hash_in) {}
26
27 ~OpenPGP_S2K() { delete hash; }
28
29 std::string name() const
30 {
31 return "OpenPGP-S2K(" + hash->name() + ")";
32 }
33
34 PBKDF* clone() const
35 {
36 return new OpenPGP_S2K(hash->clone());
37 }
38
39 OctetString derive_key(size_t output_len,
40 const std::string& passphrase,
41 const byte salt[], size_t salt_len,
42 size_t iterations) const;
43 private:
44 HashFunction* hash;
45 };
46
47 }
48
49 #endif
Botan::OctetString
Definition: symkey.h:19
Botan::OpenPGP_S2K::OpenPGP_S2K
OpenPGP_S2K(HashFunction *hash_in)
Definition: pgp_s2k.h:25
Botan::OpenPGP_S2K::clone
PBKDF * clone() const
Definition: pgp_s2k.h:34
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::OpenPGP_S2K::~OpenPGP_S2K
~OpenPGP_S2K()
Definition: pgp_s2k.h:27
Botan
Definition: algo_base.h:14
Botan::HashFunction
Definition: hash.h:20
Botan::OpenPGP_S2K
Definition: pgp_s2k.h:19
Botan::OpenPGP_S2K::name
std::string name() const
Definition: pgp_s2k.h:29
Botan::PBKDF
Definition: pbkdf.h:21