gen_crypto_context: Generate a CryptoContext from a parameter object

View source: R/context.R

gen_crypto_contextR Documentation

Generate a CryptoContext from a parameter object

Description

The counterpart of OpenFHE's GenCryptoContext(parameters). It returns the context with no feature enabled; call enable_feature() for each feature the computation needs, as the OpenFHE examples do. fhe_context() does both steps in one call and enables the three features most computations use.

Usage

gen_crypto_context(params)

Arguments

params

A BFVParams, BGVParams, or CKKSParams object.

Value

A CryptoContext with no feature enabled.

See Also

fhe_context(), enable_feature(), ccparams_setters

Examples

p <- BFVParams()
set_plaintext_modulus(p, 65537)
set_multiplicative_depth(p, 2L)
cc <- gen_crypto_context(p)
enable_feature(cc, Feature$PKE)
enable_feature(cc, Feature$KEYSWITCH)
enable_feature(cc, Feature$LEVELEDSHE)
ring_dimension(cc)

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