Botan  1.10.9
emsa.h
Go to the documentation of this file.
1 /*
2 * EMSA Classes
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_PUBKEY_EMSA_H__
9 #define BOTAN_PUBKEY_EMSA_H__
10 
11 #include <botan/secmem.h>
12 #include <botan/rng.h>
13 
14 namespace Botan {
15 
16 /**
17 * Encoding Method for Signatures, Appendix
18 */
19 class BOTAN_DLL EMSA
20  {
21  public:
22  /**
23  * Add more data to the signature computation
24  * @param input some data
25  * @param length length of input in bytes
26  */
27  virtual void update(const byte input[], size_t length) = 0;
28 
29  /**
30  * @return raw hash
31  */
32  virtual SecureVector<byte> raw_data() = 0;
33 
34  /**
35  * Return the encoding of a message
36  * @param msg the result of raw_data()
37  * @param output_bits the desired output bit size
38  * @param rng a random number generator
39  * @return encoded signature
40  */
41  virtual SecureVector<byte> encoding_of(const MemoryRegion<byte>& msg,
42  size_t output_bits,
44 
45  /**
46  * Verify the encoding
47  * @param coded the received (coded) message representative
48  * @param raw the computed (local, uncoded) message representative
49  * @param key_bits the size of the key in bits
50  * @return true if coded is a valid encoding of raw, otherwise false
51  */
52  virtual bool verify(const MemoryRegion<byte>& coded,
53  const MemoryRegion<byte>& raw,
54  size_t key_bits) = 0;
55  virtual ~EMSA() {}
56  };
57 
58 }
59 
60 #endif
virtual ~EMSA()
Definition: emsa.h:55
unsigned char byte
Definition: types.h:22
RandomNumberGenerator * rng
Definition: global_rng.cpp:165