Crate picnic_bindings

Crate picnic_bindings 

Source
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§

DynamicSignature
Signature stored in a Vec
DynamicSigningKey
Signing key
DynamicVerificationKey
Verification key
Error
Signature errors.
Picnic3L1
Picnic3L1 parameters
Picnic3L3
Picnic3L3 parameters
Picnic3L5
Picnic3L5 parameters
PicnicL1FS
PicnicL1FS parameters
PicnicL1Full
PicnicL1Full parameters
PicnicL1UR
PicnicL1UR parameters
PicnicL3FS
PicnicL3FS parameters
PicnicL3Full
PicnicL3Full parameters
PicnicL3UR
PicnicL3UR parameters
PicnicL5FS
PicnicL5FS parameters
PicnicL5Full
PicnicL5Full parameters
PicnicL5UR
PicnicL5UR parameters
SigningKey
Signing key generic over the parameters
VerificationKey
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§

Picnic3L1SigningKey
Signing key for Picnic3L1
Picnic3L1VerificationKey
Verification key for Picnic3L1
Picnic3L3SigningKey
Signing key for Picnic3L3
Picnic3L3VerificationKey
Verification key for Picnic3L3
Picnic3L5SigningKey
Signing key for Picnic3L5
Picnic3L5VerificationKey
Verification key for Picnic3L5
PicnicL1FSSigningKey
Signing key for PicnicL1FS
PicnicL1FSVerificationKey
Verification key for PicnicL1FS
PicnicL1FullSigningKey
Signing key for PicnicL1Full
PicnicL1FullVerificationKey
Verification key for PicnicL1Full
PicnicL1URSigningKey
Signing key for PicnicL1UR
PicnicL1URVerificationKey
Verification key for PicnicL1UR
PicnicL3FSSigningKey
Signing key for PicnicL3FS
PicnicL3FSVerificationKey
Verification key for PicnicL3FS
PicnicL3FullSigningKey
Signing key for PicnicL3Full
PicnicL3FullVerificationKey
Verification key for PicnicL3Full
PicnicL3URSigningKey
Signing key for PicnicL3UR
PicnicL3URVerificationKey
Verification key for PicnicL3UR
PicnicL5FSSigningKey
Signing key for PicnicL5FS
PicnicL5FSVerificationKey
Verification key for PicnicL5FS
PicnicL5FullSigningKey
Signing key for PicnicL5Full
PicnicL5FullVerificationKey
Verification key for PicnicL5Full
PicnicL5URSigningKey
Signing key for PicnicL5UR
PicnicL5URVerificationKey
Verification key for PicnicL5UR