SSH Key Pair

An SSH (Secure Shell) key pair is used for identity authentication and encrypted communication, consisting of a public key and a private key. The public key can be used to encrypt messages that only the private key can decrypt. This property is employed as a way of authenticating using the key pair. Your SSH key pair contains several public keys that can be placed on your server to access it securely.

Supported Formats

SSH keys are typically stored in the ~/.ssh/ directory.

FormatStart WithMinimum Length

RSA

ssh-rsa

2048 bits

ED25519

ssh-ed25519

256 bits

ECDSA

ecdsa-sha2-nistp

256 bits

DSA

ssh-dss

1024 bits

Note

  • Provide your public key. Be careful not to use your private key.

  • You're recommended to use RSA or ED25519 keys, as they have good compatibility and security. The DSA keys are not recommended, as they are vulnerable to attacks.

Example

Here we take RSA format as an example.

Public key

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDx6VN...

Private key

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,5764636E65726F726974686D616E6F6E
...
-----END RSA PRIVATE KEY-----

Limit

You can add up to 5 public SSH keys to create an SSH key pair.

Last updated