File: ec_dh.Rd

package info (click to toggle)
r-cran-openssl 1.2.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,136 kB
  • sloc: ansic: 2,033; sh: 19; makefile: 5
file content (42 lines) | stat: -rw-r--r-- 1,184 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/diffie.R
\name{ec_dh}
\alias{ec_dh}
\title{Diffie-Hellman Key Agreement}
\usage{
ec_dh(key = my_key(), peerkey, password = askpass)
}
\arguments{
\item{key}{your own private key}

\item{peerkey}{the public key from your peer}

\item{password}{passed to \link{read_key} for reading protected private keys}
}
\description{
Key agreement is one-step method of creating a shared secret between two
peers. Both peers can independently derive the joined secret by combining
his or her private key with the public key from the peer.
}
\details{
Currently only Elliptic Curve Diffie Hellman (ECDH) is implemented.
}
\examples{
\dontrun{
# Need two EC keypairs from the same curve
alice_key <- ec_keygen("P-521")
bob_key <- ec_keygen("P-521")

# Derive public keys
alice_pub <- as.list(alice_key)$pubkey
bob_pub <- as.list(bob_key)$pubkey

# Both peers can derive the (same) shared secret via each other's pubkey
ec_dh(alice_key, bob_pub)
ec_dh(bob_key, alice_pub)
}
}
\references{
\url{https://wiki.openssl.org/index.php/EVP_Key_Agreement},
\url{https://wiki.openssl.org/index.php/Elliptic_Curve_Diffie_Hellman}
}