Skip to main content

Module bls

Module bls 

Source
Expand description

BLS signatures over BLS12-381 with minimum-size public keys.

This module implements the Basic, Message Augmentation, and Proof of Possession schemes from draft-irtf-cfrg-bls-signature-07. Public keys are 48-byte compressed G1 points and signatures are 96-byte compressed G2 points. Eth2Bls12381G2PopV4 is a deliberately separate adapter for the legacy draft-v4 profile retained by Ethereum consensus.

The standard profile is pinned to draft-irtf-cfrg-bls-signature-07, published 6 July 2026. That draft’s Appendix B still marks minimum-public- key vectors as TBA; dcrypt therefore combines published EIP-2333 v4 KeyGen vectors with byte-for-byte tests against an independent BLS12-381 oracle in the excluded verification workspace.

use dcrypt_sign::bls::{Bls12381G2Basic, Bls12381SecretKey};

// Production IKM must be at least 32 unpredictable bytes. Draft-07 also
// requires the caller to choose the salt explicitly.
let ikm = [7u8; 32];
let secret = Bls12381SecretKey::key_gen(&ikm, b"example application salt")?;
let public = secret.public_key()?;
let signature = Bls12381G2Basic::sign(&secret, b"message")?;
Bls12381G2Basic::verify(&public, b"message", &signature)?;

Secret keys are non-Copy, non-Clone, exact-width clearing owners. They never expose a plain byte-array serialization. The arithmetic bridge uses a fixed 256-bit scalar-multiplication schedule and explicitly clears scalar and byte temporaries; target-specific compiler inspection remains necessary for a concrete side-channel claim.

Structs§

Bls12381G2Basic
Draft-07 minimum-public-key Basic scheme.
Bls12381G2MessageAugmentation
Draft-07 minimum-public-key Message Augmentation scheme.
Bls12381G2ProofOfPossession
Draft-07 minimum-public-key Proof of Possession scheme.
Bls12381ProofOfPossession
Canonical prime-subgroup proof of possession in G2.
Bls12381PublicKey
Canonical, nonidentity, prime-subgroup minimum-size public key in G1.
Bls12381SecretKey
Protected canonical nonzero BLS12-381 secret scalar.
Bls12381Signature
Canonical prime-subgroup signature in G2.
Eth2Bls12381G2PopV4
Ethereum consensus adapter for the minimum-public-key draft-v4 PoP profile.

Constants§

BLS_AUG_G2_DST
Draft-07 minimum-public-key Message Augmentation domain separation tag.
BLS_BASIC_G2_DST
Draft-07 minimum-public-key Basic ciphersuite domain separation tag.
BLS_POP_G2_DST
Draft-07 minimum-public-key Proof of Possession signature tag.
BLS_POP_PROOF_G2_DST
Draft-07 minimum-public-key proof-generation tag, distinct from signatures.
BLS_PUBLIC_KEY_SIZE
Size of a compressed minimum-size BLS12-381 public key in G1.
BLS_SECRET_KEY_SIZE
Size of a canonical BLS12-381 secret scalar encoding.
BLS_SIGNATURE_SIZE
Size of a compressed minimum-public-key BLS12-381 signature in G2.