Botan 1.10.17
Botan::EME1 Class Reference

#include <eme1.h>

Inheritance diagram for Botan::EME1:
Botan::EME

Public Member Functions

SecureVector< bytedecode (const byte in[], size_t in_length, size_t key_length) const
SecureVector< bytedecode (const MemoryRegion< byte > &in, size_t key_length) const
 EME1 (HashFunction *hash, const std::string &P="")
SecureVector< byteencode (const byte in[], size_t in_length, size_t key_length, RandomNumberGenerator &rng) const
SecureVector< byteencode (const MemoryRegion< byte > &in, size_t key_length, RandomNumberGenerator &rng) const
size_t maximum_input_size (size_t) const
 ~EME1 ()

Detailed Description

EME1, aka OAEP

Definition at line 20 of file eme1.h.

Constructor & Destructor Documentation

◆ EME1()

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

Definition at line 125 of file eme1.cpp.

126 {
127 Phash = hash->process(P);
128 mgf = new MGF1(hash);
129 }
MGF1(HashFunction *hash)
Definition mgf1.cpp:42

References Botan::MGF1::MGF1(), and Botan::Buffered_Computation::process().

Referenced by Botan::get_eme().

◆ ~EME1()

Botan::EME1::~EME1 ( )
inline

Definition at line 31 of file eme1.h.

31{ delete mgf; }

Member Function Documentation

◆ decode() [1/2]

SecureVector< byte > Botan::EME::decode ( const byte in[],
size_t in_length,
size_t key_length ) const
inherited

Decode an input

Parameters
inthe encoded plaintext
in_lengthlength of encoded plaintext in bytes
key_lengthlength of the key in bits
Returns
plaintext

Definition at line 35 of file eme.cpp.

37 {
38 return unpad(msg, msg_len, key_bits);
39 }

Referenced by maximum_input_size().

◆ decode() [2/2]

SecureVector< byte > Botan::EME::decode ( const MemoryRegion< byte > & in,
size_t key_length ) const
inherited

Decode an input

Parameters
inthe encoded plaintext
key_lengthlength of the key in bits
Returns
plaintext

Definition at line 44 of file eme.cpp.

46 {
47 return unpad(&msg[0], msg.size(), key_bits);
48 }

References Botan::MemoryRegion< T >::size().

◆ encode() [1/2]

SecureVector< byte > Botan::EME::encode ( const byte 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 15 of file eme.cpp.

18 {
19 return pad(msg, msg_len, key_bits, rng);
20 }

Referenced by maximum_input_size().

◆ encode() [2/2]

SecureVector< byte > Botan::EME::encode ( const MemoryRegion< byte > & 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 25 of file eme.cpp.

28 {
29 return pad(&msg[0], msg.size(), key_bits, rng);
30 }

References Botan::MemoryRegion< T >::size().

◆ maximum_input_size()

size_t Botan::EME1::maximum_input_size ( size_t keybits) const
virtual

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 114 of file eme1.cpp.

115 {
116 if(keybits / 8 > 2*Phash.size() + 1)
117 return ((keybits / 8) - 2*Phash.size() - 1);
118 else
119 return 0;
120 }

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