I have generate Rsa Key pairs using openssh. I want to encrypt private key with passphrase using openssl.
I tried to encrypt private key using openssl , but unable to do that as it is giving error message.
Used the below command to generate rsa key pair
ssh-keygen -t rsa -b 4096 -P ''-f ./Test-key
used below command to encrypt private key using openssl.
rsa -des3 -in C:\Users\vkode200\Test-key -out C:\Users\vkode200\Test-key-encrypted -passout pass:"${pass}"
I am getting below error message :
15764:error:0906D06C:PEM routines:PEM_read_bio:no start line:crypto\pem\pem_lib.c:686:Expecting: ANY PRIVATE KEY
error in rsa```
Below is the header of my generated private key
```-----BEGIN OPENSSH PRIVATE KEY-----```
I have no clue and i spent lot of time to figure out the issue, but no luck.
You can generate keys in old format by passing -m PEM
:
ssh-keygen -t rsa -b 4096 -P '' -f ./Test-key -m PEM
Those should work fine with that openssl command.
If you need them in new format, you can make a copy a convert it in place with:
ssh-keygen -p -P '' -N '' -f ./Test-key -m PEM