@@ -72,8 +72,6 @@ abstract class JsseUtils
7272 PropertyUtils .getBooleanSystemProperty ("jdk.tls.allowLegacyMasterSecret" , true );
7373 private static final boolean provTlsAllowLegacyResumption =
7474 PropertyUtils .getBooleanSystemProperty ("jdk.tls.allowLegacyResumption" , false );
75- private static final int provTlsMaxCertificateChainLength =
76- PropertyUtils .getIntegerSystemProperty ("jdk.tls.maxCertificateChainLength" , 10 , 1 , Integer .MAX_VALUE );
7775 private static final int provTlsMaxHandshakeMessageSize =
7876 PropertyUtils .getIntegerSystemProperty ("jdk.tls.maxHandshakeMessageSize" , 32768 , 1024 , Integer .MAX_VALUE );
7977 private static final boolean provTlsRequireCloseNotify =
@@ -84,6 +82,9 @@ abstract class JsseUtils
8482 private static final boolean provTlsUseExtendedMasterSecret =
8583 PropertyUtils .getBooleanSystemProperty ("jdk.tls.useExtendedMasterSecret" , true );
8684
85+ private static final int provTlsClientMaxInboundCertChainLen ;
86+ private static final int provTlsServerMaxInboundCertChainLen ;
87+
8788 static final Set <BCCryptoPrimitive > KEY_AGREEMENT_CRYPTO_PRIMITIVES_BC =
8889 Collections .unmodifiableSet (EnumSet .of (BCCryptoPrimitive .KEY_AGREEMENT ));
8990 static final Set <BCCryptoPrimitive > KEY_ENCAPSULATION_CRYPTO_PRIMITIVES_BC =
@@ -102,6 +103,25 @@ static class BCUnknownServerName extends BCSNIServerName
102103 }
103104 }
104105
106+ static
107+ {
108+ int clientDefaultValue = 10 ;
109+ int serverDefaultValue = 8 ;
110+
111+ int provTlsMaxCertificateChainLength = PropertyUtils .getIntegerSystemProperty (
112+ "jdk.tls.maxCertificateChainLength" , 0 , 1 , Integer .MAX_VALUE );
113+ if (provTlsMaxCertificateChainLength > 0 )
114+ {
115+ clientDefaultValue = provTlsMaxCertificateChainLength ;
116+ serverDefaultValue = provTlsMaxCertificateChainLength ;
117+ }
118+
119+ provTlsClientMaxInboundCertChainLen = PropertyUtils .getIntegerSystemProperty (
120+ "jdk.tls.client.maxInboundCertificateChainLength" , clientDefaultValue , 1 , Integer .MAX_VALUE );
121+ provTlsServerMaxInboundCertChainLen = PropertyUtils .getIntegerSystemProperty (
122+ "jdk.tls.server.maxInboundCertificateChainLength" , serverDefaultValue , 1 , Integer .MAX_VALUE );
123+ }
124+
105125 static boolean allowLegacyMasterSecret ()
106126 {
107127 return provTlsAllowLegacyMasterSecret ;
@@ -270,14 +290,19 @@ static boolean equals(Object a, Object b)
270290 return a == b || (null != a && null != b && a .equals (b ));
271291 }
272292
273- static int getMaxCertificateChainLength ()
293+ static int getMaxHandshakeMessageSize ()
274294 {
275- return provTlsMaxCertificateChainLength ;
295+ return provTlsMaxHandshakeMessageSize ;
276296 }
277297
278- static int getMaxHandshakeMessageSize ()
298+ static int getMaxInboundCertChainLenClient ()
279299 {
280- return provTlsMaxHandshakeMessageSize ;
300+ return provTlsClientMaxInboundCertChainLen ;
301+ }
302+
303+ static int getMaxInboundCertChainLenServer ()
304+ {
305+ return provTlsServerMaxInboundCertChainLen ;
281306 }
282307
283308 static ASN1ObjectIdentifier getNamedCurveOID (PublicKey publicKey )
0 commit comments