Botan 2.19.5 Crypto and TLS for C&

pssr.h
Go to the documentation of this file.
1/*
2* PSSR
3* (C) 1999-2007 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_PSSR_H_
9#define BOTAN_PSSR_H_
10
11#include <botan/emsa.h>
12#include <botan/hash.h>
13
14 BOTAN_FUTURE_INTERNAL_HEADER(pssr.h)
15
16namespace Botan {
17
18/**
19* PSSR (called EMSA4 in IEEE 1363 and in old versions of the library)
20*/
21 class BOTAN_PUBLIC_API(2,0) PSSR final : public EMSA
22 {
23 public:
24
25 /**
26 * @param hash the hash function to use
27 */
28 explicit PSSR(HashFunction* hash);
29
30 /**
31 * @param hash the hash function to use
32 * @param salt_size the size of the salt to use in bytes
33 */
34 PSSR(HashFunction* hash, size_t salt_size);
35
36 EMSA* clone() override;
37
38 std::string name() const override;
39
40 AlgorithmIdentifier config_for_x509(const Private_Key& key,
41 const std::string& cert_hash_name) const override;
42 private:
43 void update(const uint8_t input[], size_t length) override;
44
45 secure_vector<uint8_t> raw_data() override;
46
47 secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>& msg,
48 size_t output_bits,
49 RandomNumberGenerator& rng) override;
50
51 bool verify(const secure_vector<uint8_t>& coded,
52 const secure_vector<uint8_t>& raw,
53 size_t key_bits) override;
54
55 std::unique_ptr<HashFunction> m_hash;
56 size_t m_salt_size;
57 bool m_required_salt_len;
58 };
59
60/**
61* PSSR_Raw
62* This accepts a pre-hashed buffer
63*/
64 class BOTAN_PUBLIC_API(2,3) PSSR_Raw final : public EMSA
65 {
66 public:
67
68 /**
69 * @param hash the hash function to use
70 */
71 explicit PSSR_Raw(HashFunction* hash);
72
73 /**
74 * @param hash the hash function to use
75 * @param salt_size the size of the salt to use in bytes
76 */
77 PSSR_Raw(HashFunction* hash, size_t salt_size);
78
79 EMSA* clone() override;
80
81 std::string name() const override;
82 private:
83 void update(const uint8_t input[], size_t length) override;
84
85 secure_vector<uint8_t> raw_data() override;
86
87 secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>& msg,
88 size_t output_bits,
89 RandomNumberGenerator& rng) override;
90
91 bool verify(const secure_vector<uint8_t>& coded,
92 const secure_vector<uint8_t>& raw,
93 size_t key_bits) override;
94
95 std::unique_ptr<HashFunction> m_hash;
96 secure_vector<uint8_t> m_msg;
97 size_t m_salt_size;
98 bool m_required_salt_len;
99 };
100
101}
102
103#endif
Botan::AlgorithmIdentifier
Definition: asn1_obj.h:430
Botan::EMSA
Definition: emsa.h:28
Botan::EMSA::encoding_of
virtual secure_vector< uint8_t > encoding_of(const secure_vector< uint8_t > &msg, size_t output_bits, RandomNumberGenerator &rng)=0
Botan::EMSA::verify
virtual bool verify(const secure_vector< uint8_t > &coded, const secure_vector< uint8_t > &raw, size_t key_bits)=0
Botan::EMSA::raw_data
virtual secure_vector< uint8_t > raw_data()=0
Botan::EMSA::name
virtual std::string name() const =0
Botan::EMSA::config_for_x509
virtual AlgorithmIdentifier config_for_x509(const Private_Key &key, const std::string &cert_hash_name) const
Definition: emsa.cpp:38
Botan::EMSA::clone
virtual EMSA * clone()=0
Botan::EMSA::update
virtual void update(const uint8_t input[], size_t length)=0
Botan::HashFunction
Definition: hash.h:21
Botan::PSSR_Raw
Definition: pssr.h:65
Botan::PSSR
Definition: pssr.h:22
Botan::Private_Key
Definition: pk_keys.h:181
Botan::RandomNumberGenerator
Definition: rng.h:26
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:29
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
Botan
Definition: alg_id.cpp:13
Botan::secure_vector
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65
hash
MechanismType hash
Definition: p11_mechanism.cpp:64
salt_size
size_t salt_size
Definition: p11_mechanism.cpp:70