keygen

0th

Percentile

Generate Key pair

The keygen functions generate a random private key. Use as.list(key)$pubkey to derive the corresponding public key. Use write_pem to save a private key to a file, optionally with a password.

Usage
rsa_keygen(bits = 2048)

dsa_keygen(bits = 1024)

ec_keygen(curve = c("P-256", "P-384", "P-521"))

Arguments
bits

bitsize of the generated RSA/DSA key

curve

which NIST curve to use

Aliases
  • keygen
  • rsa_keygen
  • dsa_keygen
  • ec_keygen
Examples
# NOT RUN {
# Generate keypair
key <- rsa_keygen()
pubkey <- as.list(key)$pubkey

# Write/read the key with a passphrase
write_pem(key, "id_rsa", password = "supersecret")
read_key("id_rsa", password = "supersecret")
# }
Documentation reproduced from package openssl, version 1.1, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.