Skip to contents

Context and Keys

fhe_context()
Create a fully homomorphic encryption context
key_gen()
Generate key pair
enable_feature()
Enable a feature on a CryptoContext
CryptoContext()
Crypto Context
BFVParams()
BFV Parameters
BGVParams()
BGV Parameters
CKKSParams()
CKKS Parameters
KeyPair()
Key Pair
PublicKey()
Public Key
PrivateKey()
Private Key

Encryption and Decryption

encrypt()
Encrypt a plaintext
decrypt()
Decrypt a ciphertext
make_packed_plaintext()
Make a packed integer plaintext
make_coef_packed_plaintext()
Make a coefficient-packed integer plaintext
make_ckks_packed_plaintext()
Make a CKKS packed plaintext from real numbers
get_packed_value()
Get packed integer values from a plaintext
get_real_packed_value()
Get real values from a CKKS plaintext
Ciphertext()
Ciphertext class
Plaintext()
Plaintext

Plaintext accessors

Key tags

get_key_tag() set_key_tag()
Key tag accessors
is_good()
Is a KeyPair valid?

Ciphertext accessors

get_crypto_context()
Associated CryptoContext of a Ciphertext
get_scaling_factor_real()
Real-valued CKKS scaling factor at a modulus-chain level
ckks_scaling_factor_bits()
CKKS scaling-mod-size in bits

CryptoContext getters

get_crypto_parameters()
Crypto parameters of a CryptoContext
get_element_params()
Element parameters of a CryptoContext
get_encoding_params()
Encoding parameters of a CryptoContext
get_cyclotomic_order()
Cyclotomic order of a CryptoContext
get_key_gen_level()
Key-generation level of a CryptoContext
set_key_gen_level()
Set the key-generation level of a CryptoContext

Homomorphic Operations

eval_add()
Homomorphic addition
eval_sub()
Homomorphic subtraction
eval_mult()
Homomorphic multiplication
eval_negate()
Homomorphic negation
eval_square()
Homomorphic squaring
eval_rotate()
Rotate ciphertext slots
eval_sum()
Sum all slots in a ciphertext
rescale()
Rescale a CKKS ciphertext (alias for ModReduce)
ring_dimension()
Ring dimension of a CryptoContext
eval_add_in_place()
Homomorphic addition in place
eval_sub_in_place()
Homomorphic subtraction in place
eval_mult_in_place()
Homomorphic multiplication in place
eval_negate_in_place()
Homomorphic negation in place
eval_add_mutable()
Homomorphic add, mutable variant
eval_sub_mutable()
Homomorphic subtract, mutable variant
eval_mult_mutable()
Homomorphic multiply, mutable variant
eval_square_mutable()
Homomorphic square, mutable variant
eval_mult_no_relin()
Homomorphic multiplication without relinearization
relinearize()
Relinearize a higher-degree ciphertext
eval_mult_and_relinearize()
Fused multiply-and-relinearize
mod_reduce()
Reduce the modulus chain by one level
mod_reduce_in_place()
Reduce the modulus chain by one level, in place
level_reduce()
Reduce the modulus chain by multiple levels
level_reduce_in_place()
Reduce the modulus chain by multiple levels, in place
compress()
Compress a ciphertext to fewer towers

CKKS Advanced

