powered by
This function generates an RSA key pair (public and private) and saves them to specified files.
generate_rsa_keys(path, ..., password = NULL, which = "public", prefix = NULL)
A character string representing the file path of the generated key (either public or private, based on the which argument).
which
A character string specifying the directory path where the key files in .pem format should be saved.
.pem
Additional arguments passed to the openssl::rsa_keygen() function, such as key size.
openssl::rsa_keygen()
A character string specifying the password for the private key. If NULL, the private key will not be encrypted.
NULL
A character string specifying which key to return. Can be either "public" or "private". Default is "public".
"public"
"private"
A character string used as a prefix for the key file names. Defaults to NULL, which will result in no prefix.
# Generate both public and private RSA keys and save them to the temp directory path_to <- tempdir() generate_rsa_keys(path = path_to, password = "securepassword")
Run the code above in your browser using DataLab