Template Class PKEBase

Template Parameter Order

  1. class Element

Class Documentation

template<class Element>
class lbcrypto::PKEBase

Abstract interface for encryption algorithm.

Template Parameters

Element – a ring element.

Public Functions

inline virtual ~PKEBase()
virtual KeyPair<Element> KeyGenInternal(CryptoContext<Element> cc, bool makeSparse)

Function to generate public and private keys

Parameters
  • &publicKey – private key used for decryption.

  • &privateKey – private key used for decryption.

Returns

function ran correctly.

virtual Ciphertext<Element> Encrypt(Element plaintext, const PrivateKey<Element> privateKey) const

Method for encrypting plaintex using LBC

Parameters
  • privateKey – private key used for encryption.

  • plaintext – copy of the plaintext input. NOTE a copy is passed! That is NOT an error!

  • doEncryption – encrypts if true, embeds (encodes) the plaintext into cryptocontext if false

  • *ciphertext – ciphertext which results from encryption.

virtual Ciphertext<Element> Encrypt(Element plaintext, const PublicKey<Element> publicKey) const

Method for encrypting plaintext using LBC

Parameters
  • &publicKey – public key used for encryption.

  • plaintext – copy of the plaintext element. NOTE a copy is passed! That is NOT an error!

  • doEncryption – encrypts if true, embeds (encodes) the plaintext into cryptocontext if false

  • *ciphertext – ciphertext which results from encryption.

inline virtual DecryptResult Decrypt(ConstCiphertext<Element> ciphertext, const PrivateKey<Element> privateKey, NativePoly *plaintext) const

Method for decrypting plaintext using LBC

Parameters
  • &privateKey – private key used for decryption.

  • &ciphertext – ciphertext id decrypted.

  • *plaintext – the plaintext output.

Returns

the decoding result.

inline virtual DecryptResult Decrypt(ConstCiphertext<Element> ciphertext, const PrivateKey<Element> privateKey, Poly *plaintext) const

Method for decrypting plaintext using LBC

Parameters
  • &privateKey – private key used for decryption.

  • &ciphertext – ciphertext id decrypted.

  • *plaintext – the plaintext output.

Returns

the decoding result.

virtual std::shared_ptr<std::vector<Element>> EncryptZeroCore(const PrivateKey<Element> privateKey, const std::shared_ptr<ParmType> params) const
virtual std::shared_ptr<std::vector<Element>> EncryptZeroCore(const PublicKey<Element> publicKey, const std::shared_ptr<ParmType> params) const
virtual Element DecryptCore(const std::vector<Element> &cv, const PrivateKey<Element> privateKey) const