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.
ec_dh(key = my_key(), peerkey, password = askpass)
- your own private key
- the public key from your peer
- passed to read_key for reading protected private keys
Currently only Elliptic Curve Diffie Hellman (ECDH) is implemented.
# 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)