Botan  2.1.0
Crypto and TLS for C++11
emsa_x931.h
Go to the documentation of this file.
1 /*
2 * X9.31 EMSA
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_EMSA_X931_H__
9 #define BOTAN_EMSA_X931_H__
10 
11 #include <botan/emsa.h>
12 #include <botan/hash.h>
13 
14 namespace Botan {
15 
16 /**
17 * EMSA from X9.31 (EMSA2 in IEEE 1363)
18 * Useful for Rabin-Williams, also sometimes used with RSA in
19 * odd protocols.
20 */
21 class BOTAN_DLL EMSA_X931 final : public EMSA
22  {
23  public:
24  /**
25  * @param hash the hash function to use
26  */
27  explicit EMSA_X931(HashFunction* hash);
28 
29  EMSA* clone() override { return new EMSA_X931(m_hash->clone()); }
30  private:
31  void update(const uint8_t[], size_t) override;
32  secure_vector<uint8_t> raw_data() override;
33 
34  secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>&, size_t,
35  RandomNumberGenerator& rng) override;
36 
37  bool verify(const secure_vector<uint8_t>&, const secure_vector<uint8_t>&,
38  size_t) override;
39 
40  secure_vector<uint8_t> m_empty_hash;
41  std::unique_ptr<HashFunction> m_hash;
42  uint8_t m_hash_id;
43  };
44 
45 }
46 
47 #endif
std::vector< uint8_t > m_hash_id
Definition: tpm.cpp:440
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
EMSA * clone() override
Definition: emsa_x931.h:29
MechanismType hash