blob: e951b56731e3b03f035b2ecf951c69e22eaeaa84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* PBKDF
* (C) 1999-2007 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_PBKDF_H__
#define BOTAN_PBKDF_H__
#include <botan/algo_base.h>
#include <botan/symkey.h>
namespace Botan {
/**
* Base class for PBKDF (password based key derivation function)
* implementations. Converts a password into a key using a salt
* and iterated hashing to make brute force attacks harder.
*/
class BOTAN_DLL PBKDF : public Algorithm
{
public:
/**
* @return new instance of this same algorithm
*/
virtual PBKDF* clone() const = 0;
void clear() {}
/**
* Derive a key from a passphrase
* @param output_len the desired length of the key to produce
* @param passphrase the password to derive the key from
* @param salt a randomly chosen salt
* @param salt_len length of salt in bytes
* @param iterations the number of iterations to use (use 10K or more)
*/
virtual OctetString derive_key(size_t output_len,
const std::string& passphrase,
const byte salt[], size_t salt_len,
size_t iterations) const = 0;
};
/**
* For compatability with 1.8
*/
typedef PBKDF S2K;
}
#endif
|