package

ecdh

crypto/internal/fips140/v1.0.0/ecdh

Functions

ECDHsource

func ECDH[P Point[P]](c *Curve[P], k *PrivateKey, peer *PublicKey) ([]byte, error)

type Curve source

type Curve[P Point[P]] struct {
	N []byte
	// contains filtered or unexported fields
}

Constructors

type Point source

type Point[P any] interface {
	*nistec.P224Point | *nistec.P256Point | *nistec.P384Point | *nistec.P521Point
	Bytes() []byte
	BytesX() ([]byte, error)
	SetBytes([]byte) (P, error)
	ScalarMult(P, []byte) (P, error)
	ScalarBaseMult([]byte) (P, error)
}

Point is a generic constraint for the nistec Point types.

type PrivateKey source

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

Constructors

GenerateKeysource

func GenerateKey[P Point[P]](c *Curve[P], rand io.Reader) (*PrivateKey, error)

GenerateKey generates a new ECDSA private key pair for the specified curve.

NewPrivateKeysource

func NewPrivateKey[P Point[P]](c *Curve[P], key []byte) (*PrivateKey, error)

Methods

type PublicKey source

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

Constructors

NewPublicKeysource

func NewPublicKey[P Point[P]](c *Curve[P], key []byte) (*PublicKey, error)

Methods