我面临一个哈希值不匹配的问题(从客户端)在对soap请求进行签名时,将附件作为mtom,但在将附件作为base64encoded包含并且mtom设置为false时没有遇到此错误。我有什么需要补充的,或者我做错了什么
下面是签名请求的代码剪贴
@Bean
public Jaxb2Marshaller getLGMarshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setMtomEnabled(true);
marshaller.setContextPath("pk.herman.jaxb");
return marshaller;
}
@Bean
public CryptoFactoryBean getCryptoFactoryBean() throws IOException {
CryptoFactoryBean cryptoFactoryBean = new CryptoFactoryBean();
cryptoFactoryBean.setKeyStorePassword(keyStorePassword);
cryptoFactoryBean.setKeyStoreLocation(new ClassPathResource(keyStoreClassPathResource));
return cryptoFactoryBean;
}
@Bean
public Wss4jSecurityInterceptor securityInterceptor() throws Exception {
Wss4jSecurityInterceptor securityInterceptor = new Wss4jSecurityInterceptor();
securityInterceptor.setSecurementActions("Signature Timestamp");
securityInterceptor.setSecurementTimeToLive(300000);
securityInterceptor.setTimestampPrecisionInMilliseconds(true);
securityInterceptor.setSecurementUsername(privatekeyAlias);
securityInterceptor.setSecurementPassword(privatekeyPassword);
securityInterceptor.setSecurementSignatureCrypto(getCryptoFactoryBean().getObject());
securityInterceptor.setSecurementSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"); securityInterceptor.setSecurementSignatureDigestAlgorithm("http://www.w3.org/2001/04/xmlenc#sha256");
securityInterceptor.setSecurementMustUnderstand(false);
securityInterceptor.setSecurementSignatureParts(
"{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body;{Content}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp");
return securityInterceptor;
}
下面是附件的请求有效负载示例(base64encoded)
<ns4:CRDoc>
<ns4:Attachment>iVBORw0KGgoAAAANSUhEUgAAAjsAAABWCAYAAAApI1f2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAABaRSURBVHhe7Z1PqB3XfcdHXTh/sA2SsrDiWAGrwna1ElIiUieFxk9ZCJIIN3p44SZtFhaY2OkmkcAFIahBajfFNgZ5ETepoEZKjBSDF9FzCnFdokTirVRZOBJYliwvoiewjJN4497PvDnRvHN/596ZO3Pm3/t+YHh3nt+dP2eudT739/udc9Z8PCIRQgghhBgof5H9FEIIIYQYJJIdIYQQQgwayY4QQgghBo1kRwghhBCDRrIjhBBCiEEj2RFCCCHEoJHsCCGEEGLQSHaEEEIIMWgkO0IIIYQYNJIdIYQQQgwayY4QQgghBo1kRwghhBCDRrIjhBBCiEEj2RFCCCHEoJHsCCGEEGLQSHaEEEIIMWgkO0IIIYQYNGs+HpG9FkKIqVy49ttk8fIvk3vW3Zc8uHl39lshhOguq1J2Tl+6ljz+49eyvVvsuHdD8vx3Hsr24hE6P5w9+Gj2Sohu8cZbJ0bbyeSdpTfTfUTnkR370td9hvs5ufh8snXjVyVvQuQ4fvx4uh06dCi59957s9/2E6WxOgSyJUQX+ddX/zF56fThP4sOLL5tC3vfQOCIVnF/B098Kzl17j+T339wNfuvQqxObty4kezfvz+VnU2bNiV79+5Nf9dXJDstIKkRfeP+DV/IXt3iw49ujoTnl9lef8lLG5Lz88Xnkx/96p+z3wixOnnhhReSS5cuZXvL+/Pz89le/5DsCCGmsvXzX81ereTCe7/NXvUTUnNIm8+Dm7+ZvRJi9YHkENXJs3...</ns4:Attachment>
<ns4:FileType>png</ns4:FileType>
</ns4:CRDoc>
下面是作为mtom的附件的请求负载示例
<ns3:CRDoc>
<ns3:Attachment>
<xop:Include
xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:e76de916-e37c-408e-828f-5ff8f292aeb5%40tabadul.sa"/>
</ns3:Attachment>
<ns3:FileType>png</ns3:FileType>
</ns3:CRDoc>
暂无答案!
目前还没有任何答案,快来回答吧!