|
|
@@ -48,16 +48,26 @@ def test_serial_cryptocontext_str(mode):
|
|
|
|
|
|
cryptoContext = fhe.GenCryptoContext(parameters)
|
|
|
cryptoContext.Enable(fhe.PKESchemeFeature.PKE)
|
|
|
+ cryptoContext.Enable(fhe.PKESchemeFeature.PRE)
|
|
|
|
|
|
keypair = cryptoContext.KeyGen()
|
|
|
vectorOfInts = list(range(12))
|
|
|
plaintext = cryptoContext.MakePackedPlaintext(vectorOfInts)
|
|
|
ciphertext = cryptoContext.Encrypt(keypair.publicKey, plaintext)
|
|
|
+ evalKey = cryptoContext.ReKeyGen(keypair.secretKey, keypair.publicKey)
|
|
|
+
|
|
|
|
|
|
cryptoContext_ser = fhe.Serialize(cryptoContext, mode)
|
|
|
LOGGER.debug("The cryptocontext has been serialized.")
|
|
|
+ publickey_ser = fhe.Serialize(keypair.publicKey, mode)
|
|
|
+ LOGGER.debug("The public key has been serialized.")
|
|
|
+ secretkey_ser = fhe.Serialize(keypair.secretKey, mode)
|
|
|
+ LOGGER.debug("The private key has been serialized.")
|
|
|
ciphertext_ser = fhe.Serialize(ciphertext, mode)
|
|
|
LOGGER.debug("The ciphertext has been serialized.")
|
|
|
+ evalKey_ser = fhe.Serialize(evalKey, mode)
|
|
|
+ LOGGER.debug("The evaluation key has been serialized.")
|
|
|
+
|
|
|
|
|
|
cryptoContext.ClearEvalMultKeys()
|
|
|
cryptoContext.ClearEvalAutomorphismKeys()
|
|
|
@@ -67,6 +77,18 @@ def test_serial_cryptocontext_str(mode):
|
|
|
assert isinstance(cc, fhe.CryptoContext)
|
|
|
LOGGER.debug("The cryptocontext has been deserialized.")
|
|
|
|
|
|
+ pk = fhe.DeserializePublicKeyString(publickey_ser, mode)
|
|
|
+ assert isinstance(pk, fhe.PublicKey)
|
|
|
+ LOGGER.debug("The public key has been deserialized.")
|
|
|
+
|
|
|
+ sk = fhe.DeserializePrivateKeyString(secretkey_ser, mode)
|
|
|
+ assert isinstance(sk, fhe.PrivateKey)
|
|
|
+ LOGGER.debug("The private key has been deserialized.")
|
|
|
+
|
|
|
ct = fhe.DeserializeCiphertextString(ciphertext_ser, mode)
|
|
|
assert isinstance(ct, fhe.Ciphertext)
|
|
|
LOGGER.debug("The ciphertext has been reserialized.")
|
|
|
+
|
|
|
+ ek = fhe.DeserializeEvalKeyString(evalKey_ser, mode)
|
|
|
+ assert isinstance(ek, fhe.EvalKey)
|
|
|
+ LOGGER.debug("The evaluation key has been deserialized.")
|