@@ -2267,44 +2267,53 @@ public void testTLSVersionRemoval() throws Exception {
2267
2267
assumeTrue (supportsTestCertificates (this .stmt ),
2268
2268
"This test requires the server configured with SSL certificates from ConnectorJ/src/test/config/ssl-test-certs" );
2269
2269
2270
+ String testCipher = "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" ; // IANA Cipher name
2271
+ String expectedCipher = "ECDHE-RSA-AES128-GCM-SHA256" ; // OpenSSL Cipher name
2272
+ String testTlsVersion = "TLSv1.2" ;
2273
+ if (versionMeetsMinimum (8 , 2 )) {
2274
+ testCipher = "TLS_AES_256_GCM_SHA384" ; // IANA Cipher name
2275
+ expectedCipher = "TLS_AES_256_GCM_SHA384" ; // IANA Cipher name
2276
+ testTlsVersion = "TLSv1.3" ;
2277
+ }
2278
+
2270
2279
Connection con = null ;
2271
2280
Properties props = new Properties ();
2272
2281
props .setProperty (PropertyKey .sslMode .getKeyName (), SslMode .REQUIRED .name ());
2273
2282
props .setProperty (PropertyKey .allowPublicKeyRetrieval .getKeyName (), "true" );
2274
2283
2275
- // TS.FR.1_1. Create a Connection with the connection property tlsVersions=TLSv1.2. Assess that the connection is created successfully and it is using
2276
- // TLSv1.2.
2277
- props .setProperty (PropertyKey .tlsVersions .getKeyName (), "TLSv1.2" );
2284
+ // TS.FR.1_1. Create a Connection with the connection property tlsVersions=TLSv1.2/TLSv1.3. Assess that the connection is created successfully and it is
2285
+ // using TLSv1.2/TLSv1.3 .
2286
+ props .setProperty (PropertyKey .tlsVersions .getKeyName (), testTlsVersion );
2278
2287
con = getConnectionWithProps (props );
2279
2288
assertTrue (((MysqlConnection ) con ).getSession ().isSSLEstablished ());
2280
- assertSessionStatusEquals (con .createStatement (), "ssl_version" , "TLSv1.2" );
2289
+ assertSessionStatusEquals (con .createStatement (), "ssl_version" , testTlsVersion );
2281
2290
con .close ();
2282
2291
2283
- // TS.FR.1_2. Create a Connection with the connection property enabledTLSProtocols=TLSv1.2. Assess that the connection is created successfully and it is
2284
- // using TLSv1.2.
2292
+ // TS.FR.1_2. Create a Connection with the connection property enabledTLSProtocols=TLSv1.2/TLSv1.3. Assess that the connection is created successfully
2293
+ // and it is using TLSv1.2.
2285
2294
props .remove (PropertyKey .tlsVersions .getKeyName ());
2286
- props .setProperty ("enabledTLSProtocols" , "TLSv1.2" );
2295
+ props .setProperty ("enabledTLSProtocols" , testTlsVersion );
2287
2296
con = getConnectionWithProps (props );
2288
2297
assertTrue (((MysqlConnection ) con ).getSession ().isSSLEstablished ());
2289
- assertSessionStatusEquals (con .createStatement (), "ssl_version" , "TLSv1.2" );
2298
+ assertSessionStatusEquals (con .createStatement (), "ssl_version" , testTlsVersion );
2290
2299
con .close ();
2291
2300
props .remove ("enabledTLSProtocols" );
2292
2301
2293
2302
// TS.FR.2_1. Create a Connection with the connection property tlsCiphersuites=[valid-cipher-suite]. Assess that the connection is created successfully
2294
2303
// and it is using the cipher suite specified.
2295
- props .setProperty (PropertyKey .tlsCiphersuites .getKeyName (), "TLS_AES_256_GCM_SHA384" );
2304
+ props .setProperty (PropertyKey .tlsCiphersuites .getKeyName (), testCipher );
2296
2305
con = getConnectionWithProps (props );
2297
2306
assertTrue (((MysqlConnection ) con ).getSession ().isSSLEstablished ());
2298
- assertSessionStatusEquals (con .createStatement (), "ssl_cipher" , "TLS_AES_256_GCM_SHA384" );
2307
+ assertSessionStatusEquals (con .createStatement (), "ssl_cipher" , expectedCipher );
2299
2308
con .close ();
2300
2309
2301
2310
// TS.FR.2_2. Create a Connection with the connection property enabledSSLCipherSuites=[valid-cipher-suite] . Assess that the connection is created
2302
2311
// successfully and it is using the cipher suite specified.
2303
2312
props .remove (PropertyKey .tlsCiphersuites .getKeyName ());
2304
- props .setProperty ("enabledSSLCipherSuites" , "TLS_AES_256_GCM_SHA384" );
2313
+ props .setProperty ("enabledSSLCipherSuites" , testCipher );
2305
2314
con = getConnectionWithProps (props );
2306
2315
assertTrue (((MysqlConnection ) con ).getSession ().isSSLEstablished ());
2307
- assertSessionStatusEquals (con .createStatement (), "ssl_cipher" , "TLS_AES_256_GCM_SHA384" );
2316
+ assertSessionStatusEquals (con .createStatement (), "ssl_cipher" , expectedCipher );
2308
2317
con .close ();
2309
2318
props .remove ("enabledSSLCipherSuites" );
2310
2319
0 commit comments