-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
When I add ssh key to an account, I get Can not verify your SSH key: ... asn1: structure error: tags don't match #22693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What command did you run to generate key? And what is filename of key (like |
I just ran ssh-keygen to both machines I tried it to and both of which had output on files ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub Here's the key on one on the machines for reference:
|
How do you copy the content? |
You should only be uploading the PUBLIC key not the PRIVATE key. That is why this is failing, |
Now interestingly I thought we had code that was able to detect this sort of mistake - and report back to the user that they were doing the wrong thing. So I guess we should double check that. |
Please do not upload any secret data such as your SSH private key to public spaces. |
Ah no probs. That key is from another docker container and I regenerated it multiple times. |
@delvh I was going to use that compromised private key to try to improve the error detection!! |
The error reported when a user passes a private ssh key as their ssh public key is not very nice. This PR improves this slightly. Ref go-gitea#22693 Signed-off-by: Andrew Thornton <[email protected]>
The error reported when a user passes a private ssh key as their ssh public key is not very nice. This PR improves this slightly. Ref #22693 Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: delvh <[email protected]>
I recommend using the When I use |
Can confirm that it happens quite a lot, especially when you're SSHing with a Private VPN on, like HackTheBox(the service I used where I get the error) |
In my machine, git-bash also fails as well, regardless when echo the signature to a file and copy them, or using clip tho. |
Works on my end. Windows 11 here. Maximized the git bash and run the command and done. |
Just had this issue with a windows client. The problem is the echo command on Windows. What worked for me was to change the line to
The important parts here are:
|
Actually you do not really need to "verify" that key. As long as you added it into Gitea, the key could work without "verifying". Just use it. |
You also might want to check the permissions of your public key... |
Gitea Version I just encountered a similar problem last weekend with the following error message once I try to verify my SSH id_ed25519 key pair.
By figuring out just like the above discussions, which the ref #33548 |
- resolving wrong signature calculations for SSH key verification Fixed #22693 --------- Co-authored-by: wxiaoguang <[email protected]> Co-authored-by: Giteabot <[email protected]>
…tea#33548) - resolving wrong signature calculations for SSH key verification Fixed go-gitea#22693 --------- Co-authored-by: wxiaoguang <[email protected]> Co-authored-by: Giteabot <[email protected]> (cherry picked from commit e3adb68)
Description
When I add ssh key to an account, I get Can not verify your SSH key: failed to parse DER encoded public key as either PKIX or PEM RSA Key: asn1: structure error: tags don't match (16 vs {class:1 tag:15 length:112 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue: tag: stringType:0 timeType:0 set:false omitEmpty:false} publicKeyInfo @2 asn1: structure error: tags don't match (16 vs {class:1 tag:15 length:112 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue: tag: stringType:0 timeType:0 set:false omitEmpty:false} PublicKey @2
Gitea Version
1.18.1
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
https://gist.github.com/lasersPew/749f3818a1cba92f35de084dabb35840
Screenshots
Git Version
2.36.3
Operating System
alpine 3.16.3
How are you running Gitea?
Using Docker CLI inside Alpine 0.17 in WSL, no Docker Desktop using WSL2 kernel. Set things up using Portainer, Stacks specifically. Here's the config:
Database
PostgreSQL
The text was updated successfully, but these errors were encountered: