Invalid SSH Key

I generated an SSH key on an Ubuntu VM, and am unable to submit it to my resin account, with the error “Invalid Key” when I submit. Generally, the key files have 3 parts, “ssh-rsa”, the key itself, and the user’s email address. I have tried the key alone, and every possible combination of the key with the other two parts to no avail. I was able to get this to work with a key generated on my Macbook, but not on the Ubuntu VM.

Worked around it by adding my ssh key to GitHub and then importing the key from GitHub - just in case anyone else hits this issue.

Hi @dagrooms52 - that sounds weird. It should be the full .pub file that has to be added. How did you generate the key exactly?

I generated the key using the steps outlined in the GitHub SSH key tutorial, this link: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
I followed them exactly on my Mac and on the Ubuntu VM.

Hi. We’ve created an issue to investigate the problem and fix as needed, will get back to you as soon as it’s done.

Hi, we have a fix for the issue, which just got deployed.
Thank you for your report! Best, Thodoris

Thanks all of you for the quick responses and fix!

I’m having the same issue. Generated at home on Windows using Windows Bash - worked fine. Generated using Windows Bash at work - says invalid key. Importing from GitHub works fine.

I have same issue on Ubuntu. Is it really fixed?

Hi there! How did you generate your key? What’s the error message you 'r getting? Were you able to reproduce this consistently? Could you share your public key as it isn’t sensitive, or add it to a github account, and share your github username?
Thanks!

keys generated with tutorial command:
ssh-keygen -t rsa -b 4096 -C "xxxxx@xxxx.com"
And got key as:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQD1KyTMhw0aokk/oNxELgX7vjKZXn84htbPJ78819i/1oOY0aeptxWyhqfgfNOsBrJ5L0XZv/+CzQM0nfQZEie5U/VpdXeRdnbgJR4Vu+Zb7/lvMaRr/LN3cJM/yqE9WzdzB0uFJ89Omdy6AoJe+aohUEJ351O8nutf/Nuu0H6U8hFjOEW4eIIc2tbQ8tPVdvTU29R6f
P+Aid28v5ZfZYzfidb37t8mwMTxxlh49nfkC+4RvDZHA7gpT0YJA6HeVuug1CdF8hgPKifejDBXyBEkzEnih2PUQuaMGR3/stvp9uLPFr0cXacvklvxIOz7f8aHCachLmenQvUGU+yJfNi2EsMAG4p/6ubwgLE8BSoUCTWeb5LCgZOGu2UN9yUf6t/miGw1tOZg3DTn/8aQ8c5mu3qNzy0t3y31lrRcpd2hSM0WXKVoB1
+ylaE0Sun8YxgDE9h81pj5bLX8ooNjNWsz53xAvzwn7HsXjzq+JlBmwjpG1EckRzmkGaPSlz36JNTsBELDiZSonhhQ6/m/EF9DJxSobbE2oChiNoLOysH1+FHAThnMizSrC3LUUxJyGyP8wdM+HMOXVygEbRTwnJvwh2jdUYvEkEVoUYte7HpkA64ct2yDYyjei1nuxYDmBYHqeZzaceT0bXGboW/4Psux4b289DAHaVI
FwY3UdMSFWw== xxx@xxxx.com

I’ve got always “Invalid Key” message when adding it manually. Workaround is to add it in Git and import it from there…

Hi @banto_78, the above public key appears to be invalid. The reason is some added newlines (probably during copy-paste).
For checking your key validity, you can run ssh-keygen -l -f /path/to/public_key.
You should be able to import the key successfully, after removing the additional newlines from the public key body:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQD1KyTMhw0aokk/oNxELgX7vjKZXn84htbPJ78819i/1oOY0aeptxWyhqfgfNOsBrJ5L0XZv/+CzQM0nfQZEie5U/VpdXeRdnbgJR4Vu+Zb7/lvMaRr/LN3cJM/yqE9WzdzB0uFJ89Omdy6AoJe+aohUEJ351O8nutf/Nuu0H6U8hFjOEW4eIIc2tbQ8tPVdvTU29R6fP+Aid28v5ZfZYzfidb37t8mwMTxxlh49nfkC+4RvDZHA7gpT0YJA6HeVuug1CdF8hgPKifejDBXyBEkzEnih2PUQuaMGR3/stvp9uLPFr0cXacvklvxIOz7f8aHCachLmenQvUGU+yJfNi2EsMAG4p/6ubwgLE8BSoUCTWeb5LCgZOGu2UN9yUf6t/miGw1tOZg3DTn/8aQ8c5mu3qNzy0t3y31lrRcpd2hSM0WXKVoB1+ylaE0Sun8YxgDE9h81pj5bLX8ooNjNWsz53xAvzwn7HsXjzq+JlBmwjpG1EckRzmkGaPSlz36JNTsBELDiZSonhhQ6/m/EF9DJxSobbE2oChiNoLOysH1+FHAThnMizSrC3LUUxJyGyP8wdM+HMOXVygEbRTwnJvwh2jdUYvEkEVoUYte7HpkA64ct2yDYyjei1nuxYDmBYHqeZzaceT0bXGboW/4Psux4b289DAHaVIFwY3UdMSFWw==