Generate BinFHE bootstrapping keys
Arguments
- ctx
A BinFHE context
- sk
An LWEPrivateKey
- keygen_mode
Integer from KeygenMode; controls whether the bootstrapping keys are generated under symmetric-key encryption (
KeygenMode$SYM_ENCRYPT, the default and the C++ default perbinfhe-constants.hline 133) or public-key encryption (KeygenMode$PUB_ENCRYPT), matching theBTKeyGen(sk, keygenMode, internal32)method inbinfhecontext.h.- internal32
Logical. If
TRUE(the default, and the C++ default), keys whose moduli fit are generated directly in the library's 32-bit internal form; a key that does not qualify is generated in the 64-bit form. IfFALSE, all keys are generated in the 64-bit form.
Value
Invisibly, the ctx BinFHE context that was passed in. Called for
its side effect: the bootstrapping and key-switching keys are
generated and stored inside the C++ context, after which
eval_bin_gate() and the other gate evaluations can be used.
Memory
The bootstrapping keys can occupy several gigabytes (about 5.8 GB
for STD128 with arb_func = TRUE and log_q = 12). R's garbage
collector does not see this memory, so removing a context with
rm() does not release it until a collection happens to run.
Build one context and reuse it. The keys depend only on the parameters and the secret key.
When a context is no longer needed, call
bin_clear_bt_keys(). The keys are released at once.To release the rest of the context, remove it and call
gc().
