-
-
Save pathaine/392c0542738601f0f36a173efa7c537a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string storagePathStr = "."; | |
Serialized pubK, privK, emKeys, esKeys; | |
if (kp.publicKey->Serialize(&pubK)) { | |
if (!SerializableHelper::WriteSerializationToFile(pubK, storagePathStr + "encryption_info_pubK.txt")) { | |
cerr << "Error writing serialization of public key to " + storagePathStr + " /encryption_info_pubK.txt" << endl; | |
return 0; | |
} | |
} | |
else { | |
cerr << "Error serializing public key" << endl; | |
return 0; | |
} | |
if (kp.secretKey->Serialize(&privK)) { | |
if (!SerializableHelper::WriteSerializationToFile(privK, storagePathStr + "/encryption_info_priK.txt")) { | |
cerr << "Error writing serialization of public key to " + storagePathStr + "/encryption_info_priK.txt" << endl; | |
return 0; | |
} | |
} | |
else { | |
cerr << "Error serializing private key" << endl; | |
return 0; | |
} | |
if (cc->SerializeEvalMultKey(&emKeys)) { | |
if (!SerializableHelper::WriteSerializationToFile(emKeys, storagePathStr + "/key-eval-mult.txt")) { | |
cerr << "Error writing serialization of the eval mult keys to " + storagePathStr + "/key-eval-mult.txt" << endl; | |
return 0; | |
} | |
} | |
else { | |
cerr << "Error serializing eval mult keys" << endl; | |
return 0; | |
} | |
if (cc->SerializeEvalSumKey(&esKeys)) { | |
if (!SerializableHelper::WriteSerializationToFile(esKeys, storagePathStr + "/key-eval-sum.txt")) { | |
cerr << "Error writing serialization of the eval sum keys to " + storagePathStr + "/key-eval-sum.txt" << endl; | |
return 0; | |
} | |
} | |
else { | |
cerr << "Error serializing eval sum keys" << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment