1 // Copyright (c) 2020-2023 The Decred developers
2 // Use of this source code is governed by an ISC
3 // license that can be found in the LICENSE file.
4 5 // Package ecdsa provides secp256k1-optimized ECDSA signing and verification.
6 //
7 // This package provides data structures and functions necessary to produce and
8 // verify deterministic canonical signatures in accordance with RFC6979 and
9 // BIP0062, optimized specifically for the secp256k1 curve using the Elliptic Curve
10 // Digital Signature Algorithm (ECDSA), as defined in FIPS 186-3. See
11 // https://www.secg.org/sec2-v2.pdf for details on the secp256k1 standard.
12 //
13 // It also provides functions to parse and serialize the ECDSA signatures with the
14 // more strict Distinguished Encoding Rules (DER) of ISO/IEC 8825-1 and some
15 // additional restrictions specific to secp256k1.
16 //
17 // In addition, it supports a custom "compact" signature format which allows
18 // efficient recovery of the public key from a given valid signature and message
19 // hash combination.
20 //
21 // A comprehensive suite of tests is provided to ensure proper functionality.
22 //
23 // # ECDSA use in Decred
24 //
25 // At the time of this writing, ECDSA signatures are heavily used for proving coin
26 // ownership in Decred as the vast majority of transactions consist of what is
27 // effectively transferring ownership of coins to a public key associated with a
28 // secret key only known to the recipient of the coins along with an encumbrance
29 // that requires an ECDSA signature that proves the new owner possesses the secret
30 // key without actually revealing it.
31 //
32 // # Errors
33 //
34 // The errors returned by this package are of type ecdsa.Error and fully support
35 // the standard library errors.Is and errors.As functions. This allows the caller
36 // to programmatically determine the specific error by examining the ErrorKind
37 // field of the type asserted ecdsa.Error while still providing rich error messages
38 // with contextual information. See ErrorKind in the package documentation for a
39 // full list.
40 package ecdsa
41