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);
}