exth_crypto v0.1.6 ExthCrypto.ECIES.ECDH
Implements Elliptic Curve Diffie-Hellman, as it pertains to Exthereum.
Link to this section Summary
Functions
Generates a static shared secret between two parties according to the protocol for elliptic curve diffie hellman
Generates a new keypair for elliptic curve diffie-hellman
Link to this section Functions
Link to this function
new_ecdh_keypair(curve \\ :secp256k1)
new_ecdh_keypair(ExthCrypto.named_curve()) :: ExthCrypto.Key.keypair()
Generates a new keypair for elliptic curve diffie-hellman.
These keys should be used as ephemeral keys in the key-exchange protocol.
Examples
iex> {public_key, private_key} = ExthCrypto.ECIES.ECDH.new_ecdh_keypair()
iex> byte_size(public_key)
65
iex> byte_size(private_key)
32
iex> {public_key, private_key} == :crypto.generate_key(:ecdh, :secp256k1, private_key)
true