SFTP uses SSH keys to establish a secure connection, but you can add further security by requiring that users connect to remote systems by authenticating with an SSH key pair. There are several ways to generate keys, including directly in Windows, which will be the focus of this guide.
What are SSH keys?
SSH keys are a method to securely authenticate with systems that use the Secure Shell Protocol, such as SFTP. Keys are safeguarded using an encryption algorithm that stops outside parties from being able to see and intercept data. For SFTP, using keys with the RSA encryption method is a common way to make authentication more secure.
RSA keys provide a secure method of authenticating with an SSH or SFTP server without requiring a password. They are based on asymmetric encryption, which uses a matching pair of keys: one public and one private. The public key is shared with the server or service provider, while the private key remains securely on your machine and is used to establish the connection.
When you attempt to connect, the server uses the public key to generate a challenge that can only be solved by the corresponding private key. This process proves your identity without ever transmitting the private key itself, making the exchange both safe and reliable.
How to generate an SSH key in Windows
For this guide, we'll show you how to generate an RSA SSH key using Windows PowerShell, but similar steps apply for other encryption algorithms.
The process to create an RSA key is:
- Open PowerShell
- Generate the Key
- Specify the save location
- Add a passphrase(Optional)
- Verify the Keys
- Copy the Public Key
Things to remember when create a new key:
- You will need PowerShell to generate the key. If you don't have PowerShell, you can follow Microsoft's guide on Installing PowerShell on Windows
- The private key is used on the client
- The public key is used on the server and can be shared
- Where possible, the private key should be password-encrypted
- If you are connecting using SFTP or SSH, you should never share your private key. Only share the public key.
Generating the SSH key using Windows PowerShell
1. Open PowerShell
Press Start, then typePowerShell to open Windows PowerShell. (If you use Git Bash or WSL, you can follow the same steps there.)
2. Generate the Key
Run the following command in PowerShell:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"- -t rsa→ generates the key using RSA encryption.
- -b 4096→ sets the key size to 4096 bits (strong security).
- -C→ adds a label, usually your email.
3. Choose a Save Location
Once you run the command to generate the keys, you'll get a new message:
Enter file in which to save the key (C:\Users\YourName/.ssh/id_rsa):The path shown is the default save location for generated SSH keys. The keys are stored locally as text files, typically in the .ssh directory or saved in the client you are using to connect.
Press Enter to accept the default, or type a different file path if you want to save the key elsewhere.
4. Add a Passphrase (Optional)
Next, you'll be prompted to enter a Passphrase. We recommend including one with every key for added security. If you don't want to enter a password, simply press Enter to leave it blank and skip this step.
5. Verify the Keys
Your SSH keys should now be generated. You can verify that they were generated successfully by checking your .ssh folder (or the path to the directory specified in step 3).
To quickly jump to the .ssh folder, use this command:
dir ~/.sshIn the folder, you should see a few different items:
- id_rsa→ This is your private key
- id_rsa.pub→ This is your public key, specified by the- .pubextension.
6. Copy the Public Key and add it to your destination
To use SSH keys, the public key will need to be added to the destination. Start by copying the public key.
To copy your key to the clipboard:
Get-Content ~/.ssh/id_rsa.pub | Set-ClipboardNow you can paste it into GitHub, GitLab, or any server’s authorized keys.
Using SSH keys with Couchdrop SFTP Server
Couchdrop is a cloud SFTP server that requires no infrastructure setup or management. Your server is set up and instantly ready to use at registration. RSA keys are compatible with Couchdrop, and you can choose to automatically create a private and public key pair to use with Couchdrop as part of generating a user.
All new registrations get 14 days to evaluate the platform with no credit card required and instant access. Simply sign up now to start your trial.