diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go index 89789ceba4f539..037924cede331a 100644 --- a/src/crypto/x509/x509.go +++ b/src/crypto/x509/x509.go @@ -1056,7 +1056,7 @@ func parsePublicKey(algo PublicKeyAlgorithm, keyData *publicKeyInfo) (interface{ namedCurveOID := new(asn1.ObjectIdentifier) rest, err := asn1.Unmarshal(paramsData, namedCurveOID) if err != nil { - return nil, err + return nil, errors.New("x509: failed to parse ECDSA parameters as named curve") } if len(rest) != 0 { return nil, errors.New("x509: trailing data after ECDSA parameters")