monotone

monotone Mtn Source Tree

Root/botan/eax.h

1/*************************************************
2* EAX Mode Header File *
3* (C) 1999-2006 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_EAX_H__
7#define BOTAN_EAX_H__
8
9#include <botan/basefilt.h>
10
11namespace Botan {
12
13/*************************************************
14* EAX Base Class *
15*************************************************/
16class EAX_Base : public Keyed_Filter
17 {
18 public:
19 void set_key(const SymmetricKey&);
20 void set_iv(const InitializationVector&);
21 void set_header(const byte[], u32bit);
22 std::string name() const;
23
24 bool valid_keylength(u32bit) const;
25
26 ~EAX_Base() { delete cipher; delete mac; }
27 protected:
28 EAX_Base(const std::string&, u32bit);
29 void start_msg();
30 void increment_counter();
31
32 const u32bit TAG_SIZE, BLOCK_SIZE;
33 BlockCipher* cipher;
34 MessageAuthenticationCode* mac;
35 SecureVector<byte> nonce_mac, header_mac, state, buffer;
36 u32bit position;
37 };
38
39/*************************************************
40* EAX Encryption *
41*************************************************/
42class EAX_Encryption : public EAX_Base
43 {
44 public:
45 EAX_Encryption(const std::string&, u32bit = 0);
46 EAX_Encryption(const std::string&, const SymmetricKey&,
47 const InitializationVector&, u32bit = 0);
48 private:
49 void write(const byte[], u32bit);
50 void end_msg();
51 };
52
53/*************************************************
54* EAX Decryption *
55*************************************************/
56class EAX_Decryption : public EAX_Base
57 {
58 public:
59 EAX_Decryption(const std::string&, u32bit = 0);
60 EAX_Decryption(const std::string&, const SymmetricKey&,
61 const InitializationVector&, u32bit = 0);
62 private:
63 void write(const byte[], u32bit);
64 void do_write(const byte[], u32bit);
65 void end_msg();
66 SecureVector<byte> queue;
67 u32bit queue_start, queue_end;
68 };
69
70}
71
72#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status