WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

How to find out which cipher suites are available on WAS Java

  • 1.  How to find out which cipher suites are available on WAS Java

    Posted Wed July 10, 2024 12:49 AM

    I use multiple versions of WAS java in multiple environments. 

    I would like to know what cipher suites are available for each Java environment. How can I find this out?

    ( For example, how can I find out what cipher suites are available in IBM SDK 7.0.9.60 ? )



    ------------------------------
    Ken Iida
    Ken.Iida@kyndryl.com
    NagoyaJapan
    ------------------------------


  • 2.  RE: How to find out which cipher suites are available on WAS Java

    Posted Thu July 11, 2024 03:28 AM

    Hello Ken, 

    I use the following javacode:

    import java.util.Iterator;
    import java.util.Map;
    import java.util.TreeMap;
    import javax.net.ssl.SSLServerSocketFactory;
     
    public class Ciphers
    {
        public static void main(String[] args)
            throws Exception
        {
            SSLServerSocketFactory ssf = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
     
            String[] defaultCiphers = ssf.getDefaultCipherSuites();
            String[] availableCiphers = ssf.getSupportedCipherSuites();
     
            TreeMap<String, Boolean> ciphers = new TreeMap<String, Boolean>();
     
            for(int i=0; i<availableCiphers.length; ++i )
                ciphers.put(availableCiphers[i], Boolean.FALSE);
     
            for(int i=0; i<defaultCiphers.length; ++i )
                ciphers.put(defaultCiphers[i], Boolean.TRUE);
     
            System.out.println("Default\tCipher");
            for(Iterator i = ciphers.entrySet().iterator(); i.hasNext(); ) {
                Map.Entry cipher=(Map.Entry)i.next();
     
                if(Boolean.TRUE.equals(cipher.getValue()))
                    System.out.print('*');
                else
                    System.out.print(' ');
     
                System.out.print('\t');
                System.out.println(cipher.getKey());
            }
        }
    }

    Best regards 

    André



    ------------------------------
    Andre Jahn
    WebAdministrator
    Deutsche Bundesbank
    Duesseldorf
    1-555-555-5555
    ------------------------------