Movatterモバイル変換


[0]ホーム

URL:


ecdsa

packagestandard library
go1.25.2Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2025 License:BSD-3-ClauseImports:12Imported by:0

Details

Repository

cs.opensource.google/go/go

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcTestingOnlyNewDRBG

func TestingOnlyNewDRBG[Hhash.Hash](hash func() H, entropy, nonce []byte, s []byte) *hmacDRBG

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

func Verify[PPoint[P]](c *Curve[P], pub *PublicKey, hash []byte, sig *Signature)error

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

typeCurve

type Curve[PPoint[P]] struct {N *bigmod.Modulus// contains filtered or unexported fields}

funcP224

func P224() *Curve[*nistec.P224Point]

funcP256

func P256() *Curve[*nistec.P256Point]

funcP384

func P384() *Curve[*nistec.P384Point]

funcP521

func P521() *Curve[*nistec.P521Point]

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

func GenerateKey[PPoint[P]](c *Curve[P], randio.Reader) (*PrivateKey,error)

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

typePublicKey

type PublicKey struct {// contains filtered or unexported fields}

funcNewPublicKey

func NewPublicKey[PPoint[P]](c *Curve[P], Q []byte) (*PublicKey,error)

func (*PublicKey)Bytes

func (pub *PublicKey) Bytes() []byte

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.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp