Botan  2.4.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::OAEP Class Referencefinal

#include <oaep.h>

Inheritance diagram for Botan::OAEP:
Botan::EME

Public Member Functions

secure_vector< uint8_t > encode (const uint8_t in[], size_t in_length, size_t key_length, RandomNumberGenerator &rng) const
 
secure_vector< uint8_t > encode (const secure_vector< uint8_t > &in, size_t key_length, RandomNumberGenerator &rng) const
 
size_t maximum_input_size (size_t) const override
 
 OAEP (HashFunction *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 20 of file oaep.h.

Constructor & Destructor Documentation

◆ OAEP()

Botan::OAEP::OAEP ( HashFunction hash,
const std::string &  P = "" 
)
Parameters
hashfunction to use for hashing (takes ownership)
Pan optional label. Normally empty.

Definition at line 139 of file oaep.cpp.

139  : m_hash(hash)
140  {
141  m_Phash = m_hash->process(P);
142  }
MechanismType hash

Member Function Documentation

◆ encode() [1/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
inthe plaintext
in_lengthlength of plaintext in bytes
key_lengthlength of the key in bits
rnga random number generator
Returns
encoded plaintext

Definition at line 60 of file eme.cpp.

References Botan::EME::pad().

63  {
64  return pad(msg, msg_len, key_bits, rng);
65  }
virtual secure_vector< uint8_t > pad(const uint8_t in[], size_t in_length, size_t key_length, RandomNumberGenerator &rng) const =0

◆ encode() [2/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
inthe plaintext
key_lengthlength of the key in bits
rnga random number generator
Returns
encoded plaintext

Definition at line 70 of file eme.cpp.

References Botan::EME::pad().

73  {
74  return pad(msg.data(), msg.size(), key_bits, rng);
75  }
virtual secure_vector< uint8_t > pad(const uint8_t in[], size_t in_length, size_t key_length, RandomNumberGenerator &rng) const =0

◆ maximum_input_size()

size_t Botan::OAEP::maximum_input_size ( size_t  keybits) const
overridevirtual

Return the maximum input size in bytes we can support

Parameters
keybitsthe size of the key in bits
Returns
upper bound of input in bytes

Implements Botan::EME.

Definition at line 128 of file oaep.cpp.

129  {
130  if(keybits / 8 > 2*m_Phash.size() + 1)
131  return ((keybits / 8) - 2*m_Phash.size() - 1);
132  else
133  return 0;
134  }

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