Botan 1.10.17

pbes1.h
Go to the documentation of this file.
1 /*
2 * PKCS #5 v1.5 PBE
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_PBE_PKCS_V15_H__
9 #define BOTAN_PBE_PKCS_V15_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 v1.5 PBE
20 */
21 class BOTAN_DLL PBE_PKCS5v15 : public PBE
22 {
23 public:
24 std::string name() const;
25
26 void write(const byte[], size_t);
27 void start_msg();
28 void end_msg();
29
30 /**
31 * @param cipher the block cipher to use (DES or RC2)
32 * @param hash the hash function to use
33 * @param direction are we encrypting or decrypting
34 */
35 PBE_PKCS5v15(BlockCipher* cipher,
36 HashFunction* hash,
37 Cipher_Dir direction);
38
39 ~PBE_PKCS5v15();
40 private:
41 void set_key(const std::string&);
42 void new_params(RandomNumberGenerator& rng);
43 MemoryVector<byte> encode_params() const;
44 void decode_params(DataSource&);
45 OID get_oid() const;
46
47 void flush_pipe(bool);
48
49 Cipher_Dir direction;
50 BlockCipher* block_cipher;
51 HashFunction* hash_function;
52
53 SecureVector<byte> salt, key, iv;
54 size_t iterations;
55 Pipe pipe;
56 };
57
58 }
59
60 #endif
Botan::RandomNumberGenerator
Definition: rng.h:20
Botan::DataSource
Definition: data_src.h:20
Botan::byte
unsigned char byte
Definition: types.h:22
Botan
Definition: algo_base.h:14
Botan::MemoryVector< byte >
Botan::HashFunction
Definition: hash.h:20
Botan::PBE_PKCS5v15
Definition: pbes1.h:21
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