Documentation
¶
Index ¶
- Constants
- Variables
- func AggregatePublicKeyToBytes(apk *AggregatePublicKey) []byte
- func AggregateSignatureToBytes(asig *AggregateSignature) []byte
- func PublicKeyBytes(pk *PublicKey) []byte
- func PublicKeyToCompressedBytes(pk *PublicKey) []byte
- func PublicKeyToUncompressedBytes(key *PublicKey) []byte
- func SecretKeyToBytes(sk *SecretKey) []byte
- func SignatureToBytes(sig *Signature) []byte
- func Verify(pk *PublicKey, sig *Signature, msg []byte) bool
- func Verify2(pk *DirectPublicKey, sig *DirectSignature, msg []byte) bool
- func VerifyAggregate(apk *AggregatePublicKey, asig *AggregateSignature, msg []byte) bool
- func VerifyAggregateProofOfPossession(apk *AggregatePublicKey, asig *AggregateSignature, msg []byte) bool
- func VerifyProofOfPossession(pk *PublicKey, sig *Signature, msg []byte) bool
- func VerifyProofOfPossession2(pk *DirectPublicKey, sig *DirectSignature, msg []byte) bool
- type AggregatePublicKey
- type AggregateSignature
- type Ciphersuite
- type DirectPublicKey
- type DirectSecretKey
- type DirectSignature
- type PublicKey
- type SecretKey
- type Signature
- type Signer
Constants ¶
const ( SecretKeyLen = 32 PublicKeyLen = 48 // Compressed G1 point SignatureLen = 96 // Compressed G2 point )
const ( DSTSignature = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_" DSTProofOfPossession = "BLS_POP_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_" )
Constants for domain separation tags
Variables ¶
var ( ErrNoPublicKeys = errors.New("no public keys") ErrFailedPublicKeyDecompress = errors.New("couldn't decompress public key") ErrFailedSignatureDecompress = errors.New("couldn't decompress signature") ErrInvalidSignature = errors.New("invalid signature") ErrNoSignatures = errors.New("no signatures") ErrFailedSignatureAggregation = errors.New("couldn't aggregate signatures") )
Functions ¶
func AggregatePublicKeyToBytes ¶ added in v1.1.2
func AggregatePublicKeyToBytes(apk *AggregatePublicKey) []byte
AggregatePublicKeyToBytes converts an aggregate public key to bytes
func AggregateSignatureToBytes ¶ added in v1.1.2
func AggregateSignatureToBytes(asig *AggregateSignature) []byte
AggregateSignatureToBytes converts an aggregate signature to bytes
func PublicKeyBytes ¶ added in v1.1.2
PublicKeyBytes is a helper that returns the compressed bytes of a public key
func PublicKeyToCompressedBytes ¶
PublicKeyToCompressedBytes returns the compressed big-endian format of the public key.
func PublicKeyToUncompressedBytes ¶
PublicKeyToUncompressedBytes returns the uncompressed big-endian format of the public key. For circl/bls, this is the same as compressed.
func SecretKeyToBytes ¶ added in v0.1.3
SecretKeyToBytes returns the big-endian format of the secret key.
func SignatureToBytes ¶
SignatureToBytes returns the compressed big-endian format of the signature.
func Verify2 ¶ added in v0.1.4
func Verify2(pk *DirectPublicKey, sig *DirectSignature, msg []byte) bool
Verify verifies a signature against a public key and message
func VerifyAggregate ¶ added in v1.1.2
func VerifyAggregate(apk *AggregatePublicKey, asig *AggregateSignature, msg []byte) bool
VerifyAggregate verifies an aggregate signature
func VerifyAggregateProofOfPossession ¶ added in v1.1.2
func VerifyAggregateProofOfPossession(apk *AggregatePublicKey, asig *AggregateSignature, msg []byte) bool
VerifyAggregateProofOfPossession verifies an aggregate proof of possession
func VerifyProofOfPossession ¶
VerifyProofOfPossession verifies the possession of the secret pre-image of [sk]
func VerifyProofOfPossession2 ¶ added in v0.1.4
func VerifyProofOfPossession2(pk *DirectPublicKey, sig *DirectSignature, msg []byte) bool
VerifyProofOfPossession2 verifies a proof of possession signature
Types ¶
type AggregatePublicKey ¶
type AggregatePublicKey = PublicKey
Types wrapping the circl BLS types
func AggregatePublicKeyFromBytes ¶ added in v1.1.2
func AggregatePublicKeyFromBytes(pkBytes []byte) (*AggregatePublicKey, error)
AggregatePublicKeyFromBytes converts bytes to an aggregate public key
type AggregateSignature ¶
type AggregateSignature = Signature
Types wrapping the circl BLS types
func AggregateSignatureFromBytes ¶ added in v1.1.2
func AggregateSignatureFromBytes(sigBytes []byte) (*AggregateSignature, error)
AggregateSignatureFromBytes converts bytes to an aggregate signature
type Ciphersuite ¶
type Ciphersuite int
const ( CiphersuiteSignature Ciphersuite = iota CiphersuiteProofOfPossession )
func (Ciphersuite) Bytes ¶
func (c Ciphersuite) Bytes() []byte
func (Ciphersuite) String ¶
func (c Ciphersuite) String() string
type DirectPublicKey ¶ added in v0.1.4
type DirectPublicKey struct {
// contains filtered or unexported fields
}
DirectPublicKey represents a BLS public key using G1
func AggregatePublicKeys2 ¶ added in v0.1.4
func AggregatePublicKeys2(pks []*DirectPublicKey) (*DirectPublicKey, error)
AggregatePublicKeys2 aggregates multiple public keys
func (*DirectPublicKey) Bytes ¶ added in v0.1.4
func (pk *DirectPublicKey) Bytes() []byte
Bytes returns the compressed serialization of the public key
func (*DirectPublicKey) SetBytes ¶ added in v0.1.4
func (pk *DirectPublicKey) SetBytes(data []byte) error
SetBytes deserializes a public key from compressed bytes
type DirectSecretKey ¶ added in v0.1.4
type DirectSecretKey struct {
// contains filtered or unexported fields
}
DirectSecretKey represents a BLS secret key
func GenerateKey ¶ added in v0.1.4
func GenerateKey(reader io.Reader) (*DirectSecretKey, error)
GenerateKey generates a new BLS secret key
func (*DirectSecretKey) Bytes ¶ added in v0.1.4
func (sk *DirectSecretKey) Bytes() []byte
Bytes returns the serialization of the secret key
func (*DirectSecretKey) PublicKey ¶ added in v0.1.4
func (sk *DirectSecretKey) PublicKey() *DirectPublicKey
PublicKey returns the public key corresponding to the secret key
func (*DirectSecretKey) SetBytes ¶ added in v0.1.4
func (sk *DirectSecretKey) SetBytes(data []byte) error
SetBytes deserializes a secret key from bytes
func (*DirectSecretKey) Sign ¶ added in v0.1.4
func (sk *DirectSecretKey) Sign(msg []byte) *DirectSignature
Sign creates a signature for the given message
func (*DirectSecretKey) SignProofOfPossession ¶ added in v0.1.4
func (sk *DirectSecretKey) SignProofOfPossession(msg []byte) *DirectSignature
SignProofOfPossession creates a proof of possession signature
type DirectSignature ¶ added in v0.1.4
type DirectSignature struct {
// contains filtered or unexported fields
}
DirectSignature represents a BLS signature using G2
func AggregateSignatures2 ¶ added in v0.1.4
func AggregateSignatures2(sigs []*DirectSignature) (*DirectSignature, error)
AggregateSignatures2 aggregates multiple signatures
func (*DirectSignature) Bytes ¶ added in v0.1.4
func (sig *DirectSignature) Bytes() []byte
Bytes returns the compressed serialization of the signature
func (*DirectSignature) SetBytes ¶ added in v0.1.4
func (sig *DirectSignature) SetBytes(data []byte) error
SetBytes deserializes a signature from compressed bytes
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
Types wrapping the circl BLS types
func AggregatePublicKeys ¶
AggregatePublicKeys aggregates a non-zero number of public keys into a single aggregated public key.
func PublicFromSecretKey ¶ added in v1.1.2
PublicFromSecretKey returns the public key associated with sk
func PublicKeyFromCompressedBytes ¶
PublicKeyFromCompressedBytes parses the compressed big-endian format of the public key into a public key.
func PublicKeyFromValidUncompressedBytes ¶
PublicKeyFromValidUncompressedBytes parses the uncompressed big-endian format of the public key into a public key. It is assumed that the provided bytes are valid.
type SecretKey ¶ added in v0.1.3
type SecretKey struct {
// contains filtered or unexported fields
}
Types wrapping the circl BLS types
func NewSecretKey ¶ added in v0.1.3
NewSecretKey generates a new secret key from the local source of cryptographically secure randomness.
func SecretKeyFromBytes ¶ added in v0.1.3
SecretKeyFromBytes parses the big-endian format of the secret key into a secret key.
func (*SecretKey) PublicKey ¶ added in v0.1.3
PublicKey returns the public key associated with the secret key.
func (*SecretKey) Sign ¶ added in v0.1.3
Sign [msg] to authorize that this private key signed [msg].
func (*SecretKey) SignProofOfPossession ¶ added in v0.1.3
SignProofOfPossession signs a [msg] to prove the ownership of this secret key.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Types wrapping the circl BLS types
func AggregateSignatures ¶
AggregateSignatures aggregates a non-zero number of signatures into a single aggregated signature.
func SignProofOfPossession ¶ added in v1.1.2
SignProofOfPossession signs msg to prove ownership of sk
func SignatureFromBytes ¶
SignatureFromBytes parses the compressed big-endian format of the signature into a signature.