Botan 3.5.0
Crypto and TLS for C&
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/hash.h>
12#include <botan/internal/eme.h>
13
14namespace 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) or PKCS#1 v2.1 (RFC 3447)
19*/
20class OAEP final : public EME {
21 public:
22 size_t maximum_input_size(size_t) const override;
23
24 /**
25 * @param hash function to use for hashing (takes ownership)
26 * @param P an optional label. Normally empty.
27 */
28 OAEP(std::unique_ptr<HashFunction> hash, std::string_view P = "");
29
30 /**
31 * @param hash function to use for hashing (takes ownership)
32 * @param mgf1_hash function to use for MGF1 (takes ownership)
33 * @param P an optional label. Normally empty.
34 */
35 OAEP(std::unique_ptr<HashFunction> hash, std::unique_ptr<HashFunction> mgf1_hash, std::string_view P = "");
36
37 private:
38 secure_vector<uint8_t> pad(const uint8_t in[],
39 size_t in_length,
40 size_t key_length,
41 RandomNumberGenerator& rng) const override;
42
43 secure_vector<uint8_t> unpad(uint8_t& valid_mask, const uint8_t in[], size_t in_len) const override;
44
46 std::unique_ptr<HashFunction> m_mgf1_hash;
47};
48
50 const uint8_t input[],
51 size_t input_len,
52 const secure_vector<uint8_t>& Phash);
53
54} // namespace Botan
55
56#endif
OAEP(std::unique_ptr< HashFunction > hash, std::string_view P="")
Definition oaep.cpp:145
size_t maximum_input_size(size_t) const override
Definition oaep.cpp:137
int(* final)(unsigned char *, CTX *)
#define BOTAN_TEST_API
Definition compiler.h:51
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:88
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61