}
checkDecryptedData(she, ek.getPolicy());
} else {
// Handle Encrypted Attachment here
byte[] decryptedMimeData = ed.getDecryptedMimeData(ek.getKey(ed.getEncryptionAlgorithm()));
Attachment as = new AttachmentImpl(ed.getAttachmentContentId(), decryptedMimeData, ed.getAttachmentMimeType());
securityContext.getDecryptedAttachmentSet().add(as);
ek.getPendingReferenceList().remove(ed.getId());
if (ek.getPendingReferenceList().isEmpty()) {
pendingElement = null;
bufferedHeaders.remove(ek);
addSecurityHeader(ek);
}
}
} else {
if (!lookInBufferedHeaders(ed, currentParentNS)) {
addSecurityHeader(ed);
}
}
} else if (pendingElement != null && pendingElement instanceof ReferenceListHeader) {
ReferenceListHeader refList = (ReferenceListHeader) pendingElement;
if (refList.getPendingReferenceList().contains(ed.getId())) {
//for policy verification
refList.getPolicy().setKeyBinding(ed.getInferredKB());
//
if (!ed.hasCipherReference()) {
XMLStreamReader decryptedData = ed.getDecryptedData();
if (decryptedData.getEventType() != XMLStreamReader.START_ELEMENT) {
StreamUtil.moveToNextElement(decryptedData);
}
SecurityHeaderProcessor shp = new SecurityHeaderProcessor(context, currentParentNS, staxIF, creator);
SecurityHeaderElement she = shp.createHeader(decryptedData);
encIds.put(ed.getId(), she.getId());
edAlgos.put(ed.getId(), ed.getEncryptionAlgorithm());
refList.getPendingReferenceList().remove(ed.getId());
if (refList.getPendingReferenceList().isEmpty()) {
pendingElement = null;
}
checkDecryptedData(she, refList.getPolicy());
} else {
// Handle Encrypted Attachment here
byte[] decryptedMimeData = ed.getDecryptedMimeData();
Attachment as = new AttachmentImpl(ed.getAttachmentContentId(), decryptedMimeData, ed.getAttachmentMimeType());
securityContext.getDecryptedAttachmentSet().add(as);
refList.getPendingReferenceList().remove(ed.getId());
if (refList.getPendingReferenceList().isEmpty()) {
pendingElement = null;
}