Minimalistic pythonic implementation of a Verifiable (t, n) threshold signature scheme based on elliptic curve .
This implementation serves as a proof of concept. DO NOT TRY TO USE THIS FOR ANY REAL USE CASE. THIS HAS NOT BEEN TESTED EXTERNALLY.
This is a pythonic implementation using a python ECDSA cryptographic python library. Python 3.5 is required to run this. Other versions of python haven't been tested but it might work. ECDSA library is compatible with most version of python. Be sure to have python included in yout path.
The only thing required to run this is argparse for the script that can generate, encrypt and decrypt.
$ pip install argparse
$ ./threshold.py --tshares [numShares] --nShares [numShares] --folder ./data
Generates the parameters for having a (t, n) threshold cryptosystem where t out of n can reconstruct the original private key.
This script generates a folder and saves the following:
- Public parameters file to verify a secret share is valid.
- Public ECC key file for anybody to encrypt a message.
- Secrets file with all the n shares that can reconstruct file.
- Individual files where each on contains one secret for distribution.
./threshold.py --file ./data/secret.txt --t 10
Should give private key:
Reconstructed private key: 114512418293542646387878769035889844004884287243204154488848244878157937612245
Secretes.txt must be a file with all the t subshares on each line.
This is standard ECC encryption. Encrypts a message using a given public key.
./threshold.py --pkfile ./data/public.csv --msg "Secret" --outfile ./c.txt
./threshold.py --decrypt 114512418293542646387878769035889844004884287243204154488848244878157937612245 --infile ./c.txt
python setup.py test
- ECDSA ECDSA cryptography python library.
MIT License