Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidMsgLen = errors.New("invalid message length, need 32 bytes") ErrInvalidSignatureLen = errors.New("invalid signature length") ErrInvalidRecoveryID = errors.New("invalid signature recovery id") ErrInvalidKey = errors.New("invalid private key") ErrInvalidPubkey = errors.New("invalid public key") ErrSignFailed = errors.New("signing failed") ErrRecoverFailed = errors.New("recovery failed") )
Functions ¶
func RecoverPubkey ¶
RecoverPubkey returns the 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 ¶
type Secp256k1BoundProcessor ¶
type Secp256k1BoundProcessor struct {
// contains filtered or unexported fields
}
func NewSecp256k1BoundProcessor ¶
func NewSecp256k1BoundProcessor() *Secp256k1BoundProcessor
func (*Secp256k1BoundProcessor) RecoverPubkey ¶
func (ctx *Secp256k1BoundProcessor) RecoverPubkey(msg []byte, sig []byte) ([]byte, error)
RecoverPubkey returns the 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 (*Secp256k1BoundProcessor) Sign ¶
func (ctx *Secp256k1BoundProcessor) Sign(msg []byte, seckey []byte) ([]byte, error)
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 (*Secp256k1BoundProcessor) VerifySignature ¶
func (ctx *Secp256k1BoundProcessor) VerifySignature(pubkey, msg, signature []byte) bool
VerifySignature checks that the given pubkey created signature over message. The signature should be in [R || S] format.
type Secp256k1WorkerPool ¶
type Secp256k1WorkerPool struct { Concurrency int // contains filtered or unexported fields }
var WorkerPool Secp256k1WorkerPool