# PK_Encryptor Class Reference

`#include <cryptlib.h>`

Inheritance diagram for PK_Encryptor:

List of all members.

## Detailed Description

interface for public-key encryptors

Definition at line 1237 of file cryptlib.h.

## Public Member Functions
virtual void | Encrypt (RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs &parameters=g_nullNameValuePairs) const =0
| encrypt a byte string
virtual BufferedTransformation * | CreateEncryptionFilter (RandomNumberGenerator &rng, BufferedTransformation *attachment=NULL, const NameValuePairs &parameters=g_nullNameValuePairs) const
| create a new encryption filter
virtual size_t | MaxPlaintextLength (size_t ciphertextLength) const =0
| maximum length of plaintext for a given ciphertext length
virtual size_t | CiphertextLength (size_t plaintextLength) const =0
| calculate length of ciphertext given length of plaintext
virtual bool | ParameterSupported (const char *name) const =0
| this object supports the use of the parameter with the given name
virtual size_t | FixedCiphertextLength () const
| return fixed ciphertext length, if one exists, otherwise return 0
virtual size_t | FixedMaxPlaintextLength () const
| return maximum plaintext length given the fixed ciphertext length, if one exists, otherwise return 0
CryptoMaterial & | AccessMaterial ()
| returns a reference to the crypto material used by this object
const CryptoMaterial & | GetMaterial () const
| returns a const reference to the crypto material used by this object
virtual PublicKey & | AccessPublicKey ()=0
virtual const PublicKey & | GetPublicKey () const
void | BERDecode (BufferedTransformation &bt)
| for backwards compatibility, calls AccessMaterial().Load(bt)
void | DEREncode (BufferedTransformation &bt) const
| for backwards compatibility, calls GetMaterial().Save(bt)
virtual std::string | AlgorithmName () const
| returns name of this algorithm, not universally implemented yet
virtual Clonable * | Clone () const
| this is not implemented by most classes yet
## Classes
class | InvalidPlaintextLength
| exception thrown when trying to encrypt plaintext of invalid length More...

## Member Function Documentation

virtual void PK_Encryptor::Encrypt | ( | RandomNumberGenerator & | rng,
|  | const byte * | plaintext,
|  | size_t | plaintextLength,
|  | byte * | ciphertext,
|  | const NameValuePairs & | parameters = `g_nullNameValuePairs` |
| ) |  |  | const`[pure virtual]`

encrypt a byte string

Precondition:
  CiphertextLength(plaintextLength) != 0 (i.e., plaintext isn't too long)

  size of ciphertext == CiphertextLength(plaintextLength)

Implemented in TF_EncryptorBase, DL_EncryptorBase< T >, and DL_EncryptorBase< SCHEME_OPTIONS::Element >.

BufferedTransformation * PK_Encryptor::CreateEncryptionFilter | ( | RandomNumberGenerator & | rng,
|  | BufferedTransformation * | attachment = `NULL`,
|  | const NameValuePairs & | parameters = `g_nullNameValuePairs` |
| ) |  |  | const`[virtual]`

create a new encryption filter

Note:
  The caller is responsible for deleting the returned pointer.

  Encoding parameters should be passed in the "EP" channel.

Definition at line 696 of file cryptlib.cpp.

virtual size_t PK_CryptoSystem::MaxPlaintextLength | ( | size_t | ciphertextLength | ) | const`[pure virtual, inherited]`

maximum length of plaintext for a given ciphertext length

Note:
  This function returns 0 if ciphertextLength is not valid (too long or too short).

virtual size_t PK_CryptoSystem::CiphertextLength | ( | size_t | plaintextLength | ) | const`[pure virtual, inherited]`

calculate length of ciphertext given length of plaintext

Note:
  This function returns 0 if plaintextLength is not valid (too long).

virtual bool PK_CryptoSystem::ParameterSupported | ( | const char * | name | ) | const`[pure virtual, inherited]`

this object supports the use of the parameter with the given name

some possible parameter names: EncodingParameters, KeyDerivationParameters

virtual size_t PK_CryptoSystem::FixedCiphertextLength | ( |  | ) | const`[inline, virtual, inherited]`

return fixed ciphertext length, if one exists, otherwise return 0

Note:
  "Fixed" here means length of ciphertext does not depend on length of plaintext. It usually does depend on the key length.

Definition at line 1225 of file cryptlib.h.

Referenced by PK_Decryptor::FixedLengthDecrypt().

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

- cryptlib.h
- cryptlib.cpp