Botan  2.7.0
Crypto and TLS for C++11
oaep.h
Go to the documentation of this file.
1 /*
2 * OAEP
3 * (C) 1999-2007,2018 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_OAEP_H_
9 #define BOTAN_OAEP_H_
10 
11 #include <botan/eme.h>
12 #include <botan/hash.h>
13 
14 namespace Botan {
15 
16 /**
17 * OAEP (called EME1 in IEEE 1363 and in earlier versions of the library)
18 * as specified in PKCS#1 v2.0 (RFC 2437)
19 */
20 class BOTAN_PUBLIC_API(2,0) OAEP final : public EME
21  {
22  public:
23  size_t maximum_input_size(size_t) const override;
24 
25  /**
26  * @param hash function to use for hashing (takes ownership)
27  * @param P an optional label. Normally empty.
28  */
29  OAEP(HashFunction* hash, const std::string& P = "");
30 
31  /**
32  * @param hash function to use for hashing (takes ownership)
33  * @param mgf1_hash function to use for MGF1 (takes ownership)
34  * @param P an optional label. Normally empty.
35  */
37  HashFunction* mgf1_hash,
38  const std::string& P = "");
39  private:
40  secure_vector<uint8_t> pad(const uint8_t in[],
41  size_t in_length,
42  size_t key_length,
43  RandomNumberGenerator& rng) const override;
44 
45  secure_vector<uint8_t> unpad(uint8_t& valid_mask,
46  const uint8_t in[],
47  size_t in_len) const override;
48 
49  secure_vector<uint8_t> m_Phash;
50  std::unique_ptr<HashFunction> m_mgf1_hash;
51  };
52 
53 }
54 
55 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: eme.h:20
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88
MechanismType hash