Skip to content

Commit

Permalink
Merge pull request #11 from Cybersecurity-LINKS/draft-irtf-cfrg-bbs-s…
Browse files Browse the repository at this point in the history
…ignatures-07

Update to BBS+ draft 07
  • Loading branch information
AlbertoSvg authored Oct 15, 2024
2 parents cdca195 + 69a10ae commit 57ae1f9
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zkryptium"
version = "0.3.0"
version = "0.3.1"
edition = "2021"
license = "Apache-2.0"
authors = ["LINKS Foundation"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Description

ZKryptium provides an implementation in accordance with:
* **BBS+**([draft-irtf-cfrg-bbs-signatures-06](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06)) signature scheme
* **BBS+**([draft-irtf-cfrg-bbs-signatures-07](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07)) signature scheme
* **Blind BBS Signatures** ([draft-kalos-bbs-blind-signatures-01](https://datatracker.ietf.org/doc/html/draft-kalos-bbs-blind-signatures-01))
* **CL2003** (https://link.springer.com/chapter/10.1007/3-540-36413-7_20) signature scheme

Expand Down
2 changes: 1 addition & 1 deletion src/bbsplus/blind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ where

// The Blind BBS spec says to pass `generators.append(blind_generators)` to a
// `calculate_domain`, but it does not name Q1 as its own parameter like
// draft-irtf-cfrg-bbs-signatures-06 does. This implementation of calculate_domain matches the
// draft-irtf-cfrg-bbs-signatures-07 does. This implementation of calculate_domain matches the
// general BBS spec, in which Q1 is its own parameter, so it's not included in the generators.
//
// It would appear that some of the directions in the spec here need to be clarified. The
Expand Down
2 changes: 1 addition & 1 deletion src/bbsplus/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Generators {
}
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-generators-calculation
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-generators-calculation
///
/// # Description
/// Generators creation
Expand Down
2 changes: 1 addition & 1 deletion src/bbsplus/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl<CS: BbsCiphersuite> KeyPair<BBSplus<CS>> {
}
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-secret-key -> SK = KeyGen(key_material, key_info, key_dst)
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-secret-key -> SK = KeyGen(key_material, key_info, key_dst)
///
/// # Description
/// This operation generates a secret key (SK) deterministically from a secret octet string (key_material)
Expand Down
16 changes: 8 additions & 8 deletions src/bbsplus/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl BBSplusPoKSignature {
}

impl<CS: BbsCiphersuite> PoKSignature<BBSplus<CS>> {
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-proof-generation-proofgen
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-proof-generation-proofgen
///
/// # Description
/// This operation creates BBS proof, which is a zero-knowledge, proof-of-knowledge of a BBS signature, while optionally disclosing any subset of the signed messages.
Expand Down Expand Up @@ -264,7 +264,7 @@ impl<CS: BbsCiphersuite> PoKSignature<BBSplus<CS>> {
Ok(Self::BBSplus(proof))
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-proof-verification-proofver
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-proof-verification-proofver
///
/// # Description
/// The ProofVerify operation validates a BBS proof, given the Signer's public key (PK), a header and presentation header values, the disclosed messages and the indexes those messages had in the original vector of signed messages.
Expand Down Expand Up @@ -417,7 +417,7 @@ impl<CS: BbsCiphersuite> PoKSignature<BBSplus<CS>> {
}
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-coreproofgen
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-coreproofgen
///
/// # Description
/// This operation computes a zero-knowledge proof-of-knowledge of a signature, while optionally selectively disclosing from the original set of signed messages. The Prover may also supply a presentation header (ph).
Expand Down Expand Up @@ -524,7 +524,7 @@ struct ProofInitResult {
domain: Scalar,
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-proof-initialization
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-proof-initialization
///
/// # Description
/// This operation initializes the proof and returns one of the inputs passed to the challenge calculation operation ([`proof_challenge_calculate`]), during the [`core_proof_gen`] operation.
Expand Down Expand Up @@ -606,7 +606,7 @@ where
})
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-challenge-calculation
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-challenge-calculation
///
/// # Description
/// This operation calculates the challenge scalar value, used during the [`core_proof_gen`] and [`core_proof_verify`], as part of the Fiat-Shamir heuristic, for making the proof protocol non-interactive (in a interactive setting, the challenge would be a random value supplied by the Verifier).
Expand Down Expand Up @@ -666,7 +666,7 @@ where
hash_to_scalar::<CS>(&c_arr, &challenge_dst)
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-proof-finalization
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-proof-finalization
///
/// # Description
/// This operation finalizes the proof calculation during the [`core_proof_gen`] operation and returns the PoK [`BBSplusPoKSignature`].
Expand Down Expand Up @@ -723,7 +723,7 @@ fn proof_finalize(
})
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-coreproofverify
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-coreproofverify
///
/// # Description
/// This operation checks that a proof is valid for a header, vector of disclosed messages (disclosed_messages) along side their index corresponding to their original position when signed (disclosed_indexes) and presentation header (ph) against a public key (PK).
Expand Down Expand Up @@ -790,7 +790,7 @@ where
}
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-proof-verification-initiali
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-proof-verification-initiali
///
/// # Description
/// This operation initializes the proof verification operation and returns part of the input that will be passed to the challenge calculation operation ([`proof_challenge_calculate`]), during the [`core_proof_verify`] operation.
Expand Down
8 changes: 4 additions & 4 deletions src/bbsplus/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<CS: BbsCiphersuite> Signature<BBSplus<CS>> {
}
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-signature-generation-sign
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-signature-generation-sign
/// # Description
/// The `sign` API returns a BBS signature from a secret key (SK), over a header and a set of messages.
///
Expand Down Expand Up @@ -107,7 +107,7 @@ impl<CS: BbsCiphersuite> Signature<BBSplus<CS>> {
Ok(Self::BBSplus(signature))
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-signature-verification-veri
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-signature-verification-veri
/// # Description
/// The `verify` API validates a BBS signature, given a public key (PK), a header and a set of messages
/// # Inputs:
Expand Down Expand Up @@ -209,7 +209,7 @@ impl<CS: BbsCiphersuite> Signature<BBSplus<CS>> {
}
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-coresign
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-coresign
/// # Description
/// This operation computes a deterministic signature from a secret key (SK), a set of generators (points of G1) and optionally a header and a vector of messages.
///
Expand Down Expand Up @@ -278,7 +278,7 @@ where
Ok(BBSplusSignature { A, e: e })
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-coreverify
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-coreverify
/// # Description
/// This operation checks that a signature is valid for a given set of generators, header and vector of messages, against a supplied public key (PK). The set of messages MUST be supplied in this operation in the same order they were supplied to `core_sign` when creating the signature.
///
Expand Down
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum Error {
MapMessageToScalarError,
#[error("Not enough Generators")]
NotEnoughGenerators,
/// [More Info](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-coresign) in the `Note` at the end
/// [More Info](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-coresign) in the `Note` at the end
#[error(" A == Identity_G1")]
G1IdentityError,
#[error("Error during deserialization")]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub mod bbsplus_message {
Self { value: msg }
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-messages-to-scalars
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-messages-to-scalars
///
/// # Description
/// The messages_to_scalars operation is used to map a list of messages to their respective scalar values
Expand Down
8 changes: 4 additions & 4 deletions src/utils/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub mod bbsplus_utils {
out
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-hash-to-scalar
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-hash-to-scalar
///
/// # Description
/// This operation describes how to hash an arbitrary octet string to a scalar values in the multiplicative group of integers mod r
Expand Down Expand Up @@ -128,7 +128,7 @@ pub mod bbsplus_utils {
))
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-domain-calculation
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-domain-calculation
///
/// # Description
/// This operation calculates the domain value, a scalar representing the distillation of all essential contextual information for a signature. The same domain value must be calculated by all parties (the Signer, the Prover and the Verifier) for both the signature and proofs to be validated.
Expand Down Expand Up @@ -286,7 +286,7 @@ pub mod bbsplus_utils {
Scalar::random(rng)
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-random-scalars
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-random-scalars
///
/// # Description
/// This operation returns the requested number of pseudo-random scalars, using the `get_random` function
Expand All @@ -309,7 +309,7 @@ pub mod bbsplus_utils {
random_scalars
}

/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-06#name-mocked-random-scalars
/// https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bbs-signatures-07#name-mocked-random-scalars
///
/// # Description
/// The seeded_random_scalars will deterministically calculate count random-looking scalars from a single SEED, given a domain separation tag (DST).
Expand Down

0 comments on commit 57ae1f9

Please sign in to comment.