Botan  2.7.0
Crypto and TLS for C++11
cipher_filter.h
Go to the documentation of this file.
1 /*
2 * Filter interface for ciphers
3 * (C) 2013,2016 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_TRANSFORM_FILTER_H_
9 #define BOTAN_TRANSFORM_FILTER_H_
10 
11 #include <botan/cipher_mode.h>
12 #include <botan/key_filt.h>
13 #include <botan/buf_filt.h>
14 
15 namespace Botan {
16 
17 /**
18 * Filter interface for cipher modes
19 */
21  private Buffered_Filter
22  {
23  public:
24  explicit Cipher_Mode_Filter(Cipher_Mode* t);
25 
26  explicit Cipher_Mode_Filter(std::unique_ptr<Cipher_Mode> t) :
27  Cipher_Mode_Filter(t.release()) {}
28 
29  void set_iv(const InitializationVector& iv) override;
30 
31  void set_key(const SymmetricKey& key) override;
32 
33  Key_Length_Specification key_spec() const override;
34 
35  bool valid_iv_length(size_t length) const override;
36 
37  std::string name() const override;
38 
39  private:
40  void write(const uint8_t input[], size_t input_length) override;
41  void start_msg() override;
42  void end_msg() override;
43 
44  void buffered_block(const uint8_t input[], size_t input_length) override;
45  void buffered_final(const uint8_t input[], size_t input_length) override;
46 
47  std::unique_ptr<Cipher_Mode> m_mode;
48  std::vector<uint8_t> m_nonce;
49  secure_vector<uint8_t> m_buffer;
50  };
51 
52 // deprecated aliases, will be removed before 2.0
55 
56 }
57 
58 #endif
Cipher_Mode_Filter(std::unique_ptr< Cipher_Mode > t)
Definition: cipher_filter.h:26
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Transform_Filter Transformation_Filter
Definition: cipher_filter.h:54
Definition: alg_id.cpp:13
Cipher_Mode_Filter Transform_Filter
Definition: cipher_filter.h:53
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88