Patch for GetCryptoContext()
When attempting to load the cached CryptoContext from a deserialized object such as a PublicKey using the GetCryptoContext()
method, Palisade returns the error Unsupported Encryption Scheme: Not
. This error only occurs if a matching CryptoContext has not already been manually created, eg by calling genCryptoContextBGVrns()
with the same parameters as cached by the deserialized object.
This error occurs because this line in cryptocontext.h
is missing the 3rd argument context->getSchemeId()
, so Palisade resorts to the incorrect default parameter = "Not"
.
The following patch to cryptocontext.h
fixes the issue.
diff --git a/src/pke/include/cryptocontext.h b/src/pke/include/cryptocontext.h
index 6beb2ccbe..3ad3af14e 100644
--- a/src/pke/include/cryptocontext.h
+++ b/src/pke/include/cryptocontext.h
@@ -2647,7 +2647,8 @@ class CryptoObject {
ar(::cereal::make_nvp("kt", keyTag));
context = CryptoContextFactory<Element>::GetContext(
- context->GetCryptoParameters(), context->GetEncryptionAlgorithm());
+ context->GetCryptoParameters(), context->GetEncryptionAlgorithm(),
+ context->getSchemeId());
}
std::string SerializedObjectName() const { return "CryptoObject"; }
Edited by Robert