ssh_keygen {cyphr} | R Documentation |
Create ssh keypairs
Description
Create openssl key pairs in the manner of ssh-keygen
(1).
In general this should not be used (generate keys yourself with
ssh-keygen
at the command line. However this is useful for
testing and demonstration so I have included it to make that
easier. Once a keypair has been generated it can be used with
keypair_openssl()
.
Usage
ssh_keygen(path = tempfile(), password = TRUE, use_shell = FALSE)
Arguments
path |
A directory in which to create a keypair. If the path does not exist it will be created. |
password |
The password for the key. The default will prompt
interactively (but without echoing the password). Other valid
options are |
use_shell |
Try to use |
Value
The path
, invisibly. This is useful in the case
where path
is tempfile()
.
Examples
# Generate a new key in a temporary directory:
path <- cyphr::ssh_keygen(password = FALSE)
dir(path) # will contain id_rsa and id_rsa.pub
# This key can now be used via keypair_openssl:
key <- cyphr::keypair_openssl(path, path)
secret <- cyphr::encrypt_string("hello", key)
cyphr::decrypt_string(secret, key)
# Cleanup
unlink(path, recursive = TRUE)