You are not logged in.

#1 2018-08-20 16:16:06

jdarnold
Member
From: Medford MA USA
Registered: 2009-12-15
Posts: 485
Website

ssh-add "Invalid format"

Every day, I boot my machine and then type in 'ssh-add' to add my ssh key. This has been working for years. Looking at my id_rsa file, it hasn't been touched since Nov. 2011.

Today, though, I ran it and got:

 $ ssh-add 
Error loading key "/home/jdarnold/.ssh/id_rsa": invalid format

the ~/.ssh/id_rsa file looks just fine. Has something change in ssh-add that obsoleted my id_rsa file? Anything else I can check?

Offline

#2 2018-08-25 12:16:25

chripell
Member
Registered: 2018-08-25
Posts: 1

Re: ssh-add "Invalid format"

Hi, I had the same problem and resolved it by rencoding the private key with openssl:

cd .ssh
cp id_rsa id_rsa.oldy
openssl rsa -in id_rsa.oldy  -out id_rsa.no_pass
openssl rsa -aes256 -in id_rsa.no_pass -out id_rsa
rm id_rsa.no_pass

I'm still browsing the openssh/openssl git to understand what triggered this.

Interestingly, the default key length changed (I generated this key on 2018-01-10), before:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,

after:

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

HTH

Last edited by chripell (2018-08-25 12:17:07)

Offline

Board footer

Powered by FluxBB