This project provides a C implementation for generating compressed public keys from private keys using the ECDSA (Elliptic Curve Digital Signature Algorithm) with the secp256k1 curve.
- Generate compressed public keys from private keys
- Uses OpenSSL library for cryptographic operations
- Supports secp256k1 curve
Before you begin, ensure you have met the following requirements:
- GCC compiler
- OpenSSL development libraries
On Ubuntu or Debian-based systems, you can install OpenSSL development libraries with:
sudo apt-get install libssl-dev
To compile the project, use the following command:
gcc -o ecdsa_keygen ecdsa_keygen.c -lssl -lcrypto
After compilation, you can run the program with:
./ecdsa_keygen
The program will generate a compressed public key from a hardcoded private key and print it to the console.
ecdsa_keygen.c
: Main source file containing the implementationecdsa_keygen.h
: Header file with function declarations
Generates a compressed public key from a given private key.
Parameters:
private_key
: Pointer to a 32-byte array containing the private keycompressed_public_key
: Pointer to a 33-byte array where the compressed public key will be stored
Returns:
- The length of the compressed public key on success
- -1 on failure
This project is open source and available under the MIT License.
Contributions to this project are welcome. Please fork the repository and submit a pull request with your changes.