Botan  2.4.0
Crypto and TLS for C++11
oaep.h
Go to the documentation of this file.
1 /*
2 * OAEP
3 * (C) 1999-2007 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  private:
31  secure_vector<uint8_t> pad(const uint8_t in[],
32  size_t in_length,
33  size_t key_length,
34  RandomNumberGenerator& rng) const override;
35 
36  secure_vector<uint8_t> unpad(uint8_t& valid_mask,
37  const uint8_t in[],
38  size_t in_len) const override;
39 
40  secure_vector<uint8_t> m_Phash;
41  std::unique_ptr<HashFunction> m_hash;
42  };
43 
44 }
45 
46 #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