【发布时间】:2020-10-28 19:32:39
【问题描述】:
我的错误是这样的:
org.apache.cxf.interceptor.Fault:消息部分 {http://www.w3.org/2001/04/xmlenc#}EncryptedData 未被识别。 (是否存在于服务 WSDL 中?)
这是由于设置了用于解码加密数据的属性。我的问题是我在使用 apache cxf 时遇到问题(时间戳和签名工作正常)。
这是我的部分代码:
public WSS4JStaxInInterceptor wss4JStaxInInterceptor() 抛出异常 {
WSSSecurityProperties inProperties = new WSSSecurityProperties();
//inProperties.addAction(WSSConstants.USERNAMETOKEN);
inProperties.addAction(WSSConstants.TIMESTAMP);
inProperties.addAction(WSSConstants.SIGNATURE);
inProperties.addAction(WSSConstants.ENCRYPTION);
inProperties.setEncryptionUser("xxx");
inProperties.loadDecryptionKeystore(this.getClass().getClassLoader().getResource("\"C:\\\\Users\\\\miha_\\\\OneDrive\\\\Dokumenti\\\\Job\\\\Lj\\\\Spring\\\\demo\\\\src\\\\main\\\\resources\\\\xxxx.jks"),"xxx".toCharArray());;
inProperties.setMustUnderstand(false);
inProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("\"C:\\\\Users\\\\miha_\\\\OneDrive\\\\Dokumenti\\\\Job\\\\Lj\\\\Spring\\\\demo\\\\src\\\\main\\\\resources\\\\xxxx.jks"),"xxx".toCharArray());
inProperties.setSignatureUser("cbd");
//inProperties.setSignatureVerificationCryptoProperties(wss4jInProperties());
//inProperties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
inProperties.setCallbackHandler(new ClientKeystorePasswordCallback());
WSS4JStaxInInterceptor wss4JStaxInInterceptor = new WSS4JStaxInInterceptor(inProperties);
return wss4JStaxInInterceptor;
}
所以我定义了“loadDecryptionKeystore”,我在其中获得了密钥库。但是我在哪里定义要使用哪个证书(使用 setEncryptionUser("xxx"); ?)以及访问证书中私钥的密码在哪里? 我是否还应该定义其他东西,如何定义?
ps.:这是接收请求时服务器部分的配置
谢谢
【问题讨论】:
标签: spring-boot web-services spring-security cxf jax-ws