Documentation ¶
Overview ¶
Package bbs12381g2pub contains BBS+ signing primitives and keys. Although it can be used directly, it is recommended to use BBS+ keys created by the kms along with the framework's Crypto service.
The default local Crypto service is found at: "github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/tinkcrypto"
While the remote Crypto service is found at: "github.com/hyperledger/aries-framework-go/component/kmscrypto/crypto/webkms"
Index ¶
- func GenerateKeyPair(h func() hash.Hash, seed []byte) (*PublicKey, *PrivateKey, error)
- type BBSG2Pub
- func (bbs *BBSG2Pub) DeriveProof(messages [][]byte, sigBytes, nonce, pubKeyBytes []byte, revealedIndexes []int) ([]byte, error)
- func (bbs *BBSG2Pub) Sign(messages [][]byte, privKeyBytes []byte) ([]byte, error)
- func (bbs *BBSG2Pub) SignWithKey(messages [][]byte, privKey *PrivateKey) ([]byte, error)
- func (bbs *BBSG2Pub) Verify(messages [][]byte, sigBytes, pubKeyBytes []byte) error
- func (bbs *BBSG2Pub) VerifyProof(messagesBytes [][]byte, proof, nonce, pubKeyBytes []byte) error
- type PoKOfSignature
- type PoKOfSignatureProof
- type PrivateKey
- type ProofG1
- type ProofNonce
- type ProverCommittedG1
- type ProverCommittingG1
- type PublicKey
- type PublicKeyWithGenerators
- type Signature
- type SignatureMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKeyPair ¶
GenerateKeyPair generates BBS+ PublicKey and PrivateKey pair.
Types ¶
type BBSG2Pub ¶
type BBSG2Pub struct{}
BBSG2Pub defines BBS+ signature scheme where public key is a point in the field of G2. BBS+ signature scheme (as defined in https://eprint.iacr.org/2016/663.pdf, section 4.3).
func (*BBSG2Pub) DeriveProof ¶
func (bbs *BBSG2Pub) DeriveProof(messages [][]byte, sigBytes, nonce, pubKeyBytes []byte, revealedIndexes []int) ([]byte, error)
DeriveProof derives a proof of BBS+ signature with some messages disclosed.
func (*BBSG2Pub) SignWithKey ¶
func (bbs *BBSG2Pub) SignWithKey(messages [][]byte, privKey *PrivateKey) ([]byte, error)
SignWithKey signs the one or more messages using BBS+ key pair.
type PoKOfSignature ¶
type PoKOfSignature struct {
// contains filtered or unexported fields
}
PoKOfSignature is Proof of Knowledge of a Signature that is used by the prover to construct PoKOfSignatureProof.
func NewPoKOfSignature ¶
func NewPoKOfSignature(signature *Signature, messages []*SignatureMessage, revealedIndexes []int, pubKey *PublicKeyWithGenerators) (*PoKOfSignature, error)
NewPoKOfSignature creates a new PoKOfSignature.
func (*PoKOfSignature) GenerateProof ¶
func (pos *PoKOfSignature) GenerateProof(challengeHash *bls12381.Fr) *PoKOfSignatureProof
GenerateProof generates PoKOfSignatureProof proof from PoKOfSignature signature.
func (*PoKOfSignature) ToBytes ¶
func (pos *PoKOfSignature) ToBytes() []byte
ToBytes converts PoKOfSignature to bytes.
type PoKOfSignatureProof ¶
type PoKOfSignatureProof struct {
// contains filtered or unexported fields
}
PoKOfSignatureProof defines BLS signature proof. It is the actual proof that is sent from prover to verifier.
func ParseSignatureProof ¶
func ParseSignatureProof(sigProofBytes []byte) (*PoKOfSignatureProof, error)
ParseSignatureProof parses a signature proof.
func (*PoKOfSignatureProof) GetBytesForChallenge ¶
func (sp *PoKOfSignatureProof) GetBytesForChallenge(revealedMessages map[int]*SignatureMessage, pubKey *PublicKeyWithGenerators) []byte
GetBytesForChallenge creates bytes for proof challenge.
func (*PoKOfSignatureProof) ToBytes ¶
func (sp *PoKOfSignatureProof) ToBytes() []byte
ToBytes converts PoKOfSignatureProof to bytes.
func (*PoKOfSignatureProof) Verify ¶
func (sp *PoKOfSignatureProof) Verify(challenge *bls12381.Fr, pubKey *PublicKeyWithGenerators, revealedMessages map[int]*SignatureMessage, messages []*SignatureMessage) error
Verify verifies PoKOfSignatureProof.
type PrivateKey ¶
PrivateKey defines BLS Public Key.
func UnmarshalPrivateKey ¶
func UnmarshalPrivateKey(privKeyBytes []byte) (*PrivateKey, error)
UnmarshalPrivateKey unmarshals PrivateKey.
func (*PrivateKey) Marshal ¶
func (k *PrivateKey) Marshal() ([]byte, error)
Marshal marshals PrivateKey.
func (*PrivateKey) PublicKey ¶
func (k *PrivateKey) PublicKey() *PublicKey
PublicKey returns a Public Key as G2 point generated from the Private Key.
type ProofG1 ¶
type ProofG1 struct {
// contains filtered or unexported fields
}
ProofG1 is a proof of knowledge of a signature and hidden messages.
func NewProofG1 ¶
NewProofG1 creates a new ProofG1.
func ParseProofG1 ¶
ParseProofG1 parses ProofG1 from bytes.
type ProofNonce ¶
type ProofNonce struct {
// contains filtered or unexported fields
}
ProofNonce is a nonce for Proof of Knowledge proof.
func ParseProofNonce ¶
func ParseProofNonce(proofNonceBytes []byte) *ProofNonce
ParseProofNonce creates a new ProofNonce from bytes.
func (*ProofNonce) ToBytes ¶
func (pn *ProofNonce) ToBytes() []byte
ToBytes converts ProofNonce into bytes.
type ProverCommittedG1 ¶
type ProverCommittedG1 struct {
// contains filtered or unexported fields
}
ProverCommittedG1 helps to generate a ProofG1.
func (*ProverCommittedG1) GenerateProof ¶
GenerateProof generates proof ProofG1 for all secrets.
func (*ProverCommittedG1) ToBytes ¶
func (g *ProverCommittedG1) ToBytes() []byte
ToBytes converts ProverCommittedG1 to bytes.
type ProverCommittingG1 ¶
type ProverCommittingG1 struct {
// contains filtered or unexported fields
}
ProverCommittingG1 is a proof of knowledge of messages in a vector commitment.
func NewProverCommittingG1 ¶
func NewProverCommittingG1() *ProverCommittingG1
NewProverCommittingG1 creates a new ProverCommittingG1.
func (*ProverCommittingG1) Commit ¶
func (pc *ProverCommittingG1) Commit(base *bls12381.PointG1)
Commit append a base point and randomly generated blinding factor.
func (*ProverCommittingG1) Finish ¶
func (pc *ProverCommittingG1) Finish() *ProverCommittedG1
Finish helps to generate ProverCommittedG1 after commitment of all base points.
type PublicKey ¶
PublicKey defines BLS Public Key.
func UnmarshalPublicKey ¶
UnmarshalPublicKey parses a PublicKey from bytes.
func (*PublicKey) ToPublicKeyWithGenerators ¶
func (pk *PublicKey) ToPublicKeyWithGenerators(messagesCount int) (*PublicKeyWithGenerators, error)
ToPublicKeyWithGenerators creates PublicKeyWithGenerators from the PublicKey.
type PublicKeyWithGenerators ¶
type PublicKeyWithGenerators struct {
// contains filtered or unexported fields
}
PublicKeyWithGenerators extends PublicKey with a blinding generator h0, a commitment to the secret key w, and a generator for each message h.
type Signature ¶
Signature defines BLS signature.
func ParseSignature ¶
ParseSignature parses a Signature from bytes.
func (*Signature) ToBytes ¶
ToBytes converts signature to bytes using compression of G1 point and E, S FR points.
func (*Signature) Verify ¶
func (s *Signature) Verify(messages []*SignatureMessage, pubKey *PublicKeyWithGenerators) error
Verify is used for signature verification.
type SignatureMessage ¶
SignatureMessage defines a message to be used for a signature check.
func ParseSignatureMessage ¶
func ParseSignatureMessage(message []byte) *SignatureMessage
ParseSignatureMessage parses SignatureMessage from bytes.