package ecdh
import "crypto/internal/fips140/ecdh"
Index ¶
- func ECDH[P Point[P]](c *Curve[P], k *PrivateKey, peer *PublicKey) ([]byte, error)
- type Curve
- func P224() *Curve[*nistec.P224Point]
- func P256() *Curve[*nistec.P256Point]
- func P384() *Curve[*nistec.P384Point]
- func P521() *Curve[*nistec.P521Point]
- type Point
- type PrivateKey
- func GenerateKey[P Point[P]](c *Curve[P], rand io.Reader) (*PrivateKey, error)
- func NewPrivateKey[P Point[P]](c *Curve[P], key []byte) (*PrivateKey, error)
- func (priv *PrivateKey) Bytes() []byte
- func (priv *PrivateKey) PublicKey() *PublicKey
- type PublicKey
Functions ¶
func ECDH ¶
Types ¶
type Curve ¶
func P224 ¶
func P256 ¶
func P384 ¶
func P521 ¶
type Point ¶
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 ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func GenerateKey ¶
GenerateKey generates a new ECDSA private key pair for the specified curve.
func NewPrivateKey ¶
func NewPrivateKey[P Point[P]](c *Curve[P], key []byte) (*PrivateKey, error)
func (*PrivateKey) Bytes ¶
func (priv *PrivateKey) Bytes() []byte
func (*PrivateKey) PublicKey ¶
func (priv *PrivateKey) PublicKey() *PublicKey
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func NewPublicKey ¶
func (*PublicKey) Bytes ¶
Source Files ¶
- Version
- v1.24.0 (latest)
- Published
- Feb 10, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 25 minutes ago –
Tools for package owners.