Botan 3.0.0-alpha0
Crypto and TLS for C&
Public Member Functions | List of all members
Botan::PK_Encryptor_EME Class Referencefinal

#include <pubkey.h>

Inheritance diagram for Botan::PK_Encryptor_EME:
Botan::PK_Encryptor

Public Member Functions

size_t ciphertext_length (size_t ptext_len) const override
 
template<typename Alloc >
std::vector< uint8_t > encrypt (const std::vector< uint8_t, Alloc > &in, RandomNumberGenerator &rng) const
 
std::vector< uint8_t > encrypt (const uint8_t in[], size_t length, RandomNumberGenerator &rng) const
 
size_t maximum_input_size () const override
 
PK_Encryptor_EMEoperator= (const PK_Encryptor_EME &)=delete
 
PK_Encryptor_EMEoperator= (PK_Encryptor_EME &&)=delete
 
 PK_Encryptor_EME (const PK_Encryptor_EME &)=delete
 
 PK_Encryptor_EME (const Public_Key &key, RandomNumberGenerator &rng, const std::string &padding, const std::string &provider="")
 
 PK_Encryptor_EME (PK_Encryptor_EME &&)=delete
 
 ~PK_Encryptor_EME ()
 

Detailed Description

Encryption using a standard message recovery algorithm like RSA or ElGamal, paired with an encoding scheme like OAEP.

Definition at line 500 of file pubkey.h.

Constructor & Destructor Documentation

◆ PK_Encryptor_EME() [1/3]

Botan::PK_Encryptor_EME::PK_Encryptor_EME ( const Public_Key key,
RandomNumberGenerator rng,
const std::string &  padding,
const std::string &  provider = "" 
)

Construct an instance.

Parameters
keythe key to use inside the encryptor
rngthe RNG to use
paddingthe message encoding scheme to use (eg "OAEP(SHA-256)")
providerthe provider to use

Definition at line 87 of file pubkey.cpp.

91 {
92 m_op = key.create_encryption_op(rng, padding, provider);
93 if(!m_op)
94 throw Invalid_Argument("Key type " + key.algo_name() + " does not support encryption");
95 }

References Botan::Public_Key::algo_name(), and Botan::Public_Key::create_encryption_op().

◆ ~PK_Encryptor_EME()

Botan::PK_Encryptor_EME::~PK_Encryptor_EME ( )
default

◆ PK_Encryptor_EME() [2/3]

Botan::PK_Encryptor_EME::PK_Encryptor_EME ( const PK_Encryptor_EME )
delete

◆ PK_Encryptor_EME() [3/3]

Botan::PK_Encryptor_EME::PK_Encryptor_EME ( PK_Encryptor_EME &&  )
delete

Member Function Documentation

◆ ciphertext_length()

size_t Botan::PK_Encryptor_EME::ciphertext_length ( size_t  ptext_len) const
overridevirtual

Return an upper bound on the ciphertext length for a particular plaintext input length

Implements Botan::PK_Encryptor.

Definition at line 99 of file pubkey.cpp.

100 {
101 return m_op->ciphertext_length(ptext_len);
102 }

◆ encrypt() [1/2]

template<typename Alloc >
std::vector< uint8_t > Botan::PK_Encryptor::encrypt ( const std::vector< uint8_t, Alloc > &  in,
RandomNumberGenerator rng 
) const
inlineinherited

Encrypt a message.

Parameters
inthe message
rngthe random number source to use
Returns
encrypted message

Definition at line 48 of file pubkey.h.

50 {
51 return enc(in.data(), in.size(), rng);
52 }

◆ encrypt() [2/2]

std::vector< uint8_t > Botan::PK_Encryptor::encrypt ( const uint8_t  in[],
size_t  length,
RandomNumberGenerator rng 
) const
inlineinherited

Encrypt a message.

Parameters
inthe message as a byte array
lengththe length of the above byte array
rngthe random number source to use
Returns
encrypted message

Definition at line 35 of file pubkey.h.

37 {
38 return enc(in, length, rng);
39 }

Referenced by Botan::KeyPair::encryption_consistency_check().

◆ maximum_input_size()

size_t Botan::PK_Encryptor_EME::maximum_input_size ( ) const
overridevirtual

Return the maximum allowed message size in bytes.

Returns
maximum message size in bytes

Implements Botan::PK_Encryptor.

Definition at line 110 of file pubkey.cpp.

111 {
112 return m_op->max_input_bits() / 8;
113 }

Referenced by Botan::KeyPair::encryption_consistency_check().

◆ operator=() [1/2]

PK_Encryptor_EME & Botan::PK_Encryptor_EME::operator= ( const PK_Encryptor_EME )
delete

◆ operator=() [2/2]

PK_Encryptor_EME & Botan::PK_Encryptor_EME::operator= ( PK_Encryptor_EME &&  )
delete

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