Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKeyPair ¶
func GenerateKeyPair() (*PrivateKey, *PublicKey, error)
generate BLS private and public key pair
func Sign ¶
func Sign(privateKey *PrivateKey, msg []byte) (blsSignature []byte, err error)
BLS signature uses a particular function, defined as: S = pk * H(m)
H is a hash function, for instance SHA256 or SM3. S is the signature. m is the message to sign. pk is the private key, which can be considered as a secret big number.
To verify the signature, check that whether the result of e(P, H(m)) is equal to e(G, S) or not. Which means that: e(P, H(m)) = e(G, S) G is the base point or the generator point. P is the public key = pk*G. e is a special elliptic curve pairing function which has this feature: e(x*P, Q) = e(P, x*Q).
It is true because of the pairing function described above: e(P, H(m)) = e(pk*G, H(m)) = e(G, pk*H(m)) = e(G, S)
Types ¶
type PrivateKey ¶
type PublicKey ¶
type PublicKey struct {
P *bls12_381_ecc.G2Affine
}