1
/*************************************************
2
* Filters Header File *
3
* (C) 1999-2007 The Botan Project *
4
*************************************************/
6
#ifndef BOTAN_FILTERS_H__
7
#define BOTAN_FILTERS_H__
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>
18
/*************************************************
19
* Stream Cipher Filter *
20
*************************************************/
21
class StreamCipher_Filter : public Keyed_Filter
24
void seek(u32bit position) { cipher->seek(position); }
25
bool supports_resync() const { return (cipher->IV_LENGTH != 0); }
27
void set_iv(const InitializationVector&);
28
void write(const byte[], u32bit);
30
StreamCipher_Filter(const std::string&);
31
StreamCipher_Filter(const std::string&, const SymmetricKey&);
32
~StreamCipher_Filter() { delete cipher; }
34
SecureVector<byte> buffer;
38
/*************************************************
40
*************************************************/
41
class Hash_Filter : public Filter
44
void write(const byte input[], u32bit len) { hash->update(input, len); }
47
Hash_Filter(const std::string&, u32bit = 0);
48
~Hash_Filter() { delete hash; }
50
const u32bit OUTPUT_LENGTH;
54
/*************************************************
55
* MessageAuthenticationCode Filter *
56
*************************************************/
57
class MAC_Filter : public Keyed_Filter
60
void write(const byte input[], u32bit len) { mac->update(input, len); }
63
MAC_Filter(const std::string&, u32bit = 0);
64
MAC_Filter(const std::string&, const SymmetricKey&, u32bit = 0);
65
~MAC_Filter() { delete mac; }
67
const u32bit OUTPUT_LENGTH;
68
MessageAuthenticationCode* mac;