@@ -2267,44 +2267,53 @@ public void testTLSVersionRemoval() throws Exception {
22672267 assumeTrue (supportsTestCertificates (this .stmt ),
22682268 "This test requires the server configured with SSL certificates from ConnectorJ/src/test/config/ssl-test-certs" );
22692269
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+
22702279 Connection con = null ;
22712280 Properties props = new Properties ();
22722281 props .setProperty (PropertyKey .sslMode .getKeyName (), SslMode .REQUIRED .name ());
22732282 props .setProperty (PropertyKey .allowPublicKeyRetrieval .getKeyName (), "true" );
22742283
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 );
22782287 con = getConnectionWithProps (props );
22792288 assertTrue (((MysqlConnection ) con ).getSession ().isSSLEstablished ());
2280- assertSessionStatusEquals (con .createStatement (), "ssl_version" , "TLSv1.2" );
2289+ assertSessionStatusEquals (con .createStatement (), "ssl_version" , testTlsVersion );
22812290 con .close ();
22822291
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.
22852294 props .remove (PropertyKey .tlsVersions .getKeyName ());
2286- props .setProperty ("enabledTLSProtocols" , "TLSv1.2" );
2295+ props .setProperty ("enabledTLSProtocols" , testTlsVersion );
22872296 con = getConnectionWithProps (props );
22882297 assertTrue (((MysqlConnection ) con ).getSession ().isSSLEstablished ());
2289- assertSessionStatusEquals (con .createStatement (), "ssl_version" , "TLSv1.2" );
2298+ assertSessionStatusEquals (con .createStatement (), "ssl_version" , testTlsVersion );
22902299 con .close ();
22912300 props .remove ("enabledTLSProtocols" );
22922301
22932302 // TS.FR.2_1. Create a Connection with the connection property tlsCiphersuites=[valid-cipher-suite]. Assess that the connection is created successfully
22942303 // 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 );
22962305 con = getConnectionWithProps (props );
22972306 assertTrue (((MysqlConnection ) con ).getSession ().isSSLEstablished ());
2298- assertSessionStatusEquals (con .createStatement (), "ssl_cipher" , "TLS_AES_256_GCM_SHA384" );
2307+ assertSessionStatusEquals (con .createStatement (), "ssl_cipher" , expectedCipher );
22992308 con .close ();
23002309
23012310 // TS.FR.2_2. Create a Connection with the connection property enabledSSLCipherSuites=[valid-cipher-suite] . Assess that the connection is created
23022311 // successfully and it is using the cipher suite specified.
23032312 props .remove (PropertyKey .tlsCiphersuites .getKeyName ());
2304- props .setProperty ("enabledSSLCipherSuites" , "TLS_AES_256_GCM_SHA384" );
2313+ props .setProperty ("enabledSSLCipherSuites" , testCipher );
23052314 con = getConnectionWithProps (props );
23062315 assertTrue (((MysqlConnection ) con ).getSession ().isSSLEstablished ());
2307- assertSessionStatusEquals (con .createStatement (), "ssl_cipher" , "TLS_AES_256_GCM_SHA384" );
2316+ assertSessionStatusEquals (con .createStatement (), "ssl_cipher" , expectedCipher );
23082317 con .close ();
23092318 props .remove ("enabledSSLCipherSuites" );
23102319
0 commit comments