ecdsa
packagestandard libraryThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
funcTestingOnlyNewDRBG¶
TestingOnlyNewDRBG creates an SP 800-90A Rev. 1 HMAC_DRBG with a plainpersonalization string.
This should only be used for ACVP testing. hmacDRBG is not intended to beused directly.
funcVerify¶
Verify verifies the signature, sig, of hash (which should be the result ofhashing a larger message) using the public key, pub. If the hash is longerthan the bit-length of the private key's curve order, the hash will betruncated to that length.
The inputs are not considered confidential, and may leak through timing sidechannels, or if an attacker has control of part of the inputs.
Types¶
typePoint¶
type Point[Pany] interface {*nistec.P224Point | *nistec.P256Point | *nistec.P384Point | *nistec.P521PointBytes() []byteBytesX() ([]byte,error)SetBytes([]byte) (P,error)ScalarMult(P, []byte) (P,error)ScalarBaseMult([]byte) (P,error)Add(p1, p2 P) P}
Point is a generic constraint for thenistec Point types.
typePrivateKey¶
type PrivateKey struct {// contains filtered or unexported fields}
funcGenerateKey¶
GenerateKey generates a new ECDSA private key pair for the specified curve.
funcNewPrivateKey¶
func NewPrivateKey[PPoint[P]](c *Curve[P], D, Q []byte) (*PrivateKey,error)
func (*PrivateKey)Bytes¶
func (priv *PrivateKey) Bytes() []byte
func (*PrivateKey)PublicKey¶
func (priv *PrivateKey) PublicKey() *PublicKey
typeSignature¶
type Signature struct {R, S []byte}
Signature is an ECDSA signature, where r and s are represented as big-endianbyte slices of the same length as the curve order.
funcSign¶
func Sign[PPoint[P], Hhash.Hash](c *Curve[P], h func() H, priv *PrivateKey, randio.Reader, hash []byte) (*Signature,error)
Sign signs a hash (which shall be the result of hashing a larger message withthe hash function H) using the private key, priv. If the hash is longer thanthe bit-length of the private key's curve order, the hash will be truncatedto that length.
funcSignDeterministic¶
func SignDeterministic[PPoint[P], Hhash.Hash](c *Curve[P], h func() H, priv *PrivateKey, hash []byte) (*Signature,error)
SignDeterministic signs a hash (which shall be the result of hashing alarger message with the hash function H) using the private key, priv. If thehash is longer than the bit-length of the private key's curve order, the hashwill be truncated to that length. This applies Deterministic ECDSA asspecified in FIPS 186-5 andRFC 6979.