【发布时间】:2017-07-24 11:46:44
【问题描述】:
我尝试让我的 apache cxf 客户端对附件进行签名和加密。因为我现在有了我的解决方案,它确实对邮件正文进行了签名和加密,但它忽略了附件。
我有以下代码:
Map<String, Object> props = new HashMap<>();
props.put("action", "Signature Encrypt");
props.put("signaturePropFile", "client.properties");
props.put("passwordCallbackClass", "******.KeystorePasswordCallback");
props.put("user", "node1");
props.put("signatureKeyIdentifier", "DirectReference");
props.put("signatureParts",
"{Element}{http://www.w3.org/2003/05/soap-envelope}Body;" +
"{}cid:Attachments;");
props.put("encryptionParts",
"{Content}{http://www.w3.org/2003/05/soap-envelope}Body;" +
"{Element}cid:Attachments;" );
props.put("encryptionPropFile", "client.properties");
props.put("encryptionKeyIdentifier", "IssuerSerial");
props.put("encryptionKeyTransportAlgorithm",
"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor(props);
client.getOutInterceptors().add(wss4jOut);
我正在关注this example 来编写我的代码。
而{}cid:Attachments 部分来自this apache page。
【问题讨论】:
标签: java cxf ws-security