WSSecurityException.ErrorCode.FAILURE,
"empty", "no attachment callbackhandler supplied"
);
}
AttachmentRequestCallback attachmentRequestCallback = new AttachmentRequestCallback();
String id = encPart.getId().substring(4);
attachmentRequestCallback.setAttachmentId(id);
try {
attachmentCallbackHandler.handle(new Callback[]{attachmentRequestCallback});
} catch (Exception e) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e
);
}
String attachmentEncryptedDataType;
if ("Element".equals(encPart.getEncModifier())) {
attachmentEncryptedDataType = WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_COMPLETE;
} else {
attachmentEncryptedDataType = WSConstants.SWA_ATTACHMENT_ENCRYPTED_DATA_TYPE_CONTENT_ONLY;
}
List<Attachment> attachments = attachmentRequestCallback.getAttachments();
for (int i = 0; i < attachments.size(); i++) {
Attachment attachment = attachments.get(i);
final String attachmentId = attachment.getId();
String encEncryptedDataId = config.getIdAllocator().createId("ED-", attachmentId);