ssh_keygen

0th

Percentile

Create ssh keypairs

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 FALSE (no password) or a string.

use_shell

Try to use ssh-keygen (the shell utility) rather than functions in the openssl package. This will be necessary on at least very old versions of OS/X (Yosemite and older at least) where the keys generated by the openssl package cannot be read by the system ssh commands (e.g., ssh-add).

Value

The path, invisibly. This is useful in the case where path is tempfile().

Aliases
  • ssh_keygen
Examples
# NOT RUN {
# 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)
# }
Documentation reproduced from package cyphr, version 1.0.2, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.