private void enabledSslCipherSuites ( SSLSocket sslSocket ) throws SQLException { if ( options . enabledSslCipherSuites != null ) { List < String > possibleCiphers = Arrays . asList ( sslSocket . getSupportedCipherSuites ( ) ) ; String [ ] ciphers = options . enabledSslCipherSuites . split ( "[,;\\s]+" ) ; for ( String cipher : ciphers ) { if ( ! possibleCiphers . contains ( cipher ) ) { throw new SQLException ( "Unsupported SSL cipher '" + cipher + "'. Supported ciphers : " + possibleCiphers . toString ( ) . replace ( "[" , "" ) . replace ( "]" , "" ) ) ; } } sslSocket . setEnabledCipherSuites ( ciphers ) ; } }
Set ssl socket cipher according to options .