This repository contains two Python scripts for some basic cryptographic operations using the ECDSA (Elliptic Curve Digital Signature Algorithm) library. I intend to add more into this repo ( I have a lot of stuff to dump in here), but for now, these are part of a demo into "A login system without passwords or usernames, using ECDSA".
- generate_fresh_keys.py: Generates a new ECDSA key pair (private and public keys) using the SECP256k1 curve, commonly used in Bitcoin.
- sign_challenge.py: Signs a given string (challenge) with a provided ECDSA private key and outputs the signature. (if you're here from the ECDSA login demo, then this is the 'challenge issued by the server when you login)
- Python 3.6 or newer
- ECDSA library (installed via pip)
- Clone this repository to your local machine.
- Ensure you have Python 3.6 or newer installed.
- Install the required Python package:
pip install -r requirements.txtTo generate a new ECDSA key pair, run:
python new-gen-keys.pyThis will output a private key and a public key(compressed) in hexadecimal format.
To sign a string, you need the string you wish to sign (the challenge) and the private key in hexadecimal format. Run:
python sign_string.py <challenge> <private_key_hex>Replace <challenge> with the string you wish to sign and <private_key_hex> with your private key in hexadecimal format.
This project is licensed under the MIT License - see the LICENSE file for details.