Botan  2.1.0
Crypto and TLS for C++11
emsa1.h
Go to the documentation of this file.
1 /*
2 * EMSA1
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_EMSA1_H__
9 #define BOTAN_EMSA1_H__
10 
11 #include <botan/emsa.h>
12 #include <botan/hash.h>
13 
14 namespace Botan {
15 
16 /**
17 * EMSA1 from IEEE 1363
18 * Essentially, sign the hash directly
19 */
20 class BOTAN_DLL EMSA1 : public EMSA
21  {
22  public:
23  /**
24  * @param hash the hash function to use
25  */
26  explicit EMSA1(HashFunction* hash) : m_hash(hash) {}
27 
28  EMSA* clone() override;
29 
30  protected:
31  size_t hash_output_length() const { return m_hash->output_length(); }
32 
33  std::unique_ptr<HashFunction> m_hash;
34 
35  private:
36  void update(const uint8_t[], size_t) override;
37  secure_vector<uint8_t> raw_data() override;
38 
39  secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>& msg,
40  size_t output_bits,
41  RandomNumberGenerator& rng) override;
42 
43  bool verify(const secure_vector<uint8_t>& coded,
44  const secure_vector<uint8_t>& raw,
45  size_t key_bits) override;
46 
47  };
48 
49 }
50 
51 #endif
EMSA1(HashFunction *hash)
Definition: emsa1.h:26
size_t hash_output_length() const
Definition: emsa1.h:31
std::unique_ptr< HashFunction > m_hash
Definition: emsa1.h:33
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Definition: alg_id.cpp:13
std::unique_ptr< HashFunction > m_hash
Definition: tpm.cpp:439
MechanismType hash