Botan  2.1.0
Crypto and TLS for C++11
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 namespace Botan {
15 
16 /**
17 * PSSR (called EMSA4 in IEEE 1363 and in old versions of the library)
18 */
19 class BOTAN_DLL PSSR final : public EMSA
20  {
21  public:
22 
23  /**
24  * @param hash the hash function to use
25  */
26  explicit PSSR(HashFunction* hash);
27 
28  /**
29  * @param hash the hash function to use
30  * @param salt_size the size of the salt to use in bytes
31  */
32  PSSR(HashFunction* hash, size_t salt_size);
33 
34  EMSA* clone() override { return new PSSR(m_hash->clone(), m_SALT_SIZE); }
35  private:
36  void update(const uint8_t input[], size_t length) override;
37 
38  secure_vector<uint8_t> raw_data() override;
39 
40  secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>& msg,
41  size_t output_bits,
42  RandomNumberGenerator& rng) override;
43 
44  bool verify(const secure_vector<uint8_t>& coded,
45  const secure_vector<uint8_t>& raw,
46  size_t key_bits) override;
47 
48  size_t m_SALT_SIZE;
49  std::unique_ptr<HashFunction> m_hash;
50  };
51 
52 }
53 
54 #endif
EMSA * clone() override
Definition: pssr.h:34
size_t salt_size
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Definition: alg_id.cpp:13
std::unique_ptr< HashFunction > m_hash
Definition: tpm.cpp:439
MechanismType hash