threshold-pairing 0.1.0

Pairing threshold cryptography
Documentation

threshold-pairing

A pairing-based threshold cryptosystem for collaborative decryption and signatures.

This is a fork from threshold_crypto which updates the dependencies and improves cryptographic standards compliance. Note: This fork is not backwards compatible with the original threshold_crypto due to changes in the hash-to-curve implementation.

The threshold-pairing crate provides cryptographic keys with methods for signing and encrypting messages, as well as key sets for threshold signatures and threshold encryption.

The threshold signature scheme is described in Threshold Signatures, Multisignatures and Blind Signatures Based on the Gap-Diffie-Hellman-Group Signature Scheme by Alexandra Boldyreva. This paper extends Boneh-Lynn-Shacham signatures to the threshold setting. Message encryption uses the scheme by Baek and Zhang.

Our implementation is based on the bls12_381 elliptic curve library.

Key Features

  • Threshold Signatures: Any t + 1 participants can collaborate to sign a message
  • Threshold Encryption: Encrypted messages require t + 1 participants to decrypt
  • Unique Signatures: Signatures are deterministic and independent of the signing set
  • Distributed Key Generation: Tools for trustless key generation
  • RFC 9380 Compliance: Standard hash-to-curve implementation (BLS signatures)

threshold-crypto

The original code is based on threshold_crypto but we bumped all dependencies to the latest possible version. We also improved the API by hardening it and removing a few foot guns. The two libraries are not fully compatible because we switched the hash-to-curve implementation to the RFC9380 standard.

Security Audit

An official security audit has been completed on the original threshold_crypto by Jean-Philippe Aumasson. No exploitable security issues were found.

Usage

Add to your Cargo.toml:

[dependencies]
threshold-pairing = "0.1"

Feature Flags

  • serde (enabled by default): Adds Serialize and Deserialize impls for all public types
  • bincode: Enables bincode serialization support (requires serde)
  • serialization: Convenience feature that enables both serde and bincode
  • expose-secret: Enables reveal() methods on secret types for debugging (dev/debug only, never use in production)

To use without serde:

[dependencies]
threshold-pairing = { version = "0.1", default-features = false }

To enable all serialization features:

[dependencies]
threshold-pairing = { version = "0.1", features = ["serialization"] }

Basic Example

use threshold_pairing::SecretKey;

fn main() {
    let sk = SecretKey::random();
    let pk = sk.public_key();

    let msg = b"Hello, threshold cryptography!";
    let signature = sk.sign(msg);

    assert!(pk.verify(&signature, msg));
}

For detailed API documentation, examples, and guides, see the full documentation on docs.rs.

License

Licensed under either of:

at your option.

Links