eval_poly()
Evaluate a polynomial on a ciphertext
eval_poly_linear()
Evaluate a polynomial via the linear evaluator
eval_poly_ps()
Evaluate a polynomial via the Paterson-Stockmeyer method
eval_chebyshev()
Evaluate a Chebyshev series on a ciphertext
eval_chebyshev_linear()
Evaluate a Chebyshev series via the linear evaluator
eval_chebyshev_ps()
Evaluate a Chebyshev series via the Paterson-Stockmeyer method
eval_chebyshev_coefficients()
Chebyshev coefficients for a real-valued function
eval_chebyshev_function()
Evaluate a user-supplied function on a CKKS ciphertext via Chebyshev approximation
eval_sin()
Evaluate sine on a ciphertext (Chebyshev approximation)
eval_cos()
Evaluate cosine on a ciphertext
eval_logistic()
Evaluate logistic function on a ciphertext
eval_divide()
Evaluate division approximation on a ciphertext
eval_bootstrap()
Perform CKKS bootstrapping
eval_bootstrap_setup()
Set up CKKS bootstrapping
eval_bootstrap_key_gen()
Generate bootstrapping keys
get_bootstrap_depth()
Get the required multiplicative depth for CKKS bootstrapping
get_ckks_boot_correction_factor()
Get the CKKS bootstrap correction factor
set_ckks_boot_correction_factor()
Set the CKKS bootstrap correction factor
eval_fast_rotation()
Hoisted slot rotation using precomputed digits
eval_fast_rotation_ext()
Extended hoisted slot rotation
eval_fast_rotation_precompute()
Precompute digit decomposition for hoisted fast rotations
FastRotationPrecomputation()
Precomputed digit decomposition for hoisted rotations
get_complex_packed_value()
Get complex values from a CKKS plaintext
find_automorphism_index()
Compute the automorphism index for a single slot index
find_automorphism_indices()
Compute the automorphism indices for a list of slot indices
eval_automorphism_key_gen()
Generate automorphism evaluation keys for a set of indices
eval_automorphism()
Apply an automorphism to a ciphertext

Interactive bootstrap

key_switch_down()
Scale a ciphertext down from extended CRT basis to Q
int_boot_decrypt()
Server-side masked decryption for interactive bootstrap
int_boot_encrypt()
Client-side re-encryption for interactive bootstrap
int_boot_add()
Combine encrypted and unencrypted masked decryptions
int_boot_adjust_scale()
Prepare a ciphertext for interactive bootstrap
int_mp_boot_adjust_scale()
Prepare a ciphertext for multi-party interactive bootstrap
int_mp_boot_random_element_gen()
Generate a common random element for multi-party bootstrap
int_mp_boot_decrypt()
Multi-party masked decryption for interactive bootstrap
int_mp_boot_add()
Aggregate multi-party shares pairs
int_mp_boot_encrypt()
Final re-encryption for multi-party interactive bootstrap

Serialization and key registry

fhe_serialize()
Serialize an OpenFHE object to file
fhe_deserialize()
Deserialize an OpenFHE object from file
serialize_eval_keys()
Serialize evaluation keys to file
deserialize_eval_keys()
Deserialize evaluation keys from file
clear_fhe_state()
Clear cached evaluation keys and contexts
with_fhe_context()
Execute code with automatic cleanup of FHE state
eval_sum_key_gen()
Generate sum keys for a secret key
eval_mult_key_gen()
Generate relinearization (eval-mult) keys for a secret key
eval_rotate_key_gen()
Generate rotation keys for a secret key
eval_at_index_key_gen()
Generate at-index (rotation) keys for a secret key
insert_eval_mult_key()
Insert an EvalMult key vector into the cc registry
insert_eval_sum_key()
Insert a joined sum-key map into the cc registry
insert_eval_automorphism_key()
Insert a joined automorphism-key map into the cc registry
clear_eval_mult_keys()
Clear the EvalMult key cache
clear_eval_automorphism_keys()
Clear the EvalAutomorphism key cache
get_all_eval_mult_keys()
Retrieve all registered EvalMult key vectors
get_eval_mult_key_vector()
Retrieve the EvalMult key vector for a given key tag
get_all_eval_automorphism_keys()
Retrieve all registered EvalAutomorphism key maps
get_eval_automorphism_key_map()
Retrieve the automorphism-key map for a given key tag
get_all_eval_sum_keys()
Retrieve all registered EvalSum key maps
get_eval_sum_key_map()
Retrieve the sum-key map for a given key tag

Threshold FHE

