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
16namespace Botan {
17
18/**
19* PKCS #5 v1.5 PBE
20*/
21class 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 */
36 HashFunction* hash,
37 Cipher_Dir direction);
38
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
void write(const byte[], size_t)
Definition pbes1.cpp:20
std::string name() const
Definition pbes1.cpp:152
PBE_PKCS5v15(BlockCipher *cipher, HashFunction *hash, Cipher_Dir direction)
Definition pbes1.cpp:161
Cipher_Dir
Definition sym_algo.h:87