...
1ecdsa
2=====
3
4[](https://github.com/decred/dcrd/actions)
5[](http://copyfree.org)
6[](https://pkg.go.dev/github.com/decred/dcrd/dcrec/secp256k1/v4/ecdsa)
7
8Package ecdsa provides secp256k1-optimized ECDSA signing and verification.
9
10This package provides data structures and functions necessary to produce and
11verify deterministic canonical signatures in accordance with RFC6979 and
12BIP0062, optimized specifically for the secp256k1 curve using the Elliptic Curve
13Digital Signature Algorithm (ECDSA), as defined in FIPS 186-3. See
14https://www.secg.org/sec2-v2.pdf for details on the secp256k1 standard.
15
16It also provides functions to parse and serialize the ECDSA signatures with the
17more strict Distinguished Encoding Rules (DER) of ISO/IEC 8825-1 and some
18additional restrictions specific to secp256k1.
19
20In addition, it supports a custom "compact" signature format which allows
21efficient recovery of the public key from a given valid signature and message
22hash combination.
23
24A comprehensive suite of tests is provided to ensure proper functionality.
25
26## ECDSA use in Decred
27
28At the time of this writing, ECDSA signatures are heavily used for proving coin
29ownership in Decred as the vast majority of transactions consist of what is
30effectively transferring ownership of coins to a public key associated with a
31private key only known to the recipient of the coins along with an encumbrance
32that requires an ECDSA signature that proves the new owner possesses the private
33key without actually revealing it.
34
35## Installation and Updating
36
37This package is part of the `github.com/decred/dcrd/dcrec/secp256k1/v4` module.
38Use the standard go tooling for working with modules to incorporate it.
39
40## Examples
41
42* [Sign Message](https://pkg.go.dev/github.com/decred/dcrd/dcrec/secp256k1/v4/ecdsa#example-package-SignMessage)
43 Demonstrates signing a message with a secp256k1 private key that is first
44 parsed from raw bytes and serializing the generated signature.
45
46* [Verify Signature](https://pkg.go.dev/github.com/decred/dcrd/dcrec/secp256k1/v4/ecdsa#example-Signature.Verify)
47 Demonstrates verifying a secp256k1 signature against a public key that is
48 first parsed from raw bytes. The signature is also parsed from raw bytes.
49
50## License
51
52Package ecdsa is licensed under the [copyfree](http://copyfree.org) ISC License.
View as plain text