multiparty_key_gen()
Generate a key pair for a secondary party in threshold FHE
multiparty_decrypt_lead()
Lead party's partial decryption
multiparty_decrypt_main()
Non-lead party's partial decryption
multiparty_decrypt_fusion()
Fuse partial decryptions into final plaintext
threshold_decrypt()
Threshold decryption convenience: lead + main + fusion in one call
multi_add_pub_keys()
Combine public keys from multiple parties
multi_add_eval_keys()
Combine evaluation keys from multiple parties
multi_add_eval_mult_keys()
Combine partial eval-mult keys from multiple parties
multi_key_switch_gen()
Multi-party key-switch eval-key generation
multi_eval_sum_key_gen()
Generate a joint sum-key share for multi-party EvalSum
multi_eval_automorphism_key_gen()
Generate a joint automorphism-key share for multi-party rotation
multi_eval_at_index_key_gen()
Generate a joint rotation-at-index key share
multi_add_eval_sum_keys()
Combine two sum-key map shares into a joint sum-key map
multi_add_eval_automorphism_keys()
Combine two automorphism-key map shares
share_keys()
Distribute a secret key into shares
recover_shared_key()
Recover a secret key from distributed shares
EvalKey()
EvalKey class for multi-party key operations
EvalKeyMap()
Map of homomorphic evaluation keys
SecretShareMap()
Map of secret-key shares for threshold-FHE abort recovery

Binary FHE

bin_fhe_context()
Create a Binary FHE context
bin_key_gen()
Generate BinFHE secret key
bin_bt_key_gen()
Generate BinFHE bootstrapping keys
bin_encrypt()
Encrypt a value for Binary FHE
bin_decrypt()
Decrypt a Binary FHE ciphertext
eval_bin_gate()
Evaluate a binary gate on encrypted values
eval_not()
Evaluate NOT on an encrypted value
eval_sign()
Evaluate sign on an encrypted value (functional bootstrapping)
eval_func()
Evaluate an arbitrary function on an encrypted value
eval_floor()
Evaluate a floor (rounding) function on an LWE ciphertext
generate_lut_via_function()
Generate a lookup table for an arbitrary plaintext function
get_max_plaintext_space()
Maximum supported plaintext space for functional bootstrapping
BinFHEContext()
BinFHE context (Binary FHE)
LWECiphertext()
LWE Ciphertext (Binary FHE)
LWEPrivateKey()
LWE Private Key (Binary FHE)

Enums

Feature
PKE Scheme Features (bitmask)
SecurityLevel
Security Levels
ScalingTechnique
Scaling Techniques (CKKS)
KeySwitchTechnique
Key Switching Techniques
SecretKeyDist
Secret Key Distribution
BinFHEParamSet
Binary FHE Parameter Sets
BinFHEMethod
Binary FHE Methods
BinGate
Binary Gate Types
BinFHEOutput
Binary FHE Output Types
KeygenMode
Key Generation Mode
PlaintextEncodings
Plaintext Encoding Types
DistributionType
Distribution Type (lattice parameters)
MultipartyMode
Multiparty Mode
ExecutionMode
Execution Mode
DecryptionNoiseMode
Decryption Noise Mode
PREMode
Proxy Re-encryption Mode
MultiplicationTechnique
Multiplication Technique (BFV)
EncryptionTechnique
Encryption Technique
CKKSDataType
CKKS Data Type
CompressionLevel
Compression Level (interactive multi-party bootstrap)
SchemeId
Scheme Identifier

Supporting types

ElementParams()
Element Parameters (opaque)
CryptoParameters()
Crypto Parameters (opaque)
EncodingParams()
Encoding Parameters (opaque)

CCParams getters

Utilities

get_native_int()
Get the native integer size of the OpenFHE build
set_num_threads()
Set the number of OpenMP threads OpenFHE may use
get_num_threads()
Report the number of OpenMP threads available to OpenFHE
set_length()
Set the effective length of a plaintext
clear_static_maps_and_vectors()
Clear OpenFHE static maps and vectors
OpenFHEObject()
Base class for OpenFHE objects
ptr_is_valid()
Check if an external pointer is valid (non-NULL)
get_ptr()
Extract pointer with validation
openfhe.R openfhe.R-package
openfhe.R: R Interface to the 'OpenFHE' Fully Homomorphic Encryption Library

CKKS numerical tolerance

fhe_ckks_tolerance()
Per-test CKKS precision tolerance