Expand description
§Bindings for Picnic: Post-Quantum Signatures
The Picnic signature scheme is a family of digital signature schemes secure against attacks by quantum computers. This crate provides bindings that implements the traits from the signature crate.
More information on Picnic is available on the project website: https://microsoft.github.io/Picnic/
Serialization and deserialization is implemented via the serde crate. By enabling the
serialization feature, all public structs implement the Serialize and Deserialize traits.
§Usage
Key generation, signing and verification can be implemented as follows:
use picnic_bindings::{PicnicL1FSSigningKey, Signer, Verifier};
let (signing_key, verification_key) = PicnicL1FSSigningKey::random().expect("Key generation failed");
let msg = "some message".as_bytes();
let signature = signing_key.sign(msg);
verification_key.verify(msg, &signature).expect("Verification failed");Keys and signatures support conversions to and from &[u8]. The following code example
demonstrates the necessary steps for SigningKey:
use picnic_bindings::{PicnicL1FSSigningKey};
use std::convert::TryFrom;
let (signing_key, verification_key) = PicnicL1FSSigningKey::random().expect("Key generation failed");
let signing_key_2 = PicnicL1FSSigningKey::try_from(signing_key.as_ref()).expect("Deserialization failed");
assert_eq!(signing_key, signing_key_2);Alternatively:
use picnic_bindings::{DynamicSigningKey, PicnicL1FS, Parameters, Signer, Verifier};
let (signing_key, verification_key) = DynamicSigningKey::random(PicnicL1FS::PARAM).expect("Key generation failed");
let msg = "some message".as_bytes();
let signature = signing_key.sign(msg);
verification_key.verify(msg, &signature).expect("Verification failed");In case a signature as only available as &[u8] and taking ownership is not desired, the
RawVerifier trait offers a method to verify the signature without first converting it into an
instance of DynamicSignature.
use picnic_bindings::{PicnicL1FSSigningKey, Signer, RawVerifier};
let (signing_key, verification_key) = PicnicL1FSSigningKey::random().expect("Key generation failed");
let msg = "some message".as_bytes();
let signature = signing_key.sign(msg);
// assume that this is the actual signature
let signature = signature.as_ref();
verification_key.verify_raw(msg, signature).expect("Verification failed");Re-exports§
pub use signature;
Structs§
- Dynamic
Signature - Signature stored in a
Vec - Dynamic
Signing Key - Signing key
- Dynamic
Verification Key - Verification key
- Error
- Signature errors.
- Picnic3
L1 - Picnic3L1 parameters
- Picnic3
L3 - Picnic3L3 parameters
- Picnic3
L5 - Picnic3L5 parameters
- Picnic
L1FS - PicnicL1FS parameters
- Picnic
L1Full - PicnicL1Full parameters
- Picnic
L1UR - PicnicL1UR parameters
- Picnic
L3FS - PicnicL3FS parameters
- Picnic
L3Full - PicnicL3Full parameters
- Picnic
L3UR - PicnicL3UR parameters
- Picnic
L5FS - PicnicL5FS parameters
- Picnic
L5Full - PicnicL5Full parameters
- Picnic
L5UR - PicnicL5UR parameters
- Signing
Key - Signing key generic over the parameters
- Verification
Key - Verification key generic over the parameters
Traits§
- Parameters
- Trait to describe Picnic parameters
- RawVerifier
- Trait that allows to directly verify a signature from a
&[u8] - Signer
- Sign the provided message bytestring using
Self(e.g. a cryptographic key or connection to an HSM), returning a digital signature. - Verifier
- Verify the provided message bytestring using
Self(e.g. a public key)
Type Aliases§
- Picnic3
L1Signing Key - Signing key for Picnic3L1
- Picnic3
L1Verification Key - Verification key for Picnic3L1
- Picnic3
L3Signing Key - Signing key for Picnic3L3
- Picnic3
L3Verification Key - Verification key for Picnic3L3
- Picnic3
L5Signing Key - Signing key for Picnic3L5
- Picnic3
L5Verification Key - Verification key for Picnic3L5
- Picnic
L1FS Signing Key - Signing key for PicnicL1FS
- Picnic
L1FS Verification Key - Verification key for PicnicL1FS
- Picnic
L1Full Signing Key - Signing key for PicnicL1Full
- Picnic
L1Full Verification Key - Verification key for PicnicL1Full
- Picnic
L1UR Signing Key - Signing key for PicnicL1UR
- Picnic
L1UR Verification Key - Verification key for PicnicL1UR
- Picnic
L3FS Signing Key - Signing key for PicnicL3FS
- Picnic
L3FS Verification Key - Verification key for PicnicL3FS
- Picnic
L3Full Signing Key - Signing key for PicnicL3Full
- Picnic
L3Full Verification Key - Verification key for PicnicL3Full
- Picnic
L3UR Signing Key - Signing key for PicnicL3UR
- Picnic
L3UR Verification Key - Verification key for PicnicL3UR
- Picnic
L5FS Signing Key - Signing key for PicnicL5FS
- Picnic
L5FS Verification Key - Verification key for PicnicL5FS
- Picnic
L5Full Signing Key - Signing key for PicnicL5Full
- Picnic
L5Full Verification Key - Verification key for PicnicL5Full
- Picnic
L5UR Signing Key - Signing key for PicnicL5UR
- Picnic
L5UR Verification Key - Verification key for PicnicL5UR