繁体   English   中英

apache cxf-如何解析密钥库中的客户端证书

[英]apache cxf - how to resolve client certificates in keystore

我写了一个ws-security服务,到目前为止效果很好。 我只有一个问题。 我的服务只能是来自单个客户端的用户...这是因为service-config.xml,在这里我需要命名要为其加密传出消息的显式用户。 我的服务豆看起来像这样

    <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是唯一能够与服务器通信的客户端。 我想在我的密钥库中存储几个客户端密钥,并且服务将自行决定使用哪个密钥。

如果有人可以帮助我,那会很好。 谢谢

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

科尔姆

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM