Botan 1.10.17

pbes2.h
Go to the documentation of this file.
1 /*
2 * PKCS #5 v2.0 PBE
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_PBE_PKCS_v20_H__
9 #define BOTAN_PBE_PKCS_v20_H__
10
11 #include <botan/pbe.h>
12 #include <botan/block_cipher.h>
13 #include <botan/hash.h>
14 #include <botan/pipe.h>
15
16 namespace Botan {
17
18 /**
19 * PKCS #5 v2.0 PBE
20 */
21 class BOTAN_DLL PBE_PKCS5v20 : public PBE
22 {
23 public:
24 /**
25 * @param cipher names a block cipher
26 * @return true iff PKCS #5 knows how to use this cipher
27 */
28 static bool known_cipher(const std::string& cipher);
29
30 std::string name() const;
31
32 void write(const byte[], size_t);
33 void start_msg();
34 void end_msg();
35
36 /**
37 * Load a PKCS #5 v2.0 encrypted stream
38 * @param input is the input source
39 */
40 PBE_PKCS5v20(DataSource& input);
41
42 /**
43 * @param cipher the block cipher to use
44 * @param hash the hash function to use
45 */
46 PBE_PKCS5v20(BlockCipher* cipher, HashFunction* hash);
47
48 ~PBE_PKCS5v20();
49 private:
50 void set_key(const std::string&);
51 void new_params(RandomNumberGenerator& rng);
52 MemoryVector<byte> encode_params() const;
53 void decode_params(DataSource&);
54 OID get_oid() const;
55
56 void flush_pipe(bool);
57
58 Cipher_Dir direction;
59 BlockCipher* block_cipher;
60 HashFunction* hash_function;
61 SecureVector<byte> salt, key, iv;
62 size_t iterations, key_length;
63 Pipe pipe;
64 };
65
66 }
67
68 #endif
Botan::RandomNumberGenerator
Definition: rng.h:20
Botan::DataSource
Definition: data_src.h:20
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::PBE_PKCS5v20
Definition: pbes2.h:21
Botan
Definition: algo_base.h:14
Botan::MemoryVector< byte >
Botan::HashFunction
Definition: hash.h:20
Botan::SecureVector< byte >
Botan::Pipe
Definition: pipe.h:25
Botan::Cipher_Dir
Cipher_Dir
Definition: sym_algo.h:87
Botan::OID
Definition: asn1_oid.h:20
Botan::PBE
Definition: pbe.h:21
Botan::BlockCipher
Definition: block_cipher.h:18