Botan 1.10.17
key_filt.h
Go to the documentation of this file.
1/*
2* Keyed_Filter
3* (C) 1999-2007 Jack Lloyd
4*
5* Distributed under the terms of the Botan license
6*/
7
8#ifndef BOTAN_KEYED_FILTER_H__
9#define BOTAN_KEYED_FILTER_H__
10
11#include <botan/filter.h>
12#include <botan/sym_algo.h>
13
14namespace Botan {
15
16/**
17* This class represents keyed filters, i.e. filters that have to be
18* fed with a key in order to function.
19*/
20class BOTAN_DLL Keyed_Filter : public Filter
21 {
22 public:
23 /**
24 * Set the key of this filter
25 * @param key the key to use
26 */
27 virtual void set_key(const SymmetricKey& key) = 0;
28
29 /**
30 * Set the initialization vector of this filter. Note: you should
31 * call set_iv() only after you have called set_key()
32 * @param iv the initialization vector to use
33 */
34 virtual void set_iv(const InitializationVector& iv);
35
36 /**
37 * Check whether a key length is valid for this filter
38 * @param length the key length to be checked for validity
39 * @return true if the key length is valid, false otherwise
40 */
41 virtual bool valid_keylength(size_t length) const = 0;
42
43 /**
44 * Check whether an IV length is valid for this filter
45 * @param length the IV length to be checked for validity
46 * @return true if the IV length is valid, false otherwise
47 */
48 virtual bool valid_iv_length(size_t length) const
49 { return (length == 0); }
50 };
51
52}
53
54#endif
virtual void set_key(const SymmetricKey &key)=0
virtual void set_iv(const InitializationVector &iv)
Definition basefilt.cpp:13
virtual bool valid_keylength(size_t length) const =0
virtual bool valid_iv_length(size_t length) const
Definition key_filt.h:48
OctetString SymmetricKey
Definition symkey.h:147
OctetString InitializationVector
Definition symkey.h:152