簡體   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