verificatum / verificatum-vmn

The first implementation of a fully distributed provably secure and universally verifiable mix-net based on the El Gamal cryptosystem.
https://www.verificatum.org
Other
11 stars 4 forks source link

Trouble converting public key from JSON to Anything #15

Closed camilog closed 3 months ago

camilog commented 2 years ago

First, I convert a raw public key file to JSON: $ vmnc -pkey -outi json publicKey publicKey_JSON

The generated file was correct: {"g":"...","p":"...","q":"...","y":"..."}

But then, if I tried to do it backwards, it failed: $ vmnc -pkey -ini json publicKey_JSON publicKey

The error is:

com.verificatum.protocol.ProtocolFormatException: Bad integer values!
        at com.verificatum.protocol.elgamal.ProtocolElGamalInterfaceJSONDecode.readPublicKey(ProtocolElGamalInterfaceJSONDecode.java:189)
        at com.verificatum.protocol.elgamal.ProtocolElGamalInterfaceTool.main(ProtocolElGamalInterfaceTool.java:418)
Caused by: com.verificatum.arithm.ArithmFormatException: A co-group of order with bit length more than 10 is incompatible with encoding arbitrary messages in the subgroup!
        at com.verificatum.arithm.ModPGroup.sanityCheck(ModPGroup.java:635)
        at com.verificatum.arithm.ModPGroup.<init>(ModPGroup.java:689)
        at com.verificatum.protocol.elgamal.ProtocolElGamalInterfaceJSONDecode.readPublicKey(ProtocolElGamalInterfaceJSONDecode.java:176)

Thanks in regard!

verificatum commented 2 years ago

I added the JSON variation to enable Helios to interface smoothly, so it only handles the simplest case since that is what they had implemented at the time. No integration happened, so you may view the json flag as deprecated if you like.

Note that there is a tool "vbt" that dumps byte tree as JSON if you wish to inspect something. Otherwise I think a simple binary format is better than adding a dependency to a parser.

That said, things have evolved since 2011 when I made some decisions if there is anything you find frustrating that seems simple to fix, then I welcome pull requests.