Skip to content

Instantly share code, notes, and snippets.

@hanwen
Created October 3, 2017 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanwen/ec620792123ffee5c2cdfbcc33fab0da to your computer and use it in GitHub Desktop.
Save hanwen/ec620792123ffee5c2cdfbcc33fab0da to your computer and use it in GitHub Desktop.
func main() {
k, _, _, _, err := ssh.ParseAuthorizedKey([]byte(key))
if err != nil {
log.Fatal(err)
}
cert := k.(*ssh.Certificate)
log.Printf("%#v", cert)
}
/*
2017/10/03 09:15:12 &ssh.Certificate{Nonce:[]uint8{0xff, 0x1f, 0x66, 0xa7, 0x49, 0xff, 0xff, 0x7b, 0x69, 0xca, 0xa6, 0x8c, 0xa4, 0x7b, 0x7b, 0x3e, 0x63, 0x76, 0x8, 0xc4, 0xa5, 0xa6, 0xd6, 0x6a, 0x11, 0x92, 0xd3, 0xe0, 0x1c, 0x39, 0x22, 0x62}, Key:(*ssh.ecdsaPublicKey)(0xc42000ca00), Serial:0x1900000001828a9a, CertType:0x1, KeyId:"hanwen@corp.google.com", ValidPrincipals:[]string{"hanwen"}, ValidAfter:0x59d344f2, ValidBefore:0x59d45f5e, Permissions:ssh.Permissions{CriticalOptions:map[string]string{}, Extensions:map[string]string{"permit-X11-forwarding":"", "permit-agent-forwarding":"", "permit-port-forwarding":"", "permit-pty":"", "permit-user-rc":""}}, Reserved:[]uint8{}, SignatureKey:(*ssh.rsaPublicKey)(0xc420010500), Signature:(*ssh.Signature)(0xc4200687b0)}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment