Template Class KeyPair

Template Parameter Order

  1. class Element

Class Documentation

template<class Element>
class lbcrypto::KeyPair

Container holding the public key and the matching secret (private) key produced by key generation.

Template Parameters

Element – a ring element.

Public Functions

inline KeyPair(const PublicKey<Element> &a, const PrivateKey<Element> &b)

Constructs a key pair from existing shared pointers to a public key and a secret key.

Parameters
  • a – the public key

  • b – the secret key

inline explicit KeyPair(PublicKeyImpl<Element> *a = nullptr, PrivateKeyImpl<Element> *b = nullptr)

Constructs a key pair that takes ownership of raw key pointers; by default it creates an empty pair.

Parameters
  • a – raw pointer to a public key (ownership is transferred); nullptr for an empty public key

  • b – raw pointer to a secret key (ownership is transferred); nullptr for an empty secret key

inline bool good() const

Checks whether both keys of the pair are present.

Returns

true if both the public key and the secret key are non-null

inline bool is_allocated() const

Alias of good(): checks whether both keys of the pair are present.

Returns

true if both the public key and the secret key are non-null

Public Members

PublicKey<Element> publicKey

shared pointer to the public key (may be null)

PrivateKey<Element> secretKey

shared pointer to the secret key (may be null)