Expand description
Keys and setup parameters
§Examples
Creating signature parameters and keypair:
use ark_bls12_381::Bls12_381;
use blake2::Blake2b512;
use bbs_plus::setup::{SignatureParamsG1, SignatureParamsG2, KeypairG1, KeypairG2, PublicKeyG2, SignatureParams23G1};
// For BBS+ signatures
let params_g1 = SignatureParamsG1::<Bls12_381>::generate_using_rng(&mut rng, 5);
let params_g2 = SignatureParamsG2::<Bls12_381>::generate_using_rng(&mut rng, 5);
let params_g1_1 = SignatureParamsG1::<Bls12_381>::new::<Blake2b512>(&[1, 2, 3, 4], 5);
let params_g2_1 = SignatureParamsG2::<Bls12_381>::new::<Blake2b512>(&[1, 2, 3, 4], 5);
let keypair_g2 = KeypairG2::<Bls12_381>::generate_using_rng(&mut rng, ¶ms_g1);
let keypair_g1 = KeypairG1::<Bls12_381>::generate_using_rng(&mut rng, ¶ms_g2);
// Generate keypair using a secret `seed`. The same seed will return same keypair. The seed
// is hashed (along with other things) using the given hash function, the example below use Blake2b512
// let seed: &[u8] = <Some secret seed>
let keypair_g21 = KeypairG2::<Bls12_381>::generate_using_seed::<Blake2b512>(seed, ¶ms_g1);
// public and secret key from `Keypair`
let sk = keypair_g2.secret_key;
let pk = keypair_g2.public_key;
// Another way to generate keypair is
let sk = SecretKey::generate_using_seed::<Blake2b512>(&seed);
let pk = PublicKeyG2::public_key_from_secret_key(&sk, ¶ms_g1);
KeypairG2 {secret_key: sk, public_key: pk}
// For BBS signatures
// For BBS, sig params are `SignatureParams23G1` but public key is `PublicKeyG2`
let params = SignatureParams23G1::<Bls12_381>::generate_using_rng(&mut rng, 5);
let params_1 = SignatureParams23G1::<Bls12_381>::new::<Blake2b512>(&[1, 2, 3, 4], 5);
let keypair = KeypairG2::<Bls12_381>::generate_using_rng_and_bbs23_params(&mut rng, ¶ms);
let keypair_1 = KeypairG2::<Bls12_381>::generate_using_seed_and_bbs23_params::<Blake2b512>(seed, ¶ms);
let pk = PublicKeyG2::generate_using_secret_key_and_bbs23_params(&sk, ¶ms);
KeypairG2 {secret_key: sk, public_key: pk}Structs§
- Keypair
G1 - Keypair
G2 - Prepared
Public KeyG2 - Prepared
Signature Params23 G1 - Signature params for BBS signatures with G2 element prepared for pairing
- Prepared
Signature Params G1 - Public
KeyG1 - Public key of the signer. The signer can use the same public key with different
signature parameters to sign different multi-messages, provided that parameter
g2is consistent with the ‘g2’ used to generate the public key. - Public
KeyG2 - Public key of the signer. The signer can use the same public key with different
signature parameters to sign different multi-messages, provided that parameter
g2is consistent with the ‘g2’ used to generate the public key. - Secret
Key - Secret key used by the signer to sign messages
- Signature
Params23 G1 - BBS signature params used for signing, verifying and proving knowledge of signature.
- Signature
Params G1 - BBS+ signature params used while signing and verifying. Also used when proving knowledge of signature. Every signer can create his own params but several signers can share the same parameters if signing messages of the same size and still have their own public keys. Size of parameters is proportional to the number of messages
- Signature
Params G2 - BBS+ signature params used while signing and verifying. Also used when proving knowledge of signature. Every signer can create his own params but several signers can share the same parameters if signing messages of the same size and still have their own public keys. Size of parameters is proportional to the number of messages