Botan 3.8.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(std::span<const uint8_t> raw,
37 size_t key_bits,
38 RandomNumberGenerator& rng) override;
39
40 bool verify(std::span<const uint8_t> coded, std::span<const uint8_t> raw, size_t key_bits) override;
41
42 std::vector<uint8_t> m_empty_hash;
43 std::unique_ptr<HashFunction> m_hash;
44 uint8_t m_hash_id;
45};
46
47} // namespace Botan
48
49#endif
std::string hash_function() const override
Definition emsa_x931.h:30
EMSA_X931(std::unique_ptr< HashFunction > hash)
Definition emsa_x931.cpp:89
std::string name() const override
Definition emsa_x931.cpp:53