jf_signature/
constants.rs

1// Copyright (c) 2022 Espresso Systems (espressosys.com)
2// This file is part of the Jellyfish library.
3
4// You should have received a copy of the MIT License
5// along with the Jellyfish library. If not, see <https://mit-license.org/>.
6//! Tags to be used for [`tagged-base64`](https://github.com/espressosystems/tagged-base64)
7
8/// Tags
9pub mod tag {
10    /// Tag for BLS key pair
11    pub const BLS_KEY_PAIR: &str = "BLS_KEY_PAIR";
12    /// Tag for BLS verification key
13    pub const BLS_VER_KEY: &str = "BLS_VER_KEY";
14    /// Tag for BLS signing key
15    pub const BLS_SIGNING_KEY: &str = "BLS_SIGNING_KEY";
16    /// Tag for BLS signature
17    pub const BLS_SIG: &str = "BLS_SIG";
18
19    /// Tag for Schnorr key pair
20    pub const SCHNORR_KEY_PAIR: &str = "SCHNORR_KEY_PAIR";
21    /// Tag for Schnorr verification key
22    pub const SCHNORR_VER_KEY: &str = "SCHNORR_VER_KEY";
23    /// Tag for Schnorr signing key
24    pub const SCHNORR_SIGNING_KEY: &str = "SCHNORR_SIGNING_KEY";
25    /// Tag for Schnorr signature
26    pub const SCHNORR_SIG: &str = "SCHNORR_SIG";
27}
28
29/// ciphersuite identifier for schnorr signature
30pub const CS_ID_SCHNORR: &str = "SCHNORR_WITH_RESCUE_HASH_v01";
31
32/// ciphersuite identifier for BLS signature over BLS12_381, see:
33/// <https://www.ietf.org/archive/id/draft-irtf-cfrg-bls-signature-05.html#name-ciphersuite-format>
34pub const CS_ID_BLS_MIN_SIG: &str = "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_";
35
36/// Size in bytes of a secret key in our BLS signature scheme.
37pub const BLS_SIG_SK_SIZE: usize = 32;
38/// Size in bytes of a signature in our BLS signature scheme.
39pub const BLS_SIG_SIGNATURE_SIZE: usize = 96;
40/// Size in bytes of a compressed signature in our BLS signature scheme.
41pub const BLS_SIG_COMPRESSED_SIGNATURE_SIZE: usize = 48;
42/// Size in bytes of a verification key in our BLS signature scheme.
43pub const BLS_SIG_PK_SIZE: usize = 192;
44/// Size in bytes of a compressed verification key in our BLS signature scheme.
45pub const BLS_SIG_COMPRESSED_PK_SIZE: usize = 96;
46
47/// ciphersuite identifier for BLS signature over BN254
48/// Note this is **adapted** from <https://www.ietf.org/archive/id/draft-irtf-cfrg-bls-signature-05.html#name-ciphersuite-format>.
49/// In particular the "hash-and-pray" method is not part of <https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16>, so the tag "NCTH" (non constant time hash) is not standard.
50pub const CS_ID_BLS_BN254: &str = "BLS_SIG_BN254G1_XMD:KECCAK_NCTH_NUL_";