Closed petermunnings closed 7 years ago
The problem seems to be with the way I was reading the file back in. Using a stringstream works fine:
stringstream verifierKey;
verifierKey << keypair.vk;
ofstream fileOut;
fileOut.open("verifierKey");
fileOut << verifierKey.rdbuf();
fileOut.close();
cout << "verifierKey before" << endl;
cout << keypair.vk << endl;
ifstream fileIn("verifierKey");
stringstream verifierKeyFromFile;
if (fileIn) {
verifierKeyFromFile << fileIn.rdbuf();
fileIn.close();
}
verifierKeyFromFile >> keypair.vk;
cout << "verifierKey after" << endl;
cout << keypair.vk << endl;
Hi,
The << and >> operators are defined in libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp (line 212) as follows:
I can write a verifier key to a file as follows:
reading it back however doesn't appear to work:
I suspect I am missing something - please could you point me in the correct direction
thanks