Botan  2.4.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  void set_iv(const InitializationVector& iv) override;
27 
28  void set_key(const SymmetricKey& key) override;
29 
30  Key_Length_Specification key_spec() const override;
31 
32  bool valid_iv_length(size_t length) const override;
33 
34  std::string name() const override;
35 
36  private:
37  void write(const uint8_t input[], size_t input_length) override;
38  void start_msg() override;
39  void end_msg() override;
40 
41  void buffered_block(const uint8_t input[], size_t input_length) override;
42  void buffered_final(const uint8_t input[], size_t input_length) override;
43 
44  std::unique_ptr<Cipher_Mode> m_mode;
45  std::vector<uint8_t> m_nonce;
46  secure_vector<uint8_t> m_buffer;
47  };
48 
49 // deprecated aliases, will be removed before 2.0
51 typedef Transform_Filter Transformation_Filter;
52 
53 }
54 
55 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Transform_Filter Transformation_Filter
Definition: cipher_filter.h:51
Definition: alg_id.cpp:13
Cipher_Mode_Filter Transform_Filter
Definition: cipher_filter.h:50
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88