}
}
@SuppressWarnings("unchecked")
private void handleAttachments(JAXBFilterProcessingContext context, ArrayList edList, Key key,KeyInfo ki,Target target) throws XWSSecurityException {
SecuredMessage message = context.getSecuredMessage();
AttachmentSet as = message.getAttachments();
if(as != null && as.isEmpty()){
logger.log(Level.WARNING, LogStringsMessages.WSS_1244_NO_ATTACHMENT_FOUND());
return;
}
String dataEncAlg = SecurityUtil.getDataEncryptionAlgo(context);
AttachmentSet newAttachmentSet = new AttachmentSetImpl();
for(Attachment attachment : as){
SecurityHeaderElement ed = (SecurityHeaderElement)wsf.createEncryptedData(context.generateID(), attachment, dataEncAlg, ki, key, (EncryptionTarget)target);
context.getSecurityHeader().add(ed);
edList.add(ed);
Attachment encryptedAttachment = new EncryptedAttachment(attachment, dataEncAlg, key);
newAttachmentSet.add(encryptedAttachment);
}
message.setAttachments(newAttachmentSet);
}