EmptyContext#
Currently, this API is unsupported in Python
-
class EmptyContext : public helayers::TrackingContext#
A class to represent empty mockup HE context.
It creates empty mockup ciphertext and plaintext objects that contain meta-data and no values at all, and keep track of the meta-data when performing various “mockup” HE operations
Public Functions
-
EmptyContext()#
-
inline virtual ~EmptyContext()#
-
virtual void init(const HeConfigRequirement &req) override#
Internal use.
-
void setSupportsChainIndices(bool supportsChainIndices)#
Set an indication to whether chain indexes track should be supported.
- Parameters:
supportsChainIndices –
-
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) const override#
Do not use. Should be made private.
-
inline virtual int slotCount() const override#
The number of slots in each CTile (ciphertext) or PTile (plaintext) created over this context.
-
inline virtual int getTopChainIndex() const override#
Returns the highest available chain index (for schemes where it is applicable).
-
inline 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).
-
inline virtual int getSecurityLevel() const override#
Returns the security level supplied by this context.
-
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 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.
-
inline virtual std::string getSchemeName() const override#
Returns the name of the underlying scheme.
-
virtual std::string getSignature() const override#
Returns a signature of the context that distinguishes it enough to be able to load previously stored contexts based on their signatures.
-
virtual bool isConfigRequirementFeasible(const HeConfigRequirement &req) const override#
Internal use.
-
void setChainIndexOffset(int chainIndexOffset)#
Set a chain index offset.
- Parameters:
chainIndexOffset – The desired chain index offset.
-
int getChainIndexOffset() const#
Returns the chain index offset used.
-
virtual bool publicFunctionsSupported(const PublicFunctions &publicFunctions) const override#
Returns whether the given PublicFunctions object is supported by this HeContext.
The given PublicFunctions object is assumed to be valid (see also PublicFunctions::validate()).
- Parameters:
publicFunctions – The PublicFunctions object.
-
virtual int getMinChainIndexForBootstrapping() const override#
Assuming this HeContext is bootstrappable, returns the minimum level in which ciphertexts can be bootstrapped.
-
virtual int getChainIndexAfterBootstrapping() const override#
Assuming this HeContext is bootstrappable, returns the level of ciphertexts after bootstrapping.
-
void setChainIndexToAbort(int chainIndex)#
Sets the chain index that marks a lower bound for the reasonable chain indexes to handle.
Chain indexes equal or lower than this limit will cause the “abort” flag of this context to be turned on.
- Parameters:
chainIndex – The desired chain index limit.
-
int getChainIndexToAbort() const#
Returns the chain index to abort.
See “setChainIndexToAbort” above for more details.
-
void enableAbort()#
Enables the abort mechanism for non-bootstrappable context with chain index limitation based on constants from RunStats.
-
void followAbortBehaviour(const HeContext &he)#
Sets the abort mechanism of this object to follow the same limits as those of the given empty HE context.
Does nothing if the given context is not of type EmptyContext or does not have its abort mechanism enabled.
- Parameters:
he – The other HE context.
-
EmptyContext()#