Botan  2.8.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_PUBLIC_API(2,0) EMSA1 final : 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  std::string name() const override;
31 
32  AlgorithmIdentifier config_for_x509(const Private_Key& key,
33  const std::string& cert_hash_name) const override;
34  private:
35  size_t hash_output_length() const { return m_hash->output_length(); }
36 
37  void update(const uint8_t[], size_t) override;
38  secure_vector<uint8_t> raw_data() override;
39 
40  secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>& msg,
41  size_t output_bits,
42  RandomNumberGenerator& rng) override;
43 
44  bool verify(const secure_vector<uint8_t>& coded,
45  const secure_vector<uint8_t>& raw,
46  size_t key_bits) override;
47 
48  std::unique_ptr<HashFunction> m_hash;
49  };
50 
51 }
52 
53 #endif
EMSA1(HashFunction *hash)
Definition: emsa1.h:26
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
std::string name
Definition: alg_id.cpp:13
int(* update)(CTX *, const void *, CC_LONG len)
MechanismType hash