Skip to content
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

Question - Compare ~/.ssh/id_rsa.pub and session.Publickey() #206

Closed
gauravgola96 opened this issue Jun 20, 2023 · 0 comments
Closed

Question - Compare ~/.ssh/id_rsa.pub and session.Publickey() #206

gauravgola96 opened this issue Jun 20, 2023 · 0 comments

Comments

@gauravgola96
Copy link

gauravgola96 commented Jun 20, 2023

I am building application similar to github where user can dump their public key on my server than can authenticate it. I wanted to added user specific data on runtime based on if key is registered or not with my application (basically check in key database).

I tried testing with hardcoded values:
`key := "ssh-rsa AAAA"
newAuthorizedKey, _, _, _, err := ssh.ParseAuthorizedKey(b)
if err != nil {
fmt.Println(err)
return
}

authorizedKey := ssh.MarshalAuthorizedKey(newAuthorizedKey)
fmt.Println(fmt.Sprintf("%s", authorizedKey))
`

But these keys don't match with what we get in session.Publickey()
Is it something to do with algoritms..
I see session.Publickey - ssh-ed25519 while one on my system in ssh-rsa
How can I make them compatible?

Any help is really appreciated !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant