Documentation
¶
Overview ¶
Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as defined in https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
PrivateKey represents an ECDSA private key.
func GenerateKey ¶
func GenerateKey(c elliptic.Curve, passphrase string) *PrivateKey
GenerateKey generates a public and private key pair from the passphrase.
func GenerateKeyFromSecret ¶
func GenerateKeyFromSecret(c elliptic.Curve, secret *big.Int) *PrivateKey
func (*PrivateKey) Sign ¶
func (priv *PrivateKey) Sign(sighash []byte) *Signature
Sign computes the signature pair r and s from D and msgDigest.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature represents an ECDSA signature.
func (*Signature) Marshal ¶
Marshal encodes sig in DER format.
DER has the following format: 0x30 [total-length] 0x02 [r-length] [r] 0x02 [s-length] [s]
total-length: 1-byte length descriptor of everything that follows. r-length: 1-byte length descriptor of the r value that follows. r: arbitrary-length big-endian encoded r value. It cannot start with any 0x00 bytes, unless the first byte that follows is 0x80 or higher, in which case a single 0x00 is required. s-length: 1-byte length descriptor of the s value that follows. s: arbitrary-length big-endian encoded s value. The same rules apply as for r.