【问题标题】:apache cxf - how to resolve client certificates in keystoreapache cxf - 如何解析密钥库中的客户端证书
【发布时间】:2014-07-01 11:07:55
【问题描述】:

我编写了一个 ws-security 服务,到目前为止运行良好。我只有一个问题。我的服务只能是来自单个客户端的用户......这是因为我需要在 service-config.xml 中命名我希望传出消息加密的显式用户。 我的服务 bean 看起来像这样

    <bean id="TimestampSignEncrypt_Request" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
        <constructor-arg>
            <map>
                <!-- Use this action order for local clients -->
                <entry key="action" value="Timestamp Signature Encrypt"/>
                <!-- Use this action spec for WCF clients
               <entry key="action" value="Signature Encrypt Timestamp"/>
               -->
                <entry key="signaturePropFile"
                      value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/alice.properties"/>
                <entry key="decryptionPropFile"
                      value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/bob.properties"/>
                <entry key="passwordCallbackClass"
                      value="de.narz.apacheCXFTest.helloWorld.passwordHandling.PasswordCallbackHandler"/>
            </map>
        </constructor-arg>
    </bean>
    <!--
        WSS4JOutInterceptor for encoding and signing the SOAP response.
        There are some attacks that exploit the "cbc" mode of a Symmetric Encryption Algorithm. WSS4J has support for
         "gcm" mode algorithms as well. This can be specified via WSHandlerConstants.ENC_SYM_ALGO
         ("encryptionSymAlgorithm"), for example to "http://www.w3.org/2009/xmlenc11#aes128-gcm".
   -->
    <bean id="TimestampSignEncrypt_Response" class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
        <constructor-arg>
            <map>
                <entry key="action" value="Timestamp Signature Encrypt"/>
                <entry key="user" value="bob"/>
                <entry key="signaturePropFile"
                      value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/bob.properties"/>
                <entry key="encryptionPropFile"
                      value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/alice.properties"/>
                <entry key="signatureKeyIdentifier" value="DirectReference"/>
                <entry key="encryptionUser" value="Alice"/>
                <entry key="passwordCallbackClass"
                      value="de.narz.apacheCXFTest.helloWorld.passwordHandling.PasswordCallbackHandler"/>
                <entry key="signatureParts"
                      value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body"/>
                <entry key="encryptionParts"
                      value="{Element}{http://www.w3.org/2000/09/xmldsig#}Signature;{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body"/>
                <entry key="encryptionSymAlgorithm"
                      value="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
            </map>
        </constructor-arg>
    </bean>

我能做些什么来强制服务自己确定客户爱丽丝?像这样,我的 alice-client 是唯一能够与服务器通信的客户端。我想在我的密钥库中存储几个客户端密钥,服务将自行决定使用哪个密钥。

如果有人可以帮助我,那就太好了。 谢谢

【问题讨论】:

    标签: java spring web-services cxf ws-security


    【解决方案1】:

    您可以指定“useReqSigCert”的“encryptionUser”,而不是在您的服务中指定“Alice”的“encryptionUser”。这是一个特殊值,告诉 CXF/WSS4J 使用客户端签名证书进行加密。

    科尔姆。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多