使用 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>