Botan 3.14.1
Crypto and TLS for C&
Botan::PK_Ops::Decryption Class Referenceabstract

#include <pk_ops.h>

Public Member Functions

virtual size_t ciphertext_length (size_t ptext_len) const =0
virtual size_t decrypt (uint8_t &valid_mask, std::span< uint8_t > ptext, std::span< const uint8_t > ctext)=0
virtual size_t plaintext_length (size_t ctext_len) const =0
virtual ~Decryption ()=default

Detailed Description

Public key decryption interface

Definition at line 65 of file pk_ops.h.

Constructor & Destructor Documentation

◆ ~Decryption()

virtual Botan::PK_Ops::Decryption::~Decryption ( )
virtualdefault

Member Function Documentation

◆ ciphertext_length()

virtual size_t Botan::PK_Ops::Decryption::ciphertext_length ( size_t ptext_len) const
pure virtual

Given the plaintext length, return an upper bound on the ciphertext length that decrypt() expects for this key and padding.

◆ decrypt()

virtual size_t Botan::PK_Ops::Decryption::decrypt ( uint8_t & valid_mask,
std::span< uint8_t > ptext,
std::span< const uint8_t > ctext )
pure virtual

Decrypt a ciphertext, writing the plaintext to the start of ptext

Parameters
valid_maskset to 0xFF if the ciphertext was valid, otherwise 0
ptextthe output, which must be at least plaintext_length(ctext.size()) bytes long
ctextthe ciphertext
Returns
the length of the plaintext, which is meaningless if the ciphertext was invalid

For some schemes (eg PKCS #1 v1.5) whether the ciphertext was valid, and the length of the plaintext, must be kept secret, so neither should be declassified here.

◆ plaintext_length()

virtual size_t Botan::PK_Ops::Decryption::plaintext_length ( size_t ctext_len) const
pure virtual

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