openssl (version 0.9.6)

write_pem: Export key or certificate

Description

The write_pem functions exports a key or certificate to the standard base64 PEM format. For private keys it is possible to set a password.

Usage

write_pem(x, path = NULL, password = NULL)

write_der(x, path = NULL)

write_ssh(pubkey, path = NULL)

Arguments

x

a public/private key or certificate object

path

file to write to. If NULL it returns the output as a string.

password

string or callback function to set password (only applicable for private keys).

pubkey

a public key

Examples

Run this code
# NOT RUN {
# Generate RSA keypair
key <- rsa_keygen()
pubkey <- key$pubkey

# Write to output formats
write_ssh(pubkey)
write_pem(pubkey)
write_pem(key, password = "super secret")
# }

Run the code above in your browser using DataCamp Workspace