public static byte[] getBytesFromAttachment( String xopUri, CallbackHandler attachmentCallbackHandler ) throws WSSecurityException { return getBytesFromAttachment(xopUri, attachmentCallbackHandler, true); }
public static byte[] getBytesFromAttachment( String xopUri, RequestData data ) throws WSSecurityException { return getBytesFromAttachment(xopUri, data.getAttachmentCallbackHandler()); }
public static void inlineAttachments(List<Element> includeElements, CallbackHandler attachmentCallbackHandler, boolean removeAttachments) throws WSSecurityException { for (Element includeElement : includeElements) { String xopURI = includeElement.getAttributeNS(null, "href"); if (xopURI != null) { // Retrieve the attachment bytes byte[] attachmentBytes = WSSecurityUtil.getBytesFromAttachment(xopURI, attachmentCallbackHandler, removeAttachments); String encodedBytes = org.apache.xml.security.utils.XMLUtils.encodeToString(attachmentBytes); Node encodedChild = includeElement.getOwnerDocument().createTextNode(encodedBytes); includeElement.getParentNode().replaceChild(encodedChild, includeElement); } } }
if (xopURI != null) { byte[] attachmentBytes = WSSecurityUtil.getBytesFromAttachment(xopURI, data); String encodedBytes = org.apache.xml.security.utils.XMLUtils.encodeToString(attachmentBytes);
String xopUri = elementChild.getAttributeNS(null, "href"); if (xopUri != null && xopUri.startsWith("cid:")) { byte[] content = WSSecurityUtil.getBytesFromAttachment(xopUri, data); token.setRawToken(content);
encryptedEphemeralKey = WSSecurityUtil.getBytesFromAttachment(xopUri, data); } else { encryptedEphemeralKey = EncryptionUtils.getDecodedBase64EncodedData(xencCipherValue);