ParseCertificate returns a certificate from the marshaled bytes.
(in []byte)
| 33 | |
| 34 | // ParseCertificate returns a certificate from the marshaled bytes. |
| 35 | func ParseCertificate(in []byte) (*ssh.Certificate, error) { |
| 36 | pub, err := ssh.ParsePublicKey(in) |
| 37 | if err != nil { |
| 38 | return nil, errors.Wrap(err, "error parsing certificate") |
| 39 | } |
| 40 | cert, ok := pub.(*ssh.Certificate) |
| 41 | if !ok { |
| 42 | return nil, errors.Errorf("error parsing certificate: %T is not a certificate", pub) |
| 43 | } |
| 44 | return cert, nil |
| 45 | } |
| 46 | |
| 47 | // PublicKey returns the Go's crypto.PublicKey of an ssh.PublicKey. |
| 48 | func PublicKey(key ssh.PublicKey) (crypto.PublicKey, error) { |
no outgoing calls
no test coverage detected
searching dependent graphs…