bin_key_gen_pair: Keys of the LWE scheme of a BinFHE context

View source: R/binfhe-keys.R

bin_key_gen_pairR Documentation

Keys of the LWE scheme of a BinFHE context

Description

bin_key_gen_pair() generates a public key and its secret key. bin_pub_key_gen() generates a public key for an existing secret key. bin_key_gen_n() generates a secret key of the large dimension N, and bin_key_switch_gen() the key that switches ciphertexts under it (modulus Q, dimension N) to ciphertexts under sk (modulus q, dimension n).

Usage

bin_key_gen_pair(ctx)

bin_pub_key_gen(ctx, sk)

bin_key_gen_n(ctx)

bin_key_switch_gen(ctx, sk, sk_n)

Arguments

ctx

A BinFHEContext.

sk

An LWEPrivateKey of dimension n, from bin_key_gen().

sk_n

An LWEPrivateKey of dimension N, from bin_key_gen_n().

Value

bin_key_gen_pair(): an LWEKeyPair. bin_pub_key_gen(): an LWEPublicKey. bin_key_gen_n(): an LWEPrivateKey. bin_key_switch_gen(): an LWESwitchingKey.

See Also

bin_key_gen(), bin_encrypt(), switch_ct_to_qn()

Examples

ctx <- bin_fhe_context(BinFHEParamSet$TOY)
kp <- bin_key_gen_pair(ctx)
## Under the public key of the pair, in dimension N; no bootstrapping
## keys are needed for this form.
ct <- bin_encrypt(ctx, kp@public, 1L, BinFHEOutput$LARGE_DIM)
bin_decrypt(ctx, kp@secret, ct)

openfhe.R documentation built on Nov. 13, 2026, 5:07 p.m.