Botan 3.6.1
Crypto and TLS for C&
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/hash.h>
12#include <botan/internal/emsa.h>
13
14namespace 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*/
21class EMSA_X931 final : public EMSA {
22 public:
23 /**
24 * @param hash the hash function to use
25 */
26 explicit EMSA_X931(std::unique_ptr<HashFunction> hash);
27
28 std::string name() const override;
29
30 std::string hash_function() const override { return m_hash->name(); }
31
32 private:
33 void update(const uint8_t[], size_t) override;
34 std::vector<uint8_t> raw_data() override;
35
36 std::vector<uint8_t> encoding_of(const std::vector<uint8_t>&, size_t, RandomNumberGenerator& rng) override;
37
38 bool verify(const std::vector<uint8_t>&, const std::vector<uint8_t>&, size_t) override;
39
40 std::vector<uint8_t> m_empty_hash;
41 std::unique_ptr<HashFunction> m_hash;
42 uint8_t m_hash_id;
43};
44
45} // namespace Botan
46
47#endif
std::string hash_function() const override
Definition emsa_x931.h:30
EMSA_X931(std::unique_ptr< HashFunction > hash)
Definition emsa_x931.cpp:86
std::string name() const override
Definition emsa_x931.cpp:51
int(* update)(CTX *, const void *, CC_LONG len)
int(* final)(unsigned char *, CTX *)