AesKey#
- class AesKey#
A class to hold the AES secret key encrypted under FHE, required for decryption of AES ciphertexts under FHE.
- he_encrypt(self: pyhelayers.AesKey, plain_key: bytes, compress: bool = True) None #
Encrypt the given plaintext AES key under FHE.
- Parameters:
plain_key – The plaintext AES key, of size 128, 192 or 256 bits (16, 24 or 32 bytes, respectively).
compress – Whether to store the key in a compressed fashion (recommended). This will result in much smaller object when saving to binary, but will require more time to uncompress when loading the key.
-
class AesKey : public helayers::Saveable#
Public Functions
-
AesKey(const HeContext &he, Verbosity verbosity = VERBOSITY_NONE)#
Construct a new AES key object.
- Parameters:
he – The HE context.
verbosity – The verbosity level.
-
void heEncrypt(const std::vector<unsigned char> &plainKey, bool compress = true)#
Encrypt the given plaintext AES key under FHE.
- Parameters:
plainKey – The plaintext AES key, of size 128, 192 or 256 bits (16, 24 or 32 bytes, respectively).
compress – Whether to store the key in a compressed fashion (recommended). This will result in much smaller object when saving to binary, but will require more time to uncompress when loading the key.
-
void setChainIndex(int chainIndex)#
Update the chain index of this AES key.
The normal usage requires not using this method and leaving the chain index of the key in the chain index it was encrypted in.
- Parameters:
chainIndex – The desired chain index.
-
int getChainIndex() const#
Returns the chain index of this AES key.
-
void uncompress()#
Uncompress the key if it was encrypted compressed (see AesKey::heEncrypt).
-
int getChainIndexAtAddRoundKey() const#
See AesConverter::getChainIndexAtAddRoundKey.
-
virtual void debugPrint(const std::string &title = "", Verbosity verbosity = VERBOSITY_REGULAR, std::ostream &out = std::cout) const override#
Prints the content of this object.
- Parameters:
title – Text to add to the print
verbosity – Verbosity level
out – Output stream
-
AesKey(const HeContext &he, Verbosity verbosity = VERBOSITY_NONE)#