Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using AND compositions for Sigma protocols #72

Open
Ruth1993 opened this issue Oct 23, 2019 · 0 comments
Open

Error using AND compositions for Sigma protocols #72

Ruth1993 opened this issue Oct 23, 2019 · 0 comments

Comments

@Ruth1993
Copy link
Contributor

Ruth1993 commented Oct 23, 2019

Hello,

Could anyone help me with the following problem? I want to use AND compositions for Sigma protocols, but I'm getting the following error:

src/primitives/Dlog.cpp:414: virtual void ECElementSendableData::initFromString(const string&): Assertion str_vec.size() == 2' failed.`

This is my (simplified) code:

Prover class:

auto dlog = make_shared<OpenSSLDlogECF2m>("K-233");
auto g = dlog->getGenerator();
vector<shared_ptr<SigmaProverComputation>> provers;

provers.push_back(make_shared<SigmaDlogProverComputation>(dlog, 40));

ZKFromSigmaProver prover(channel, make_shared<SigmaANDProverComputation>(provers, 40));
biginteger q = dlog->getOrder();
biginteger r = 5;
auto co1 = dlog->exponentiate(g.get(), r);

vector<shared_ptr<SigmaProverInput>> inputs;

inputs.push_back(make_shared<SigmaDlogProverInput>(co1, r));

shared_ptr<SigmaMultipleProverInput> input = make_shared<SigmaMultipleProverInput>(inputs);
prover.prove(input);

Verifier class:

auto dlog = make_shared<OpenSSLDlogECF2m>("K-233");
auto g = dlog->getGenerator();

vector<shared_ptr<SigmaVerifierComputation>> verifiers;

biginteger r = 5;
auto co1 = dlog->exponentiate(g.get(), r);

verifiers.push_back(make_shared<SigmaDlogVerifierComputation>(dlog, 40, get_seeded_prg()));

ZKFromSigmaVerifier verifier(channel, make_shared<SigmaANDVerifierComputation>(verifiers, 40), get_seeded_prg());

vector<shared_ptr<SigmaProtocolMsg>> msgAs;
vector<shared_ptr<SigmaProtocolMsg>> msgZs;

msgAs.push_back(make_shared<SigmaGroupElementMsg(dlog->getIdentity()->generateSendableData()));
msgZs.push_back(make_shared<SigmaBIMsg>());

auto msgA = make_shared<SigmaMultipleMsg>(msgAs);
auto msgZ = make_shared<SigmaMultipleMsg>(msgZs);

vector<shared_ptr<SigmaCommonInput>> inputs;

inputs.push_back(make_shared<SigmaDlogCommonInput>(co1));

shared_ptr<SigmaMultipleCommonInput> input = make_shared<SigmaMultipleCommonInput>(inputs);
			
cout << "verified: " << verifier.verify(input.get(), msgA, msgZ) << endl;

It goes wrong at line 109 of ZeroKnowledge.cpp. For some reason it is not able to interpret the incoming message as an element of the dlog group. However, when I use a dlog object based on primes instead of elliptic curves, it works fine. Also when I remove the AND compositions and execute the following code, it works perfectly, so I don't know if the problem really lies in the use of elliptic curves (because the error points me in that direction) or the AND compositions.

Prover class (with AND compositions removed, so "standard" dlog sigma protocol):

auto dlog = make_shared<OpenSSLDlogECF2m>("K-233");
auto g = dlog->getGenerator();
ZKFromSigmaProver prover(channel, make_shared<SigmaDlogProverComputation>(dlog, 40));
biginteger q = dlog->getOrder();
biginteger r = 5;
auto co = dlog->exponentiate(g.get(), r);
shared_ptr<SigmaDlogProverInput> input = make_shared<SigmaDlogProverInput>(co, r);

prover.prove(input);

Verifier class:

auto dlog = make_shared<OpenSSLDlogECF2m>("K-233");
auto g = dlog->getGenerator();
ZKFromSigmaVerifier verifier(channel, make_shared<SigmaDlogVerifierComputation>(dlog, 40, get_seeded_prg()), get_seeded_prg());
auto msgA = make_shared<SigmaGroupElementMsg>(dlog->getIdentity()->generateSendableData());
auto msgZ = make_shared<SigmaBIMsg>();
auto co = dlog->exponentiate(g.get(), 5);
shared_ptr<SigmaDlogCommonInput> input = make_shared<SigmaDlogCommonInput>(co);

cout << verifier.verify(input.get(), msgA, msgZ) << endl;

If anyone could help me out, that would be great. :) Thanks in advance!

Kind regards, Ruth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant