OpenFheContext#
Currently, this API is unsupported in Python
-
class OpenFheContext : public helayers::HeContext#
An abstract class for all OpenFHE context classes.
It contains their common functionality. Note that it currently geared towards the PKE schemes. It may be further split in the future.
Subclassed by helayers::OpenFheCkksContext
Public Functions
-
OpenFheContext()#
Construct an uninitialized object.
-
virtual ~OpenFheContext()#
-
virtual void printSignature(std::ostream &out) const override#
Prints a summary of library details and configuration params.
- Parameters:
out – [in] output stream to write to
-
virtual std::shared_ptr<AbstractCiphertext> createAbstractCipher() const override#
Do not use. Should be made private.
-
virtual std::shared_ptr<AbstractPlaintext> createAbstractPlain() const override#
Do not use. Should be made private.
-
virtual std::shared_ptr<AbstractEncoder> getEncoder() const override#
Do not use. Should be made private.
-
virtual std::shared_ptr<AbstractBootstrapEvaluator> createAbstractBootstrapEvaluator(const BootstrapConfig &bsConfig = BootstrapConfig()) const override#
Do not use. Should be made private.
-
virtual int getTopChainIndex() const override#
Returns the highest available chain index (for schemes where it is applicable).
-
virtual int slotCount() const override#
The number of slots in each CTile (ciphertext) or PTile (plaintext) created over this context.
-
virtual int getSecurityLevel() const override#
Returns the security level supplied by this context.
-
virtual bool hasSecretKey() const override#
Returns whether this context contains a secret key.
If not, decryption and other operations relying on decryption will not be available (will throw an exception).
-
virtual void saveSecretKey(std::ostream &out, bool seedOnly = false) override#
Save secret key to the given ostream.
- Parameters:
out – The binary stream to save to.
seedOnly – If true, only the seed used to control the secret key’s randomness will be saved, rather than the whole secret key.
- Throws:
runtime_error – If this HeContext doesn’t have a secret key. i.e. hasSecretKey() is false.
runtime_error – If seedOnly is true but the underlying HeContext does not support secret key I/O using seeds.
-
virtual void loadSecretKey(std::istream &in, bool seedOnly = false) override#
Load secret key from the given istream.
- Parameters:
in – The binary stream to load from.
seedOnly – If true, the seed of the secret key will be loaded from the given binary stream and the secret key will be generated using this seed.
- Throws:
runtime_error – If this HeContext already has a secret key. i.e. hasSecretKey() is true.
runtime_error – If seedOnly is true but the underlying HeContext does not support secret key I/O using seeds.
-
inline virtual std::string getLibraryName() const override#
Returns the name of the underlying library.
-
int chainIndexToOpenFheLevel(int chainIndex) const#
Clears all contexts from the PALISADE internal contexts vector.
Maps the received chain index in terms of HELayers to the corresponding level in terms of OpenFHE. Note that in HELayers chain indexes start from a positive integer and decrease on each multiplication, levels in OpenFHE start from zero and increase on multiplications. This function does the mapping
- Parameters:
chainIndex – [in] Input chain index to translate to OpenFHE’s level
-
int openFheLevelToChainIndex(uint32_t level) const#
Maps the received level in terms of OpenFHE to the corresponding chain index in terms of HeLayers.
See chainIndexToOpenFheLevel().
- Parameters:
level – [in] OpenFHE’s level to translate to chain index
-
inline const std::vector<int32_t> &getRotateIndexes() const#
Get the rotation indexes supported by this context.
-
OpenFheContext()#