@@ -1535,6 +1535,24 @@ public static Vector parseSupportedSignatureAlgorithms(InputStream input)
15351535 return supportedSignatureAlgorithms ;
15361536 }
15371537
1538+ static void verify12SignatureAlgorithm (SignatureAndHashAlgorithm signatureAlgorithm , short alertDescription )
1539+ throws IOException
1540+ {
1541+ if (signatureAlgorithm != null )
1542+ {
1543+ int signatureScheme = SignatureScheme .from (signatureAlgorithm );
1544+
1545+ // TODO In future there might be more cases, so we'd need a more general method.
1546+ if (SignatureScheme .isMLDSA (signatureScheme ))
1547+ {
1548+ throw new TlsFatalAlert (alertDescription );
1549+ }
1550+ }
1551+ }
1552+
1553+ /**
1554+ * @deprecated Will be removed.
1555+ */
15381556 public static void verifySupportedSignatureAlgorithm (Vector supportedSignatureAlgorithms ,
15391557 SignatureAndHashAlgorithm signatureAlgorithm ) throws IOException
15401558 {
@@ -2453,7 +2471,10 @@ static void verifyCertificateVerifyClient(TlsServerContext serverContext, Certif
24532471 }
24542472 else
24552473 {
2456- verifySupportedSignatureAlgorithm (securityParameters .getServerSigAlgs (), sigAndHashAlg );
2474+ verify12SignatureAlgorithm (sigAndHashAlg , AlertDescription .illegal_parameter );
2475+
2476+ verifySupportedSignatureAlgorithm (securityParameters .getServerSigAlgs (), sigAndHashAlg ,
2477+ AlertDescription .illegal_parameter );
24572478
24582479 signatureAlgorithm = sigAndHashAlg .getSignature ();
24592480
@@ -2538,7 +2559,7 @@ private static void verify13CertificateVerify(Vector supportedAlgorithms, String
25382559 int signatureScheme = certificateVerify .getAlgorithm ();
25392560
25402561 SignatureAndHashAlgorithm algorithm = SignatureScheme .getSignatureAndHashAlgorithm (signatureScheme );
2541- verifySupportedSignatureAlgorithm (supportedAlgorithms , algorithm );
2562+ verifySupportedSignatureAlgorithm (supportedAlgorithms , algorithm , AlertDescription . illegal_parameter );
25422563
25432564 Tls13Verifier verifier = certificate .createVerifier (signatureScheme );
25442565
@@ -2633,7 +2654,10 @@ static void verifyServerKeyExchangeSignature(TlsContext context, InputStream sig
26332654 throw new TlsFatalAlert (AlertDescription .illegal_parameter );
26342655 }
26352656
2636- verifySupportedSignatureAlgorithm (securityParameters .getClientSigAlgs (), sigAndHashAlg );
2657+ verify12SignatureAlgorithm (sigAndHashAlg , AlertDescription .illegal_parameter );
2658+
2659+ verifySupportedSignatureAlgorithm (securityParameters .getClientSigAlgs (), sigAndHashAlg ,
2660+ AlertDescription .illegal_parameter );
26372661 }
26382662
26392663 TlsVerifier verifier = serverCertificate .createVerifier (signatureAlgorithm );
0 commit comments