Expand description
Implementation of Lamport’s one-time signature scheme.
§Usage
use lamport_signature_plus::{VerifyingKey, SigningKey, LamportFixedDigest};
use sha2::Sha256;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
let mut rng = ChaChaRng::from_entropy();
let mut signing_key = SigningKey::<LamportFixedDigest<Sha256>>::random(rng);
let verifying_key = VerifyingKey::from(&signing_key);
let signature = signing_key.sign(b"Hello, World!").expect("signing failed");
assert!(verifying_key.verify(&signature, b"Hello, World!").is_ok());
§Digest Algorithm
SigningKey
and VerifyingKey
can use any digest algorithm types that provided by RustCrypto/hashes as a type argument to construct.
Algorithms can be either fixed output size or extendable output size.
Extendable Output Size algorithms default to 32 byte lengths.
§Example of Extendable Output Size
use lamport_signature_plus::{VerifyingKey, SigningKey, LamportExtendableDigest};
use sha3::Shake128;
use rand::SeedableRng;
use rand_chacha::ChaChaRng;
let mut rng = ChaChaRng::from_entropy();
let mut signing = SigningKey::<LamportExtendableDigest<Shake128>>::random(rng);
let verifying = VerifyingKey::from(&signing);
let signature = signing.sign(b"Hello, World!").expect("signing failed");
assert!(verifying.verify(&signature, b"Hello, World!").is_ok());
§RNG Algorithm
SigningKey
takes the cryptographically secure RNG implemented in rust-lang-nursery/rand as an argument to construct,
i.e. RNG must implement the RngCore
and CryptoRng
traits.
§Note
SigningKey
can only be used once to securely sign a message. If an attempt is made to sign a message with a used key, an error returns.
Structs§
- Lamport
Extendable Digest - Lamport signature scheme than uses extendable output functions.
- Lamport
Fixed Digest - Lamport signature scheme than uses fixed output functions.
- Multi
Vec - A multi-dimensional vector. This is faster and simpler than using Vec<Vec<…>>
- Signature
- A signature data generated by [
SigningKey
]. - Signature
Share - A signature share generated by [
SigningKeyShare
]. - Signing
Key - A one-time signing private key.
- Signing
KeyShare - A key share that must be combined with other secret key shares to produce the signing key, or used for creating partial signatures.
- Verifying
Key - A one-time signing public key.
Enums§
- Lamport
Error - Errors in lamport signing scheme.
Traits§
- Lamport
Digest - A trait for providing Lamport supported digest functions.
Functions§
- generate_
keys - Generate a new pair of keys.
Type Aliases§
- Lamport
Result - Result type for Lamport errors.