Botan 2.19.5 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/eme.h>
12#include <botan/hash.h>
13
14 BOTAN_FUTURE_INTERNAL_HEADER(oaep.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)
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
55 secure_vector<uint8_t>
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
Botan::EME
Definition: eme.h:24
Botan::EME::maximum_input_size
virtual size_t maximum_input_size(size_t keybits) const =0
Botan::EME::unpad
virtual secure_vector< uint8_t > unpad(uint8_t &valid_mask, const uint8_t in[], size_t in_len) const =0
Botan::EME::pad
virtual secure_vector< uint8_t > pad(const uint8_t in[], size_t in_length, size_t key_length, RandomNumberGenerator &rng) const =0
Botan::HashFunction
Definition: hash.h:21
Botan::OAEP
Definition: oaep.h:23
Botan::RandomNumberGenerator
Definition: rng.h:26
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:29
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
BOTAN_TEST_API
#define BOTAN_TEST_API
Definition: compiler.h:51
Botan
Definition: alg_id.cpp:13
Botan::oaep_find_delim
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
Botan::secure_vector
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65
hash
MechanismType hash
Definition: p11_mechanism.cpp:64