8286908: ECDSA signature should not return parameters

Reviewed-by: ascarpino, hchao, valeriep
This commit is contained in:
Weijun Wang 2022-05-23 13:34:23 +00:00
parent 689f80cbad
commit 8040aa0073
4 changed files with 73 additions and 49 deletions

View file

@ -213,10 +213,14 @@ public class AlgorithmId implements Serializable, DerEncoder {
|| algid.equals(ed25519_oid)
|| algid.equals(x448_oid)
|| algid.equals(x25519_oid)
|| algid.equals(SHA1withECDSA_oid)
|| algid.equals(SHA224withECDSA_oid)
|| algid.equals(SHA256withECDSA_oid)
|| algid.equals(SHA384withECDSA_oid)
|| algid.equals(SHA512withECDSA_oid)) {
// RFC 3279 2.2.3: When the ecdsa-with-SHA1 algorithm identifier
// appears as the algorithm field in an AlgorithmIdentifier,
// the encoding MUST omit the parameters field.
// RFC 4055 3.3: when an RSASSA-PSS key does not require
// parameter validation, field is absent.
// RFC 8410 3: for id-X25519, id-X448, id-Ed25519, and
@ -692,6 +696,8 @@ public class AlgorithmId implements Serializable, DerEncoder {
public static final ObjectIdentifier x448_oid =
ObjectIdentifier.of(KnownOIDs.X448);
public static final ObjectIdentifier SHA1withECDSA_oid =
ObjectIdentifier.of(KnownOIDs.SHA1withECDSA);
public static final ObjectIdentifier SHA224withECDSA_oid =
ObjectIdentifier.of(KnownOIDs.SHA224withECDSA);
public static final ObjectIdentifier SHA256withECDSA_oid =