ec_dh

0th

Percentile

Diffie-Hellman Key Agreement

Key agreement is one-step method of creating a shared secret between two peers. Both peers can indendently derive the joined secret by combining his or her private key with the public key from the peer.

Usage
ec_dh(key = my_key(), peerkey, password = askpass)
Arguments
key
your own private key
peerkey
the public key from your peer
password
passed to read_key for reading protected private keys
Details

Currently only Elliptic Curve Diffie Hellman (ECDH) is implemented.

References

https://wiki.openssl.org/index.php/EVP_Key_Agreement, https://wiki.openssl.org/index.php/Elliptic_Curve_Diffie_Hellman

Aliases
  • ec_dh
Examples
# Need two EC keypairs from the same curve
sk1 <- ec_keygen()
pk1 <- as.list(sk1)$pubkey

sk2 <- ec_keygen()
pk2 <- as.list(sk2)$pubkey

# Both peers can derive the shared secret
alice <- ec_dh(sk1, pk2)
bob <- ec_dh(sk2, pk1)
Documentation reproduced from package openssl, version 0.9.1, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.