/src/botan/build/include/botan/internal/emsa1.h
Line | Count | Source |
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/internal/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 EMSA1 final : public EMSA |
21 | | { |
22 | | public: |
23 | | /** |
24 | | * @param hash the hash function to use |
25 | | */ |
26 | 795 | explicit EMSA1(std::unique_ptr<HashFunction> hash) : m_hash(std::move(hash)) {} |
27 | | |
28 | | std::unique_ptr<EMSA> new_object() override; |
29 | | |
30 | | std::string name() const override; |
31 | | |
32 | 795 | bool requires_message_recovery() const override { return false; } |
33 | | |
34 | | AlgorithmIdentifier config_for_x509(const Private_Key& key, |
35 | | const std::string& cert_hash_name) const override; |
36 | | private: |
37 | 510 | size_t hash_output_length() const { return m_hash->output_length(); } |
38 | | |
39 | | void update(const uint8_t[], size_t) override; |
40 | | secure_vector<uint8_t> raw_data() override; |
41 | | |
42 | | secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>& msg, |
43 | | size_t output_bits, |
44 | | RandomNumberGenerator& rng) override; |
45 | | |
46 | | bool verify(const secure_vector<uint8_t>& coded, |
47 | | const secure_vector<uint8_t>& raw, |
48 | | size_t key_bits) override; |
49 | | |
50 | | std::unique_ptr<HashFunction> m_hash; |
51 | | }; |
52 | | |
53 | | } |
54 | | |
55 | | #endif |