Generating a less problematic public/private key file

To use this tutorial OpenSSH has to be installed on Windows. This can be easily done with the following command. To execute it, PowerShell has to be started as administrator:

Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Client*' | ForEach-Object { if($_.State -EQ "NotPresent"){ Add-WindowsCapability -Online -Name $_.Name } }

I had problems with key files in the OpenSSH format:

-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn
... ... ...
aknUIaQ4oLEAAAATYWdvQERFU0tUT1AtM1VFRkMwNw==
-----END OPENSSH PRIVATE KEY-----

These files are created when using the plain “ssh-keygen” command:

ssh-keygen

I was, for example, not able to connect Netbeans to a remote git repository. It would just show me a password input and would not connect.

It worked only when creating my key with the following command:

ssh-keygen -m pem

Which created a key that looked like this:

-----BEGIN RSA PRIVATE KEY-----
MIIG5AIBAAKCAYEA0jMI2eXJTx05Df7SxhYQUXNaDkmIZw8BQWtuM7QpGT3fL8gS
... ... ...
H+D6fxp+aV+iqFmcDkB69+21r8WX246gHPHpHa4xYF1Z7UwzMhF+Zg==
-----END RSA PRIVATE KEY-----

When pasting the public counterpart, stored in “id_rsa.pub” into the authorized_keys file on the server, the connection could be established.