monotone

monotone Mtn Source Tree

Root/botan/filters.h

1/*************************************************
2* Filters Header File *
3* (C) 1999-2005 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_FILTERS_H__
7#define BOTAN_FILTERS_H__
8
9#include <botan/pipe.h>
10#include <botan/basefilt.h>
11#include <botan/data_snk.h>
12#include <botan/pk_filts.h>
13#include <botan/base64.h>
14#include <botan/hex.h>
15
16namespace Botan {
17
18/*************************************************
19* Stream Cipher Filter *
20*************************************************/
21class StreamCipher_Filter : public Keyed_Filter
22 {
23 public:
24 void seek(u32bit position) { cipher->seek(position); }
25 bool supports_resync() const { return (cipher->IV_LENGTH != 0); }
26
27 void set_iv(const InitializationVector&);
28 void write(const byte[], u32bit);
29
30 StreamCipher_Filter(const std::string&);
31 ~StreamCipher_Filter() { delete cipher; }
32 private:
33 SecureVector<byte> buffer;
34 StreamCipher* cipher;
35 };
36
37/*************************************************
38* Hash Filter *
39*************************************************/
40class Hash_Filter : public Filter
41 {
42 public:
43 void write(const byte input[], u32bit len) { hash->update(input, len); }
44 void end_msg();
45
46 Hash_Filter(const std::string&, u32bit = 0);
47 ~Hash_Filter() { delete hash; }
48 private:
49 const u32bit OUTPUT_LENGTH;
50 HashFunction* hash;
51 };
52
53/*************************************************
54* MessageAuthenticationCode Filter *
55*************************************************/
56class MAC_Filter : public Keyed_Filter
57 {
58 public:
59 void write(const byte input[], u32bit len) { mac->update(input, len); }
60 void end_msg();
61
62 MAC_Filter(const std::string&, u32bit = 0);
63 MAC_Filter(const std::string&, const SymmetricKey&, u32bit = 0);
64 ~MAC_Filter() { delete mac; }
65 private:
66 const u32bit OUTPUT_LENGTH;
67 MessageAuthenticationCode* mac;
68 };
69
70}
71
72#endif

Archive Download this file

Branches

Tags

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