BLS Signatures CLI (bls-sig-cli)
A proof-of-concept, command-line tool for BLS signature operations, providing functionalities for key generation, public key derivation, message signing, and signature verification.
Table of Contents
Overview
bls-sig-cli is a versatile command-line interface designed to facilitate various operations related to BLS (Boneh-Lynn-Shacham) signatures. It leverages robust cryptographic libraries to provide a secure and easy-to-use tool for generating keys, signing messages, and verifying signatures.
Features
- Key Generation: Generate BLS secret keys from Input Key Material (IKM) or randomly.
- Public Key Derivation: Derive the corresponding public key from a given secret key file.
- Message Signing: Sign messages using a BLS secret key.
- Signature Verification: Verify BLS signatures against a public key and a message.
- Flexible Output: Output keys and signatures to standard output or specified files.
Installation
From Crates.io (Recommended)
To install bls-sig-cli directly from Crates.io, ensure you have Rust and Cargo installed, then run:
From Source
If you prefer to build from source, follow these steps:
The executable will be located at target/release/bls-sig-cli. You can then move it to a directory in your PATH:
Usage
The bls-sig-cli CLI provides several subcommands, each corresponding to a specific BLS signature operation.
Global Options
BLS Signatures CLI
Usage: bls-sig-cli <COMMAND>
Commands
keygen
Generate a new BLS secret key.
Usage: bls-sig-cli keygen [OPTIONS]
Options:
-i,--ikm <IKM>: Optional. Input Key Material used to derive the BLS private key.-o,--out <OUT>: Optional. Path to store the generated secret key.-h,--help: Print help.
pubkey
Derive and print the public key from a secret key file.
Usage: bls-sig-cli pubkey [OPTIONS]
Options:
-p,--path <PATH>: Optional. Path to the secret key file.-h,--help: Print help.
sign
Sign a message using a BLS secret key. A message can be any file or any arbitrary string of characters.
Usage: bls-sig-cli sign [OPTIONS] --msg <MSG>
Options:
-p,--path <PATH>: Optional. Path to the secret key file.-m,--msg <MSG>: Mandatory. Message to be signed.-h,--help: Print help.
verify
Verify a BLS signature.
Usage: bls-sig-cli verify --pk <PK> --msg <MSG> --sig <SIG>
Options:
-p,--pk <PK>: Mandatory. Public key (hex).-m,--msg <MSG>: Mandatory. Message used during signing.-s,--sig <SIG>: Mandatory. Signature (hex).-h,--help: Print help.
Examples
Generate a random secret key and save to a file:
Generate a secret key from IKM:
Derive a public key:
Sign a message:
Verify a signature:
Replace
PK_HEX,MSG_STRING, andSIG_HEXwith actual values.
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request on the GitHub repository.
License
This project is licensed under:
Authors
- sidx04 – siddpal04@gmail.com