Skip to main content

Crate bicycl_rs

Crate bicycl_rs 

Source
Expand description

Safe Rust bindings for the BICYCL cryptographic library.

BICYCL implements class-group-based cryptographic schemes including:

  • Paillier homomorphic encryption
  • Joye-Libert homomorphic encryption
  • CL_HSMqk / CL_HSM2k class-group encryption with homomorphic properties
  • ECDSA signatures
  • Two-party ECDSA threshold signing (2-of-2)
  • Threshold ECDSA (t-of-n)
  • CL DLog proofs

§Build

Requires CMake, GMP, and OpenSSL development headers at build time.

§Thread safety

The underlying C library is not thread-safe. All wrapper types are !Send + !Sync and must be used from a single thread.

§License

This crate is licensed under GPL-3.0-or-later. Any crate or binary that depends on it inherits the GPL-3.0 copyleft obligation.

§Quick start

use bicycl_rs::{Context, Error};

fn main() -> Result<(), Error> {
    let ctx = Context::new()?;
    let mut rng = ctx.randgen_from_seed_decimal("12345")?;
    let paillier = ctx.paillier(512)?;
    let (sk, pk) = paillier.keygen(&ctx, &mut rng)?;
    let ct = paillier.encrypt_decimal(&ctx, &pk, &mut rng, "42")?;
    let plain = paillier.decrypt_decimal(&ctx, &pk, &sk, &ct)?;
    assert_eq!(plain, "42");
    Ok(())
}

Modules§

cl_dlog
State markers for ClDlogSession.
threshold
State markers for ThresholdEcdsaSession.
two_party
State markers for TwoPartyEcdsaSession.

Structs§

ClDlogMessage
A serializable message container used to exchange statements and proofs between prover and verifier in the CL DLog protocol.
ClDlogSession
A session for the interactive CL DLog (discrete logarithm) proof protocol.
ClHsm2k
A CL_HSM2k class-group encryption scheme with additive homomorphism over Z/2^k.
ClHsm2kCiphertext
A CL_HSM2k ciphertext.
ClHsm2kPublicKey
A CL_HSM2k public key. Safe to share.
ClHsm2kSecretKey
A CL_HSM2k secret key. Keep this private.
ClHsmqk
A CL_HSMqk class-group encryption scheme with additive homomorphism over Z/q^k.
ClHsmqkCiphertext
A CL_HSMqk ciphertext.
ClHsmqkPublicKey
A CL_HSMqk public key. Safe to share.
ClHsmqkSecretKey
A CL_HSMqk secret key. Keep this private.
ClassGroup
An imaginary quadratic class group defined by its discriminant.
Context
The central BICYCL library context.
Ecdsa
An ECDSA signature scheme instance.
EcdsaPublicKey
An ECDSA public (verification) key. Safe to share.
EcdsaSecretKey
An ECDSA secret (signing) key. Keep this private.
EcdsaSignature
An ECDSA signature (r, s).
JoyeLibert
A Joye-Libert homomorphic encryption scheme instance.
JoyeLibertCiphertext
A Joye-Libert ciphertext.
JoyeLibertPublicKey
A Joye-Libert public key. Safe to share.
JoyeLibertSecretKey
A Joye-Libert secret key. Keep this private.
Paillier
A Paillier homomorphic encryption scheme instance.
PaillierCiphertext
A Paillier ciphertext.
PaillierPublicKey
A Paillier public key. Safe to share.
PaillierSecretKey
A Paillier secret key. Keep this private.
Qfi
A Quadratic Form element in a class group.
RandGen
A deterministic pseudo-random number generator seeded from a decimal value.
ThresholdEcdsaSession
A stateful session for the threshold (t-of-n) ECDSA signing protocol.
TwoPartyEcdsaSession
A stateful session for the interactive two-party (2-of-2) ECDSA signing protocol.

Enums§

Error
All errors that can be returned by this crate.

Functions§

abi_version
Returns the ABI version of the linked bicycl_capi C library.
version
Returns the human-readable version string of the linked bicycl_capi library.
zeroize
Overwrites the given byte buffer with zeros using a memory-safe barrier.

Type Aliases§

Result