How to force the Axis client to use the TLSv1.2 protocol

The third party with which our application integrates has recently made changes to its security layer protocols. In short, the My Axis client should now send calls using TLSv1.1 or TLSv1.2. I saw other posts about this, with some good ideas:

  • here
  • here .

After making these changes to the code, I called the calls again, I used the unscrew tool to track the sent packet, and I still see at the SSL level that the protocol used is TLSv1.

package fragment

what am i doing wrong here?

This is how I installed the new SocketSecureFactory:

AxisProperties.setProperty("axis.socketSecureFactory", MyTLSSocketSecureFactory.class.getName()); 

whereas MyTLSSocketSecureFactory:

 public class MyTLSSocketSecureFactory extends JSSESocketFactory { public MyTLSSocketSecureFactory(Hashtable attributes) { super(attributes); } @Override public Socket create(String host,int port, StringBuffer otherHeaders,BooleanHolder useFullURL) throws Exception{ Socket s = super.create(host, port, otherHeaders, useFullURL); ((SSLSocket)s).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"}); return s; } } 

would really appreciate any comments, thanks.

+7
ssl webservices-client axis
source share
2 answers

In your MyTLSSocketSecureFactory class, you need to create your own instance of SSLContext and then get sslFactory from the context.

Override the initFactory () method, and things like:

 initFactory() { SSLContext context = SSLContext.getInstance("TLSv1.2"); context.init(null, null, null); sslFactory = context.getSocketFactory(); } 
+5
source share

You can also just change the default SSLContext

  SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(null, null, null); SSLContext.setDefault(sslContext); 
0
source share

All Articles