Closed c00w closed 2 years ago
And of course now that I've filed the bug report - using ssh.ParseAuthorizedKey appears to work - which does not match the documentation, but does match the linked paste from the original issue :).
cc @FiloSottile
using ssh.ParseAuthorizedKey appears to work - which does not match the documentation ...
The documentation says that ParsePublicKey "parses an SSH public key formatted for use in the SSH wire protocol ...", and that ParseAuthorizedKey is for the text format, so I guess the behavior does match the documentation. I agree it could be a bit more verbose and clearer.
See above
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes - AFAIK go1.16 is the latest release
What operating system and processor architecture are you using (
go env
)?tl;dr, linux, nixos, x86
go env
OutputWhat did you do?
Where test.sh is a pretty basic generate a ssh key, sign it, try and parse it.
test.go is just a dummy program which tries to parse the file using ssh.ParsePublicKey as https://github.com/golang/go/issues/22046 and the docs at https://pkg.go.dev/golang.org/x/crypto/ssh#Certificate suggest
What did you expect to see?
I expected the certificate to be parsed.
What did you see instead?
The ParsePublicKey method fails with a short read.
Note that this appears to be key type agnostic - dropping the ed25519 type (so it's thus rsa), fails with the same error message.