type Curve … type PublicKey … // Bytes returns a copy of the encoding of the public key. func (k *PublicKey) Bytes() []byte { … } // Equal returns whether x represents the same public key as k. // // Note that there can be equivalent public keys with different encodings which // would return false from this check but behave the same way as inputs to ECDH. // // This check is performed in constant time as long as the key types and their // curve match. func (k *PublicKey) Equal(x crypto.PublicKey) bool { … } func (k *PublicKey) Curve() Curve { … } type PrivateKey … // ECDH performs an ECDH exchange and returns the shared secret. The [PrivateKey] // and [PublicKey] must use the same curve. // // For NIST curves, this performs ECDH as specified in SEC 1, Version 2.0, // Section 3.3.1, and returns the x-coordinate encoded according to SEC 1, // Version 2.0, Section 2.3.5. The result is never the point at infinity. // // For [X25519], this performs ECDH as specified in RFC 7748, Section 6.1. If // the result is the all-zero value, ECDH returns an error. func (k *PrivateKey) ECDH(remote *PublicKey) ([]byte, error) { … } // Bytes returns a copy of the encoding of the private key. func (k *PrivateKey) Bytes() []byte { … } // Equal returns whether x represents the same private key as k. // // Note that there can be equivalent private keys with different encodings which // would return false from this check but behave the same way as inputs to [ECDH]. // // This check is performed in constant time as long as the key types and their // curve match. func (k *PrivateKey) Equal(x crypto.PrivateKey) bool { … } func (k *PrivateKey) Curve() Curve { … } func (k *PrivateKey) PublicKey() *PublicKey { … } // Public implements the implicit interface of all standard library private // keys. See the docs of [crypto.PrivateKey]. func (k *PrivateKey) Public() crypto.PublicKey { … }