Documentation ¶
Index ¶
- Variables
- func AltbnBlake2b(message []byte) (p1, p2 *big.Int)
- func AltbnKang12(message []byte) (p1, p2 *big.Int)
- func AltbnKeccak3(message []byte) (p1, p2 *big.Int)
- func AltbnSha3(message []byte) (p1, p2 *big.Int)
- func CheckAuthentication(curve CurveSystem, v Point2, authentication Point1) bool
- func CheckAuthenticationCustHash(curve CurveSystem, v Point2, authentication Point1, hash func([]byte) Point1) bool
- func EthereumSum256(data []byte) (digest [32]byte)
- func Verify(curve CurveSystem, pubKey Point2, m []byte, sig Point1) bool
- func VerifyAggregateSignature(curve CurveSystem, aggsig Point1, keys []Point2, msgs [][]byte, ...) bool
- func VerifyCustHash(curve CurveSystem, pubKey Point2, m []byte, sig Point1, ...) bool
- func VerifyMultiSignature(curve CurveSystem, aggsig Point1, keys []Point2, msg []byte) bool
- type AggSig
- type CurveSystem
- type MultiSig
- type Point1
- func AggregateG1(sigs []Point1) Point1
- func Authenticate(curve CurveSystem, sk *big.Int) Point1
- func AuthenticateCustHash(curve CurveSystem, sk *big.Int, hash func([]byte) Point1) Point1
- func Sign(curve CurveSystem, sk *big.Int, m []byte) Point1
- func SignCustHash(sk *big.Int, m []byte, hash func([]byte) Point1) Point1
- type Point2
- type PointT
Constants ¶
This section is empty.
Variables ¶
var Altbn128 = &altbn128{}
Altbn128Inst is the instance for the altbn128 curve, with all of its functions.
Functions ¶
func AltbnBlake2b ¶
AltbnBlake2b Hashes a message to a point on Altbn128 using Blake2b and try and increment The return value is the x,y affine coordinate pair.
func AltbnKang12 ¶
AltbnKang12 Hashes a message to a point on Altbn128 using Blake2b and try and increment The return value is the x,y affine coordinate pair.
func AltbnKeccak3 ¶
AltbnKeccak3 Hashes a message to a point on Altbn128 using Keccak3 and try and increment Keccak3 is only for compatability with Ethereum hashing. The return value is the x,y affine coordinate pair.
func AltbnSha3 ¶
AltbnSha3 Hashes a message to a point on Altbn128 using SHA3 and try and increment The return value is the x,y affine coordinate pair.
func CheckAuthentication ¶
func CheckAuthentication(curve CurveSystem, v Point2, authentication Point1) bool
CheckAuthentication verifies that this Point2 is valid
func CheckAuthenticationCustHash ¶ added in v0.2.0
func CheckAuthenticationCustHash(curve CurveSystem, v Point2, authentication Point1, hash func([]byte) Point1) bool
CheckAuthenticationCustHash verifies that this Point2 is valid, with the specified hash function
func EthereumSum256 ¶
EthereumSum256 returns the Keccak3-256 digest of the data. This is because Ethereum uses a non-standard hashing algo.
func Verify ¶
func Verify(curve CurveSystem, pubKey Point2, m []byte, sig Point1) bool
Verify checks that a signature is valid
func VerifyAggregateSignature ¶
func VerifyAggregateSignature(curve CurveSystem, aggsig Point1, keys []Point2, msgs [][]byte, allowDuplicates bool) bool
VerifyAggregateSignature verifies that the aggregated signature proves that all messages were signed by associated keys Will fail under duplicate messages, unless allow duplicates is True.
func VerifyCustHash ¶ added in v0.2.0
func VerifyCustHash(curve CurveSystem, pubKey Point2, m []byte, sig Point1, hash func([]byte) Point1) bool
VerifyCustHash checks that a signature is valid with the supplied hash function
func VerifyMultiSignature ¶
func VerifyMultiSignature(curve CurveSystem, aggsig Point1, keys []Point2, msg []byte) bool
VerifyMultiSignature checks that the aggregate signature correctly proves that a single message has been signed by a set of keys, vulnerable against chosen key attack, if keys have not been authenticated
Types ¶
type AggSig ¶
type AggSig struct {
// contains filtered or unexported fields
}
AggSig holds paired sequences of keys and messages, and one signature
func (AggSig) Verify ¶
func (a AggSig) Verify(curve CurveSystem) bool
Verify checks that all messages were signed by associated keys Will fail under duplicate messages
type CurveSystem ¶ added in v0.2.0
type CurveSystem interface { MakeG1Point(*big.Int, *big.Int) (Point1, bool) UnmarshalG1([]byte) (Point1, bool) UnmarshalG2([]byte) (Point2, bool) UnmarshalGT([]byte) (PointT, bool) GetG1() Point1 GetG2() Point2 GetGT() PointT HashToG1(message []byte) Point1 // contains filtered or unexported methods }
CurveSystem is a set of parameters and functions for a pairing based cryptosystem It has everything necessary to support all bgls functionality which we use.
type MultiSig ¶
type MultiSig struct {
// contains filtered or unexported fields
}
MultiSig holds set of keys and one message plus signature
func (MultiSig) Verify ¶
func (m MultiSig) Verify(curve CurveSystem) bool
Verify checks that a single message has been signed by a set of keys vulnerable against chosen key attack, if keys have not been authenticated
type Point1 ¶ added in v0.2.0
type Point1 interface { Add(Point1) (Point1, bool) Copy() Point1 Equals(Point1) bool Marshal() []byte Mul(*big.Int) Point1 Pair(Point2) (PointT, bool) ToAffineCoords() (*big.Int, *big.Int) }
Point1 is a way to represent a point on G1, in the first elliptic curve.
func AggregateG1 ¶ added in v0.3.0
AggregateG1 takes the sum of points on G1. This is used to convert a set of signatures into a single signature
func Authenticate ¶
func Authenticate(curve CurveSystem, sk *big.Int) Point1
Authenticate generates an Authentication for a valid *big.Int/Point2 combo It signs a verification key with x.
func AuthenticateCustHash ¶ added in v0.2.0
AuthenticateCustHash generates an Authentication for a valid *big.Int/Point2 combo It signs a verification key with x. This runs with the specified hash function.
type Point2 ¶ added in v0.2.0
type Point2 interface { Add(Point2) (Point2, bool) Copy() Point2 Equals(Point2) bool Marshal() []byte Mul(*big.Int) Point2 ToAffineCoords() (*big.Int, *big.Int, *big.Int, *big.Int) }
Point2 is a way to represent a point on G2, in the first elliptic curve.
func AggregateG2 ¶ added in v0.3.0
AggregateG2 takes the sum of points on G2. This is used to sum a set of public keys for the multisignature
func KeyGen ¶
func KeyGen(curve CurveSystem) (*big.Int, Point2, error)
KeyGen generates a *big.Int and Point2
func LoadPublicKey ¶ added in v0.3.0
func LoadPublicKey(curve CurveSystem, sk *big.Int) Point2
LoadPublicKey turns secret key into a public key of type Point2