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
16namespace Botan {
17
18/**
19* PKCS #5 v2.0 PBE
20*/
21class 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 */
41
42 /**
43 * @param cipher the block cipher to use
44 * @param hash the hash function to use
45 */
47
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
static bool known_cipher(const std::string &cipher)
Definition pbes2.cpp:193
PBE_PKCS5v20(DataSource &input)
Definition pbes2.cpp:228
void write(const byte[], size_t)
Definition pbes2.cpp:27
std::string name() const
Definition pbes2.cpp:202
Cipher_Dir
Definition sym_algo.h:87