Generate and format the SFTP connector private key
Complete details for generating a public/private key pair are described in Creating SSH keys on macOS, Linux, or Unix.
As an example, to generate a private key for use with SFTP connectors, the
following sample command produces the correct type of key (replace
key_name
with the actual file name for your key
pair):
ssh-keygen -t rsa -b 4096 -m PEM -f
key_name
-N ""
Note
When you create your key pair for use with SFTP connectors, do not use a passphrase. An empty passphrase is necessary for the SFTP configuration to function correctly.
This command creates an RSA key pair, with a key size of 4096 bits. The key is
generated in the legacy PEM format, which is required by Transfer Family for use with the SFTP
connector secret. The keys are saved in
(private key) and
key_name
(public key) in
the current directory: that is, the directory where you run the
key_name
.pubssh-keygen
command.
Note
Transfer Family does not support the OpenSSH format (-----BEGIN OPENSSH PRIVATE
KEY-----
) for the keys used for your SFTP connector. The key must be
in legacy PEM format (-----BEGIN RSA PRIVATE
KEY-----
or -----BEGIN EC PRIVATE KEY-----
). You can
use the ssh-keygen tool to convert your key, by supplying the
-m PEM
option when you run the command.
After you generate the key, you must make sure that the private key is formatted with embedded newline characters ("\n") in JSON format.
Use a command to convert your existing private key into the correct
format—JSON format with embedded newline characters. Here we provide
examples for jq
and Powershell. You can use any tool or command
that you'd like to convert the private key into JSON format with embedded
newline characters.
To add private key data to the secret for use with SFTP connectors
-
In the Secrets Manager console, when storing Other type of Secret, choose the Plaintext tab. The text should be empty, with only an opening and closing brace, {}.
-
Paste in your username, private key data, and/or password using the following format. For your private key data, paste the output from the command that you ran in step 1.
{"Username":"
SFTP-USER
","Password":"SFTP-USER-PASSWORD
","PrivateKey":"PASTE-PRIVATE-KEY-DATA-HERE
"}If you paste the private key data correctly, you should see the following upon selecting the Key/value tab. Notice that the private key data is displayed line-by-line, rather than as a continuous string of text.
-
Continue the procedure in Store a secret for use with an SFTP connector at step 8, and follow that procedure until the end.