我们的应用程序与之集成的第三方最近对其安全级别协议进行了更改。简而言之,My Axis 客户端现在应该使用 TLSv1.1 或 TLSv1.2 发送呼叫。
我看过其他关于此的帖子,其中有一些好的想法:
- here https://stackoverflow.com/questions/29142654/force-axis-client-to-use-tls
-
here https://stackoverflow.com/questions/651684/axis-securesocketfactory-setting-the-constructor-attributes.
在代码中进行这些更改后,我再次触发了调用,
我使用了截图工具来监控发送的包,我仍然在 SSL 层看到正在使用的协议是 TLSv1。
数据包片段 https://i.stack.imgur.com/htrRE.jpg
我在这里做错了什么?
这就是我设置新 SocketSecureFactory 的方式:
AxisProperties.setProperty("axis.socketSecureFactory", MyTLSSocketSecureFactory.class.getName());
而 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;
}
}
非常感谢任何评论,
谢谢。