ECDH
Elliptic Curve Diffie-Hellman (ECDH) key agreement as defined in NIST SP 800-56A.
ECDH allows two parties to establish a shared secret over an insecure channel using elliptic curve keys. Each party generates a key pair on the same EC.Curve, then computes the shared secret using their own private key and the other party's public key.
val aliceKeys = provider.get(ECDH).keyPairGenerator(EC.Curve.P256).generateKey()
val bobKeys = provider.get(ECDH).keyPairGenerator(EC.Curve.P256).generateKey()
val sharedSecret = aliceKeys.privateKey.sharedSecretGenerator().generateSharedSecret(bobKeys.publicKey)The raw shared secret output should not be used directly as a key. Use a key derivation function like HKDF to derive actual keys from the shared secret.
For key agreement using Montgomery curves, see XDH.
Types
An ECDH private key that provides shared secret computation via sharedSecretGenerator.
An ECDH public key that provides shared secret computation via sharedSecretGenerator.
Properties
The typed identifier that uniquely distinguishes this algorithm and is used to look it up from a CryptographyProvider.
Functions
Returns a KeyGenerator that generates EC key pairs on the given curve.
Returns a Decoder that decodes EC private keys on the given curve from the specified PrivateKey.Format.
Returns a Decoder that decodes EC public keys on the given curve from the specified PublicKey.Format.