Objet : Discussion list for Belenios
Archives de la liste
- From: Pierrick Gaudry <pierrick.gaudry AT loria.fr>
- To: Stéphane Glondu <stephane.glondu AT inria.fr>
- Cc: Tomáš Hnyk <tomashnyk AT gmail.com>, belenios-discuss AT inria.fr
- Subject: Re: [belenios-discuss] Computing a fingerprint of a trustee's public key
- Date: Wed, 6 Jan 2021 20:46:16 +0100
On Wed, Jan 06, 2021 at 05:27:24PM +0100, Stéphane Glondu wrote:
> There is no easy way to compute the public key from the private key. One
> has to do arithmetic using some third-party tool.
Here is a small python3 script that allows to recompute the public key
from the private key.
Under linux (and probably also MacOs), you can save the file check-key.py
somewhere, that make it executable with:
chmod 755 check-key.py
and then run it with:
./check-key.py
Regards,
Pierrick
#!/usr/bin/env python3 ## Belenios default group parameters: p = 20694785691422546401013643657505008064922989295751104097100884787057374219242717401922237254497684338129066633138078958404960054389636289796393038773905722803605973749427671376777618898589872735865049081167099310535867780980030790491654063777173764198678527273474476341835600035698305193144284561701911000786737307333564123971732897913240474578834468260652327974647951137672658693582180046317922073668860052627186363386088796882120769432366149491002923444346373222145884100586421050242120365433561201320481118852408731077014151666200162313177169372189248078507711827842317498073276598828825169183103125680162072880719 g = 2402352677501852209227687703532399932712287657378364916510075318787663274146353219320285676155269678799694668298749389095083896573425601900601068477164491735474137283104610458681314511781646755400527402889846139864532661215055797097162016168270312886432456663834863635782106154918419982534315189740658186868651151358576410138882215396016043228843603930989333662772848406593138406010231675095763777982665103606822406635076697764025346253773085133173495194248967754052573659049492477631475991575198775177711481490920456600205478127054728238140972518639858334115700568353695553423781475582491896050296680037745308460627 q = 78571733251071885079927659812671450121821421258408794611510081919805623223441 assert pow(g, q, p) == 1 ## Read private key from user inp = input("Enter your private key, without the double-quotes: ") s = int(inp) assert s < q ## The corresponding public key is g^s mod p ## This is the value that should be present in the field "public_key" in ## the "trustees.json" file. pk = pow(g, s, p) print("Your public key is: " + str(pk))
- [belenios-discuss] Computing a fingerprint of a trustee's public key, Tomáš Hnyk, 05/01/2021
- Re: [belenios-discuss] Computing a fingerprint of a trustee's public key, Stéphane Glondu, 06/01/2021
- Re: [belenios-discuss] Computing a fingerprint of a trustee's public key, Pierrick Gaudry, 06/01/2021
- Re: [belenios-discuss] Computing a fingerprint of a trustee's public key, Stéphane Glondu, 06/01/2021
Archives gérées par MHonArc 2.6.19+.