Documentation ¶
Index ¶
- Variables
- func AggregatePublickKeys(pubs [][]byte) ([]byte, error)
- func AggregateSignatures(sigs [][]byte) ([]byte, error)
- func ClearCache()
- func CompressPublicKey(p PublicKey) []byte
- func LoadPublicKeyIntoCache(publicKey []byte, validate bool) error
- func SetEnabledCaching(caching bool)
- func Verify(signature []byte, msg []byte, publicKeyBytes []byte) (bool, error)
- func VerifyAggregate(signature []byte, msg []byte, publicKeysBytes [][]byte) (bool, error)
- func VerifyMultipleSignatures(sigs [][]byte, msgs [][]byte, pubKeys [][]byte) (bool, error)
- type PrivateKey
- type PublicKey
- type Signature
Constants ¶
This section is empty.
Variables ¶
var ( // Private key errors ErrZeroPrivateKey = errors.New("bls(private): zero key") ErrDeserializePrivateKey = errors.New("bls(private): could not deserialize") // Public key errors ErrDeserializePublicKey = errors.New("bls(public): could not deserialize") ErrInfinitePublicKey = errors.New("bls(public): infinity") // Signature errors ErrDeserializeSignature = errors.New("bls(signature): could not deserialize") ErrNotGroupSignature = errors.New("bls(signature): signature is not in group") ErrNoSignaturesToAggregate = errors.New("bls(signature): no signatures to aggregate") // Caching Errors ErrCacheNotEnabled = errors.New("cache(): cache not enabled") )
var InfiniteSignature = [96]byte{0xC0}
InfiniteSignature represents an infinite signature (G2 Point at Infinity).
Functions ¶
func AggregatePublickKeys ¶
func AggregateSignatures ¶
func ClearCache ¶
func ClearCache()
func CompressPublicKey ¶
func LoadPublicKeyIntoCache ¶
func SetEnabledCaching ¶
func SetEnabledCaching(caching bool)
func VerifyAggregate ¶
VerifyAggregate verify signature against many public keys.
func VerifyMultipleSignatures ¶
VerifyMultipleSignatures verifies a non-singular set of signatures and its respective pubkeys and messages. This method provides a safe way to verify multiple signatures at once. We pick a number randomly from 1 to max uint64 and then multiply the signature by it. We continue doing this for all signatures and its respective pubkeys. S* = S_1 * r_1 + S_2 * r_2 + ... + S_n * r_n P'_{i,j} = P_{i,j} * r_i e(S*, G) = \prod_{i=1}^n \prod_{j=1}^{m_i} e(P'_{i,j}, M_{i,j}) Using this we can verify multiple signatures safely.
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey defines a BLS private key.
func GenerateKey ¶
func GenerateKey() (*PrivateKey, error)
GenerateKey creates a new random private key.
func NewPrivateKeyFromBytes ¶
func NewPrivateKeyFromBytes(privKey []byte) (*PrivateKey, error)
PrivateKeyFromBytes creates a BLS private key from bytes.
func (*PrivateKey) Bytes ¶
func (p *PrivateKey) Bytes() []byte
func (*PrivateKey) PublicKey ¶
func (p *PrivateKey) PublicKey() PublicKey
PublicKey retrieve public key from the private key.
type PublicKey ¶
PublicKey wraps the CGO object of the BLST library and give us easy access to its methods.
func NewPublicKeyFromBytes ¶
NewPublicKeyFromBytes Derive new public key from a 48 long byte slice.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature wraps CGO object repressenting the signature.
func NewSignatureFromBytes ¶
NewSignatureFromBytes creates a new signature from a 96 bytes long slice.