Skip to content

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

Closed
@gauravgola96

Description

@gauravgola96

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 !!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions