Botan 3.6.1
Crypto and TLS for C&
oaep.h
Go to the documentation of this file.
1/*
2* OAEP
3* (C) 1999-2007,2018,2024 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/internal/eme.h>
12
13#include <botan/hash.h>
14#include <botan/internal/ct_utils.h>
15
16namespace 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) or PKCS#1 v2.1 (RFC 3447)
21*/
22class OAEP final : public EME {
23 public:
24 size_t maximum_input_size(size_t) const override;
25
26 /**
27 * @param hash function to use for hashing (takes ownership)
28 * @param P an optional label. Normally empty.
29 */
30 OAEP(std::unique_ptr<HashFunction> hash, std::string_view P = "");
31
32 /**
33 * @param hash function to use for hashing (takes ownership)
34 * @param mgf1_hash function to use for MGF1 (takes ownership)
35 * @param P an optional label. Normally empty.
36 */
37 OAEP(std::unique_ptr<HashFunction> hash, std::unique_ptr<HashFunction> mgf1_hash, std::string_view P = "");
38
39 private:
40 size_t pad(std::span<uint8_t> output,
41 std::span<const uint8_t> input,
42 size_t key_length,
43 RandomNumberGenerator& rng) const override;
44
45 CT::Option<size_t> unpad(std::span<uint8_t> output, std::span<const uint8_t> input) const override;
46
48 std::unique_ptr<HashFunction> m_mgf1_hash;
49};
50
51BOTAN_FUZZER_API CT::Option<size_t> oaep_find_delim(std::span<const uint8_t> input, std::span<const uint8_t> phash);
52
53} // namespace Botan
54
55#endif
OAEP(std::unique_ptr< HashFunction > hash, std::string_view P="")
Definition oaep.cpp:149
size_t maximum_input_size(size_t) const override
Definition oaep.cpp:141
int(* final)(unsigned char *, CTX *)
#define BOTAN_FUZZER_API
Definition compiler.h:63
CT::Option< size_t > oaep_find_delim(std::span< const uint8_t > input, std::span< const uint8_t > phash)
Definition oaep.cpp:102
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61