Skip to content

Commit 89f4592

Browse files
aaazaleaFiloSottile
authored andcommitted
crypto/x509: improve error when parsing bad ECDSA cert
When parsing an ECDSA certificate, improve the error message upon failing to parse the curve as a named curve, rather than returning the original ASN1 error. Fixes #21502 Change-Id: I7ae7b3ea7a9dcbd78a9607f46f5883d3193b8367 Reviewed-on: https://go-review.googlesource.com/57050 Reviewed-by: Filippo Valsorda <[email protected]>
1 parent 9d84e0e commit 89f4592

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/crypto/x509/x509.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ func parsePublicKey(algo PublicKeyAlgorithm, keyData *publicKeyInfo) (interface{
10561056
namedCurveOID := new(asn1.ObjectIdentifier)
10571057
rest, err := asn1.Unmarshal(paramsData, namedCurveOID)
10581058
if err != nil {
1059-
return nil, err
1059+
return nil, errors.New("x509: failed to parse ECDSA parameters as named curve")
10601060
}
10611061
if len(rest) != 0 {
10621062
return nil, errors.New("x509: trailing data after ECDSA parameters")

0 commit comments

Comments
 (0)