Botan 1.10.17
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
14namespace Botan {
15
16/**
17* OpenPGP's S2K
18*/
19class 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
PBKDF * clone() const
Definition pgp_s2k.h:34
OpenPGP_S2K(HashFunction *hash_in)
Definition pgp_s2k.h:25
std::string name() const
Definition pgp_s2k.h:29