Documentation ¶
Index ¶
- Variables
- func CompressPubkey(x, y *big.Int) []byte
- func DecompressPubkey(pubkey []byte) (x, y *big.Int)
- func RecoverPubkey(msg []byte, sig []byte) ([]byte, error)
- func S256() *secp256k1.BitCurve
- func Sign(msg []byte, seckey []byte) ([]byte, error)
- func VerifySignature(pubkey, msg, signature []byte) bool
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidMsgLen = secp256k1.ErrInvalidMsgLen ErrInvalidSignatureLen = secp256k1.ErrInvalidSignatureLen ErrInvalidRecoveryID = secp256k1.ErrInvalidRecoveryID ErrInvalidKey = secp256k1.ErrInvalidKey ErrInvalidPubkey = secp256k1.ErrInvalidPubkey ErrSignFailed = secp256k1.ErrSignFailed ErrRecoverFailed = secp256k1.ErrRecoverFailed )
Functions ¶
func CompressPubkey ¶
CompressPubkey encodes a public key to 33-byte compressed format.
func DecompressPubkey ¶
DecompressPubkey parses a public key in the 33-byte compressed format. It returns non-nil coordinates if the public key is valid.
func RecoverPubkey ¶
RecoverPubkey returns the public key of the signer. msg must be the 32-byte hash of the message to be signed. sig must be a 65-byte compact ECDSA signature containing the recovery id as the last element.
func Sign ¶
Sign creates a recoverable ECDSA signature. The produced signature is in the 65-byte [R || S || V] format where V is 0 or 1.
The caller is responsible for ensuring that msg cannot be chosen directly by an attacker. It is usually preferable to use a cryptographic hash function on any input before handing it to this function.
func VerifySignature ¶
VerifySignature checks that the given pubkey created signature over message. The signature should be in [R || S] format.
Types ¶
This section is empty.