Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

emsa_pkcs1.h
Go to the documentation of this file.
1 /*
2 * PKCS #1 v1.5 signature padding
3 * (C) 1999-2008 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_EMSA_PKCS1_H__
9 #define BOTAN_EMSA_PKCS1_H__
10
11 #include <botan/emsa.h>
12 #include <botan/hash.h>
13
14 namespace Botan {
15
16 /**
17 * PKCS #1 v1.5 signature padding
18 * aka PKCS #1 block type 1
19 * aka EMSA3 from IEEE 1363
20 */
21 class BOTAN_DLL EMSA_PKCS1v15 final : public EMSA
22 {
23 public:
24 /**
25 * @param hash the hash function to use
26 */
27 explicit EMSA_PKCS1v15(HashFunction* hash);
28
29 EMSA* clone() override { return new EMSA_PKCS1v15(m_hash->clone()); }
30
31 void update(const uint8_t[], size_t) override;
32
33 secure_vector<uint8_t> raw_data() override;
34
35 secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>&, size_t,
36 RandomNumberGenerator& rng) override;
37
38 bool verify(const secure_vector<uint8_t>&, const secure_vector<uint8_t>&,
39 size_t) override;
40 private:
41 std::unique_ptr<HashFunction> m_hash;
42 std::vector<uint8_t> m_hash_id;
43 };
44
45 /**
46 * EMSA_PKCS1v15_Raw which is EMSA_PKCS1v15 without a hash or digest id
47 * (which according to QCA docs is "identical to PKCS#11's CKM_RSA_PKCS
48 * mechanism", something I have not confirmed)
49 */
50 class BOTAN_DLL EMSA_PKCS1v15_Raw final : public EMSA
51 {
52 public:
53 EMSA* clone() override { return new EMSA_PKCS1v15_Raw(); }
54
55 void update(const uint8_t[], size_t) override;
56
57 secure_vector<uint8_t> raw_data() override;
58
59 secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>&, size_t,
60 RandomNumberGenerator& rng) override;
61
62 bool verify(const secure_vector<uint8_t>&, const secure_vector<uint8_t>&,
63 size_t) override;
64
65 private:
66 secure_vector<uint8_t> m_message;
67 };
68
69 }
70
71 #endif
Botan::RandomNumberGenerator
Definition: rng.h:25
Botan::EMSA_PKCS1v15_Raw::clone
EMSA * clone() override
Definition: emsa_pkcs1.h:53
Botan::EMSA_PKCS1v15::clone
EMSA * clone() override
Definition: emsa_pkcs1.h:29
m_hash_id
std::vector< uint8_t > m_hash_id
Definition: tpm.cpp:440
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan::EMSA_PKCS1v15
Definition: emsa_pkcs1.h:21
Botan::EMSA
Definition: emsa.h:21
Botan
Definition: alg_id.cpp:13
Botan::EMSA_PKCS1v15_Raw
Definition: emsa_pkcs1.h:50
Botan::HashFunction
Definition: hash.h:19
m_hash
std::unique_ptr< HashFunction > m_hash
Definition: tpm.cpp:439
hash
MechanismType hash
Definition: p11_mechanism.cpp:63