BinFHEContext.
More...
#include <binfhecontext.h>
|
void | GenerateBinFHEContext (uint32_t n, uint32_t N, const NativeInteger &q, const NativeInteger &Q, const NativeInteger &qKS, double std, uint32_t baseKS, uint32_t baseG, uint32_t baseR, BINFHEMETHOD method=GINX) |
|
void | GenerateBinFHEContext (BINFHEPARAMSET set, BINFHEMETHOD method=GINX) |
|
const std::shared_ptr< RingGSWBTKey > | GetRefreshKey () const |
|
const std::shared_ptr< LWESwitchingKey > | GetSwitchKey () const |
|
LWEPrivateKey | KeyGen () const |
|
LWEPrivateKey | KeyGenN () const |
|
LWECiphertext | Encrypt (ConstLWEPrivateKey sk, const LWEPlaintext &m, BINFHEOUTPUT output=BOOTSTRAPPED) const |
|
void | Decrypt (ConstLWEPrivateKey sk, ConstLWECiphertext ct, LWEPlaintext *result) const |
|
std::shared_ptr< LWESwitchingKey > | KeySwitchGen (ConstLWEPrivateKey sk, ConstLWEPrivateKey skN) const |
|
void | BTKeyGen (ConstLWEPrivateKey sk) |
|
void | BTKeyLoad (const RingGSWEvalKey &key) |
|
void | ClearBTKeys () |
|
LWECiphertext | EvalBinGate (const BINGATE gate, ConstLWECiphertext ct1, ConstLWECiphertext ct2) const |
|
LWECiphertext | Bootstrap (ConstLWECiphertext ct1) const |
|
LWECiphertext | EvalNOT (ConstLWECiphertext ct1) const |
|
LWECiphertext | EvalConstant (bool value) const |
|
const std::shared_ptr< RingGSWCryptoParams > | GetParams () |
|
const std::shared_ptr< LWEEncryptionScheme > | GetLWEScheme () |
|
const std::shared_ptr< RingGSWAccumulatorScheme > | GetRingGSWScheme () |
|
template<class Archive > |
void | save (Archive &ar, std::uint32_t const version) const |
|
template<class Archive > |
void | load (Archive &ar, std::uint32_t const version) |
|
std::string | SerializedObjectName () const |
|
|
static uint32_t | SerializedVersion () |
|
BinFHEContext.
The wrapper class for Boolean circuit FHE
◆ Bootstrap()
LWECiphertext lbcrypto::BinFHEContext::Bootstrap |
( |
ConstLWECiphertext |
ct1 | ) |
const |
Bootstraps a ciphertext (without peforming any operation)
- Parameters
-
ct1 | ciphertext to be bootstrapped |
- Returns
- a shared pointer to the resulting ciphertext
◆ BTKeyGen()
void lbcrypto::BinFHEContext::BTKeyGen |
( |
ConstLWEPrivateKey |
sk | ) |
|
Generates boostrapping keys
- Parameters
-
◆ BTKeyLoad()
Loads bootstrapping keys in the context (typically after deserializing)
- Parameters
-
key | struct with the bootstrapping keys |
◆ ClearBTKeys()
void lbcrypto::BinFHEContext::ClearBTKeys |
( |
| ) |
|
|
inline |
Clear the bootstrapping keys in the current context
◆ Decrypt()
void lbcrypto::BinFHEContext::Decrypt |
( |
ConstLWEPrivateKey |
sk, |
|
|
ConstLWECiphertext |
ct, |
|
|
LWEPlaintext * |
result |
|
) |
| const |
Decrypts a ciphertext using a secret key
- Parameters
-
sk | the secret key |
ct | the ciphertext |
*result | plaintext result |
◆ Encrypt()
LWECiphertext lbcrypto::BinFHEContext::Encrypt |
( |
ConstLWEPrivateKey |
sk, |
|
|
const LWEPlaintext & |
m, |
|
|
BINFHEOUTPUT |
output = BOOTSTRAPPED |
|
) |
| const |
Encrypts a bit using a secret key (symmetric key encryption)
- Parameters
-
sk | - the secret key |
&m | - the plaintext |
output | - FRESH to generate fresh ciphertext, BOOTSTRAPPED to generate a refreshed ciphertext (default) |
- Returns
- a shared pointer to the ciphertext
◆ EvalBinGate()
LWECiphertext lbcrypto::BinFHEContext::EvalBinGate |
( |
const BINGATE |
gate, |
|
|
ConstLWECiphertext |
ct1, |
|
|
ConstLWECiphertext |
ct2 |
|
) |
| const |
Evaluates a binary gate (calls bootstrapping as a subroutine)
- Parameters
-
gate | the gate; can be AND, OR, NAND, NOR, XOR, or XNOR |
ct1 | first ciphertext |
ct2 | second ciphertext |
- Returns
- a shared pointer to the resulting ciphertext
◆ EvalConstant()
LWECiphertext lbcrypto::BinFHEContext::EvalConstant |
( |
bool |
value | ) |
const |
Evaluates constant gate
- Parameters
-
value | the Boolean value to output |
- Returns
- a shared pointer to the resulting ciphertext
◆ EvalNOT()
LWECiphertext lbcrypto::BinFHEContext::EvalNOT |
( |
ConstLWECiphertext |
ct1 | ) |
const |
Evaluates NOT gate
- Parameters
-
- Returns
- a shared pointer to the resulting ciphertext
◆ GenerateBinFHEContext() [1/2]
void lbcrypto::BinFHEContext::GenerateBinFHEContext |
( |
uint32_t |
n, |
|
|
uint32_t |
N, |
|
|
const NativeInteger & |
q, |
|
|
const NativeInteger & |
Q, |
|
|
const NativeInteger & |
qKS, |
|
|
double |
std, |
|
|
uint32_t |
baseKS, |
|
|
uint32_t |
baseG, |
|
|
uint32_t |
baseR, |
|
|
BINFHEMETHOD |
method = GINX |
|
) |
| |
Creates a crypto context using custom parameters. Should be used with care (only for advanced users familiar with LWE parameter selection).
- Parameters
-
n | lattice parameter for additive LWE scheme |
N | ring dimension for RingGSW/RLWE used in bootstrapping |
&q | modulus for additive LWE |
&Q | modulus for RingGSW/RLWE used in bootstrapping |
&qKS | modulus for key switching |
std | standard deviation |
baseKS | the base used for key switching |
baseG | the gadget base used in bootstrapping |
baseR | the base used for refreshing |
method | the bootstrapping method (AP or GINX) |
- Returns
- creates the cryptocontext
◆ GenerateBinFHEContext() [2/2]
void lbcrypto::BinFHEContext::GenerateBinFHEContext |
( |
BINFHEPARAMSET |
set, |
|
|
BINFHEMETHOD |
method = GINX |
|
) |
| |
Creates a crypto context using predefined parameters sets. Recommended for most users.
- Parameters
-
set | the parameter set: TOY, MEDIUM, STD128, STD192, STD256 |
method | the bootstrapping method (AP or GINX) |
- Returns
- create the cryptocontext
◆ GetRefreshKey()
const std::shared_ptr<RingGSWBTKey> lbcrypto::BinFHEContext::GetRefreshKey |
( |
| ) |
const |
|
inline |
Gets the refreshing key (used for serialization).
- Returns
- a shared pointer to the refreshing key
◆ GetSwitchKey()
const std::shared_ptr<LWESwitchingKey> lbcrypto::BinFHEContext::GetSwitchKey |
( |
| ) |
const |
|
inline |
Gets the switching key (used for serialization).
- Returns
- a shared pointer to the switching key
◆ KeyGen()
LWEPrivateKey lbcrypto::BinFHEContext::KeyGen |
( |
| ) |
const |
Generates a secret key for the main LWE scheme
- Returns
- a shared pointer to the secret key
◆ KeyGenN()
LWEPrivateKey lbcrypto::BinFHEContext::KeyGenN |
( |
| ) |
const |
Generates a secret key used in bootstrapping
- Returns
- a shared pointer to the secret key
◆ KeySwitchGen()
std::shared_ptr< LWESwitchingKey > lbcrypto::BinFHEContext::KeySwitchGen |
( |
ConstLWEPrivateKey |
sk, |
|
|
ConstLWEPrivateKey |
skN |
|
) |
| const |
Generates a switching key to go from a secret key with (Q,N) to a secret key with (q,n)
- Parameters
-
sk | new secret key |
skN | old secret key |
- Returns
- a shared pointer to the switching key
The documentation for this class was generated from the following files: