如何在WSS4J Spring Security中使用加密密码

时间:2012-11-22 12:35:33

标签: java encryption spring-ws

我通过WSS4JSecurityInterceptor使用Spring WS Security。但是,在验证签名时我需要读取密钥库密码。

密钥库密码将被加密。在验证签名之前,能告诉我如何解密吗?

我的配置如下:

<bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
    <property name="validationActions" value="Signature"/>
    <property name="validationSignatureCrypto">
        <bean class="org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean">
            <property name="keyStorePassword" value="123456"/>
            <property name="keyStoreLocation" value="classpath:/keystore.jks"/>
        </bean>
    </property>
</bean>

由于

1 个答案:

答案 0 :(得分:4)

使用Spring签名 - Ws WSS4JSecurityInterceptor

使用以下方式生成Keytool:

keytool -genkey -alias signFiles -keypass kpi135 -keystore akulastore.jks -storepass ab987c

为Keytool生成证书:

keytool -certreq -alias signFiles -keystore akulastore.jks -file cert.csr

将Keytool,证书放在客户端。

将Keytool置于服务器端

并将配置设为:

Server Side Interceptor

<bean id="wsDigCerSecurityInterceptor" 
   class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="validationActions" value="Signature"/>
<property name="validationSignatureCrypto">
<bean
   class="org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean">
<property name="keyStorePassword" value="ab987c"/>
<property name="keyStoreLocation" value="classpath:/akulastore.jks"/>
</bean>
</property>
</bean>


Client Side Interceptor

<bean id="wsDigCerSecurityInterceptor"
   class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="securementActions" value="Signature"/>
<property name="securementUsername" value="signFiles"/>
<property name="securementPassword" value="kpi135"/>
<property name="securementSignatureCrypto">
<bean 
   class="org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean">
<property name="keyStorePassword" value="ab987c"/>
<property name="keyStoreLocation" value="classpath:/akulastore.jks"/>
</bean>
</property>
</bean>