DEV Community

loading...

Generating SSH Certificate in Windows 10

caiosousa profile image Caio Sousa ・1 min read

Software Requirements

Download and install Open SSL

Download and install Putty Gen

Alt Text

Configuration

Find the OpenSSL installation folder such as:
C:\Program Files\OpenSSL-Win64\bin\

Create a folder named 'cert' inside bin folder.

Open the command prompt as administrator and navigate to the OpenSSL bin folder

cd C:\Program Files\OpenSSL-Win64\bin\
Enter fullscreen mode Exit fullscreen mode

Generate the private key and the CRT in the cert folder:

openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout cert/privateKey-example.key -out cert/certificate-example.crt
Enter fullscreen mode Exit fullscreen mode

Generate the PFX certificate:

openssl pkcs12 -export -out cert/certificate-example.pfx -inkey cert/privateKey-example.key -in cert/certificate-example.crt
Enter fullscreen mode Exit fullscreen mode

At this poin 3 files should be generated in the cert folder:

Alt Text

Generate a PKCS#1 Private key

openssl pkcs12 -in cert/certificate-example.pfx -nocerts -out cert/privateKey-example.pem
Enter fullscreen mode Exit fullscreen mode

Decrypt the private key to generate the ppk

openssl rsa -in cert/privateKey-example.pem -out cert/teste-privateKey-example-decrypted_key.pem
Enter fullscreen mode Exit fullscreen mode

Execute the Putty Gen program and load the decrypted private key
Save the new private and public key as ppk.

Alt Text

At this point the public and private key could be used for SFTP authentication.

Alt Text

Discussion (0)

pic
Editor guide