Documentation ¶
Index ¶
- func CalculateAntiRogueCoefficients(pubs []PublicKey) []big.Int
- func Decrypt(encrypted []byte, passphrase string) (decrypted []byte, err error)
- func GenerateRandomKey() (PrivateKey, PublicKey)
- func MarshalBitmask(mask *big.Int) []byte
- func UnmarshalBitmask(data []byte) *big.Int
- func ZeroMultisigMask() *big.Int
- type Multisig
- type PrivateKey
- func (blsKey *PrivateKey) Encrypt(passphrase string) (string, error)
- func (secretKey PrivateKey) GenerateMembershipKeyPart(index byte, aggPub PublicKey, anticoef big.Int) Signature
- func (secretKey PrivateKey) Marshal() []byte
- func (secretKey PrivateKey) MarshalJSON() ([]byte, error)
- func (secretKey PrivateKey) Multisign(message []byte, aggPublicKey PublicKey, membershipKey Signature) Signature
- func (priv PrivateKey) Public() crypto.PublicKey
- func (priv PrivateKey) PublicKey() PublicKey
- func (secretKey PrivateKey) Sign(message []byte) Signature
- func (secretKey *PrivateKey) UnmarshalJSON(data []byte) error
- type PublicKey
- type Signature
- func (signature Signature) Aggregate(onemore Signature) Signature
- func (signature Signature) Marshal() []byte
- func (signature Signature) MarshalJSON() ([]byte, error)
- func (signature *Signature) UnmarshalJSON(data []byte) error
- func (signature Signature) Verify(publicKey PublicKey, message []byte) bool
- func (signature Signature) VerifyMembershipKeyPart(aggPublicKey PublicKey, partPublicKey PublicKey, anticoef big.Int, index byte) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateAntiRogueCoefficients ¶
CalculateAntiRogueCoefficients returns an array of bigints used for subsequent key aggregations:
Ai = hash(Pi, {P1, P2, ...})
func GenerateRandomKey ¶
func GenerateRandomKey() (PrivateKey, PublicKey)
GenerateRandomKey creates a random private and its corresponding public keys
func MarshalBitmask ¶ added in v0.1.3
func UnmarshalBitmask ¶ added in v0.1.3
func ZeroMultisigMask ¶ added in v0.1.3
ZeroMultisigMask returns zero bitmask
Types ¶
type Multisig ¶ added in v0.1.3
type Multisig struct { PartSignature Signature // aggregated partial signature PartPublicKey PublicKey // aggregated partial public key PartMask *big.Int // bitmask of participants }
Multisig is a BLS multisignature proof that anyone may provide to convince the verifier that the listed nodes has signed the message
func NewZeroMultisig ¶ added in v0.1.3
func NewZeroMultisig() Multisig
NewZeroMultisig returns zero multisignature
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func ReadPrivateKey ¶ added in v0.1.3
func ReadPrivateKey(str string) (PrivateKey, error)
func UnmarshalPrivateKey ¶
func UnmarshalPrivateKey(data []byte) (PrivateKey, error)
UnmarshalBlsPrivateKey reads the private key from the given byte array
func (*PrivateKey) Encrypt ¶ added in v0.1.2
func (blsKey *PrivateKey) Encrypt(passphrase string) (string, error)
Encrypt - encrypts a BLS PrivateKey with a given passphrase
func (PrivateKey) GenerateMembershipKeyPart ¶
func (secretKey PrivateKey) GenerateMembershipKeyPart(index byte, aggPub PublicKey, anticoef big.Int) Signature
GenerateMembershipKeyPart generates the participant signature to be aggregated into membership key
func (PrivateKey) Marshal ¶
func (secretKey PrivateKey) Marshal() []byte
func (PrivateKey) MarshalJSON ¶
func (secretKey PrivateKey) MarshalJSON() ([]byte, error)
func (PrivateKey) Multisign ¶
func (secretKey PrivateKey) Multisign(message []byte, aggPublicKey PublicKey, membershipKey Signature) Signature
Multisign generates BLS multi-signature of the given message, aggregated public key of all participants and the membership key of the signer
func (PrivateKey) Public ¶ added in v0.1.2
func (priv PrivateKey) Public() crypto.PublicKey
PublicKey calculates public key corresponding to the given private key
func (PrivateKey) PublicKey ¶
func (priv PrivateKey) PublicKey() PublicKey
func (PrivateKey) Sign ¶
func (secretKey PrivateKey) Sign(message []byte) Signature
Sign generates a simple BLS signature of the given message
func (*PrivateKey) UnmarshalJSON ¶
func (secretKey *PrivateKey) UnmarshalJSON(data []byte) error
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func AggregatePublicKeys ¶
AggregatePublicKeys calculates P1*A1 + P2*A2 + ...
func ReadPublicKey ¶ added in v0.1.3
func UnmarshalPublicKey ¶
func ZeroPublicKey ¶
func ZeroPublicKey() PublicKey
ZeroPublicKey returns zero public key (point at infinity)
func (PublicKey) MarshalJSON ¶
func (*PublicKey) UnmarshalJSON ¶
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
func AggregateSignatures ¶
AggregateSignatures sums the given array of signatures
func HashToPointIndex ¶
func ReadSignature ¶ added in v0.1.3
func UnmarshalSignature ¶
func ZeroSignature ¶
func ZeroSignature() Signature
ZeroSignature returns zero signature (point at infinity)
func (Signature) MarshalJSON ¶
func (*Signature) UnmarshalJSON ¶
func (Signature) Verify ¶
Verify checks the BLS signature of the message against the public key of its signer
func (Signature) VerifyMembershipKeyPart ¶
func (signature Signature) VerifyMembershipKeyPart(aggPublicKey PublicKey, partPublicKey PublicKey, anticoef big.Int, index byte) bool
VerifyMembershipKeyPart verifies membership key part i ((a⋅pk)×H(P, i)) against aggregated public key (P) and public key of the party (pk×G)