Botan 3.9.0
Crypto and TLS for C&
x931_sig_padding.h
Go to the documentation of this file.
1/*
2* (C) 1999-2007 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_X931_SIGNATURE_PADDING_SCHEME_H_
8#define BOTAN_X931_SIGNATURE_PADDING_SCHEME_H_
9
10#include <botan/internal/sig_padding.h>
11
12namespace Botan {
13
14class HashFunction;
15
16/**
17* Padding scheme from X9.31 (aka EMSA2 in IEEE 1363)
18*
19* Historically used for signature padding with Rabin-Williams,
20* which is not implemented by Botan anymore.
21*
22* Sometimes used with RSA in odd protocols.
23*/
25 public:
26 /**
27 * @param hash the hash function to use
28 */
29 explicit X931_SignaturePadding(std::unique_ptr<HashFunction> hash);
30
31 std::string name() const override;
32
33 std::string hash_function() const override;
34
35 private:
36 void update(const uint8_t input[], size_t length) override;
37 std::vector<uint8_t> raw_data() override;
38
39 std::vector<uint8_t> encoding_of(std::span<const uint8_t> raw,
40 size_t key_bits,
41 RandomNumberGenerator& rng) override;
42
43 bool verify(std::span<const uint8_t> coded, std::span<const uint8_t> raw, size_t key_bits) override;
44
45 std::vector<uint8_t> m_empty_hash;
46 std::unique_ptr<HashFunction> m_hash;
47 uint8_t m_hash_id;
48};
49
50} // namespace Botan
51
52#endif
virtual std::vector< uint8_t > raw_data()=0
std::string name() const override
std::string hash_function() const override
X931_SignaturePadding(std::unique_ptr< HashFunction > hash)