CXF服务器 - 启用ssl null密码

时间:2014-12-18 15:08:32

标签: web-services ssl cxf

作为内部可信网络中的CXF服务器,我希望我的服务器只通过SSL进行通信 身份验证,完全没有加密。 为此,我试图在CXF配置文件中设置tlsServerParameters,除了只有空密码 像这样:

<httpj:tlsServerParameters >
  <sec:keyManagers> <my keyManager> </sec:keyManagers>
  <sec:trustManagers> <my trustManager> </sec:trustManagers>

  <sec:cipherSuites>
    <sec:cipherSuite>SSL_RSA_WITH_NULL_MD5</sec:cipherSuite>
    <sec:cipherSuite> <some more ciphers> </sec:cipherSuite>
  </sec:cipherSuites>

  <sec:cipherSuitesFilter>
    <sec:include>.*_WITH_NULL_.*</sec:include>
  </sec:cipherSuitesFilter>

</httpj:tlsServerParameters>

当我使用空密码连接客户端时,我会继续使用 &#34; SSLHandshakeException:没有共同的密码套件&#34;。

知道我做错了什么吗?

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

经过几天的研究,我通过扩展SslContextFactory并覆盖selectCipherSuites函数来完成它。

<httpj:engine port=" ... ">
  <httpj:tlsServerParametersRef id=" ... " />

  <httpj:connector>
    <bean class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
      <property name="port" value=" ... " />
      <property name="maxIdleTime" value=" ... "/>
      <property name="keystore" value= " ... " />
      <property name="password" value= " ... " />
      <property name="keyPassword" value= " ... " />
      <property name="keystoreType" value= " ... " />

      <constructor-arg>
       <bean class=" ... MyContextFactoryForConnector">
         <property name="keyStore" value=" ... "/>
         <property name="keyStoreType" value=" ... "/>
         <property name="keyStorePassword" value=" ... "/>
         <property name="KeyManagerPassword" value=" ... "/>
       </bean>
     </constructor-arg>
   </bean>

public class MyContextFactoryForConnector extends SslContextFactory
{
    @Override
    public String[] selectCipherSuites(String[] enabledCipherSuites, String[] supportedCipherSuites)
    {
        return supportedCipherSuites;  // includes null ciphers
    }
}

任何更优雅的方式(不涉及代码)都会好得多。

谢谢,