Botan  2.19.1
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 
15 
16 namespace Botan {
17 
18 /**
19 * OAEP (called EME1 in IEEE 1363 and in earlier versions of the library)
20 * as specified in PKCS#1 v2.0 (RFC 2437)
21 */
22 class BOTAN_PUBLIC_API(2,0) OAEP final : public EME
23  {
24  public:
25  size_t maximum_input_size(size_t) const override;
26 
27  /**
28  * @param hash function to use for hashing (takes ownership)
29  * @param P an optional label. Normally empty.
30  */
31  OAEP(HashFunction* hash, const std::string& P = "");
32 
33  /**
34  * @param hash function to use for hashing (takes ownership)
35  * @param mgf1_hash function to use for MGF1 (takes ownership)
36  * @param P an optional label. Normally empty.
37  */
38  OAEP(HashFunction* hash,
39  HashFunction* mgf1_hash,
40  const std::string& P = "");
41  private:
42  secure_vector<uint8_t> pad(const uint8_t in[],
43  size_t in_length,
44  size_t key_length,
45  RandomNumberGenerator& rng) const override;
46 
47  secure_vector<uint8_t> unpad(uint8_t& valid_mask,
48  const uint8_t in[],
49  size_t in_len) const override;
50 
51  secure_vector<uint8_t> m_Phash;
52  std::unique_ptr<HashFunction> m_mgf1_hash;
53  };
54 
56 BOTAN_TEST_API oaep_find_delim(uint8_t& valid_mask,
57  const uint8_t input[], size_t input_len,
58  const secure_vector<uint8_t>& Phash);
59 
60 }
61 
62 #endif
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
virtual secure_vector< uint8_t > pad(const uint8_t in[], size_t in_length, size_t key_length, RandomNumberGenerator &rng) const =0
virtual secure_vector< uint8_t > unpad(uint8_t &valid_mask, const uint8_t in[], size_t in_len) const =0
#define BOTAN_TEST_API
Definition: compiler.h:51
virtual size_t maximum_input_size(size_t keybits) const =0
Definition: eme.h:23
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:65
Definition: alg_id.cpp:13
secure_vector< uint8_t > oaep_find_delim(uint8_t &valid_mask, const uint8_t input[], size_t input_len, const secure_vector< uint8_t > &Phash)
Definition: oaep.cpp:95
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
MechanismType hash