Botan 1.10.17
ecb.h
Go to the documentation of this file.
1/*
2* ECB Mode
3* (C) 1999-2009 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_ECB_H__
9#define BOTAN_ECB_H__
10
11#include <botan/block_cipher.h>
12#include <botan/mode_pad.h>
13#include <botan/key_filt.h>
14#include <botan/buf_filt.h>
15
16namespace Botan {
17
18/**
19* ECB Encryption
20*/
21class BOTAN_DLL ECB_Encryption : public Keyed_Filter,
22 private Buffered_Filter
23 {
24 public:
25 std::string name() const;
26
27 void set_key(const SymmetricKey& key) { cipher->set_key(key); }
28
29 bool valid_keylength(size_t key_len) const
30 { return cipher->valid_keylength(key_len); }
31
34
37 const SymmetricKey& key);
38
40 private:
41 void buffered_block(const byte input[], size_t input_length);
42 void buffered_final(const byte input[], size_t input_length);
43
44 void write(const byte input[], size_t input_length);
45 void end_msg();
46
47 BlockCipher* cipher;
50 };
51
52/**
53* ECB Decryption
54*/
55class BOTAN_DLL ECB_Decryption : public Keyed_Filter,
56 public Buffered_Filter
57 {
58 public:
59 std::string name() const;
60
61 void set_key(const SymmetricKey& key) { cipher->set_key(key); }
62
63 bool valid_keylength(size_t key_len) const
64 { return cipher->valid_keylength(key_len); }
65
68
71 const SymmetricKey& key);
72
74 private:
75 void buffered_block(const byte input[], size_t input_length);
76 void buffered_final(const byte input[], size_t input_length);
77
78 void write(const byte input[], size_t input_length);
79 void end_msg();
80
81 BlockCipher* cipher;
84 };
85
86}
87
88#endif
Buffered_Filter(size_t block_size, size_t final_minimum)
Definition buf_filt.cpp:18
ECB_Decryption(BlockCipher *ciph, BlockCipherModePaddingMethod *pad)
Definition ecb.cpp:112
std::string name() const
Definition ecb.cpp:150
void set_key(const SymmetricKey &key)
Definition ecb.h:61
bool valid_keylength(size_t key_len) const
Definition ecb.h:63
void set_key(const SymmetricKey &key)
Definition ecb.h:27
std::string name() const
Definition ecb.cpp:53
ECB_Encryption(BlockCipher *ciph, BlockCipherModePaddingMethod *pad)
Definition ecb.cpp:15
bool valid_keylength(size_t key_len) const
Definition ecb.h:29
OctetString SymmetricKey
Definition symkey.h:147