Documentation ¶
Overview ¶
Package ecdh implements key agreement algorithm ECDH for COSE as defined in RFC9053. https://datatracker.ietf.org/doc/html/rfc9053#name-direct-key-agreement.
Index ¶
- func CheckKey(k key.Key) error
- func GenerateKey(crv int) (key.Key, error)
- func KeyFromPrivate(pk *goecdh.PrivateKey) (key.Key, error)
- func KeyFromPublic(pk *goecdh.PublicKey) (key.Key, error)
- func KeyToPrivate(k key.Key) (*goecdh.PrivateKey, error)
- func KeyToPublic(k key.Key) (*goecdh.PublicKey, error)
- func ToCompressedKey(k key.Key) (key.Key, error)
- func ToPublicKey(k key.Key) (key.Key, error)
- type ECDHer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
GenerateKey generates a new Key with given curve for ECDH. crv is one of the iana.EllipticCurve* constants.
func KeyFromPrivate ¶
func KeyFromPrivate(pk *goecdh.PrivateKey) (key.Key, error)
KeyFromPrivate returns a private Key with given ecdh.PrivateKey.
func KeyFromPublic ¶
KeyFromPublic returns a public Key with given ecdh.PublicKey.
func KeyToPrivate ¶
func KeyToPrivate(k key.Key) (*goecdh.PrivateKey, error)
KeyToPrivate returns a *ecdh.PrivateKey for the given Key.
func KeyToPublic ¶
KeyToPublic returns a *ecdh.PublicKey for the given key.Key.
func ToCompressedKey ¶
ToCompressedKey converts the given key to a compressed Key. It can be used in Recipient.
Types ¶
type ECDHer ¶
type ECDHer struct {
// contains filtered or unexported fields
}
func (*ECDHer) ECDH ¶
ECDH performs a ECDH exchange and returns the shared secret. The PrivateKey and PublicKey must use the same curve. https://pkg.go.dev/crypto/ecdh#PrivateKey.ECDH