Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | List of all members
Botan::OAEP Class Referencefinal

`#include <oaep.h>`

Inheritance diagram for Botan::OAEP:

## Public Member Functions
secure_vector< uint8_t > | encode (const secure_vector< uint8_t > &in, size_t key_length, RandomNumberGenerator &rng) const
secure_vector< uint8_t > | encode (const uint8_t in[], size_t in_length, size_t key_length, RandomNumberGenerator &rng) const
size_t | maximum_input_size (size_t) const override
| OAEP (HashFunction *hash, const std::string &P="")
| OAEP (HashFunction *hash, HashFunction *mgf1_hash, const std::string &P="")

## Detailed Description

OAEP (called EME1 in IEEE 1363 and in earlier versions of the library) as specified in PKCS#1 v2.0 (RFC 2437)

Definition at line 22 of file oaep.h.

## Constructor & Destructor Documentation

## ◆ OAEP() [1/2]

Botan::OAEP::OAEP | ( | HashFunction * | hash,
|  | const std::string & | P = `""`
| ) |  |

Parameters

  hash | function to use for hashing (takes ownership)
  P | an optional label. Normally empty.

Definition at line 155 of file oaep.cpp.

155 : m_mgf1_hash(hash)
156 {
157 m_Phash = m_mgf1_hash->process(P);
158 }
hash
MechanismType hash
Definition: p11_mechanism.cpp:64

## ◆ OAEP() [2/2]

Botan::OAEP::OAEP | ( | HashFunction * | hash,
|  | HashFunction * | mgf1_hash,
|  | const std::string & | P = `""`
| ) |  |

Parameters

  hash | function to use for hashing (takes ownership)
  mgf1_hash | function to use for MGF1 (takes ownership)
  P | an optional label. Normally empty.

Definition at line 160 of file oaep.cpp.

162 : m_mgf1_hash(mgf1_hash)
163 {
164 std::unique_ptr<HashFunction> phash(hash); // takes ownership
165 m_Phash = phash->process(P);
166 }

References hash.

## Member Function Documentation

## ◆ encode() [1/2]

secure_vector< uint8_t > Botan::EME::encode | ( | const secure_vector< uint8_t > & | in,
|  | size_t | key_length,
|  | RandomNumberGenerator & | rng
| ) |  | const
| inherited

Encode an input

Parameters

  in | the plaintext
  key_length | length of the key in bits
  rng | a random number generator

Returns
  encoded plaintext

Definition at line 86 of file eme.cpp.

89 {
90 return pad(msg.data(), msg.size(), key_bits, rng);
91 }
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

References Botan::EME::pad().

## ◆ encode() [2/2]

secure_vector< uint8_t > Botan::EME::encode | ( | const uint8_t | in[],
|  | size_t | in_length,
|  | size_t | key_length,
|  | RandomNumberGenerator & | rng
| ) |  | const
| inherited

Encode an input

Parameters

  in | the plaintext
  in_length | length of plaintext in bytes
  key_length | length of the key in bits
  rng | a random number generator

Returns
  encoded plaintext

Definition at line 76 of file eme.cpp.

79 {
80 return pad(msg, msg_len, key_bits, rng);
81 }

References Botan::EME::pad().

## ◆ maximum_input_size()

size_t Botan::OAEP::maximum_input_size | ( | size_t | keybits | ) | const
| override virtual

Return the maximum input size in bytes we can support

Parameters

  keybits | the size of the key in bits

Returns
  upper bound of input in bytes

Implements Botan::EME.

Definition at line 144 of file oaep.cpp.

145 {
146 if(keybits / 8 > 2*m_Phash.size() + 1)
147 return ((keybits / 8) - 2*m_Phash.size() - 1);
148 else
149 return 0;
150 }

The documentation for this class was generated from the following files:

- src/lib/pk_pad/eme_oaep/oaep.h
- src/lib/pk_pad/eme_oaep/oaep.cpp