policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);
protectionOrder.add(XMLSecurityConstants.ContentType.ENCRYPTION);
EncryptedElementSecurityEvent encryptedElementSecurityEvent = new EncryptedElementSecurityEvent(null, true, protectionOrder);
List<QName> headerPath = new ArrayList<QName>();
headerPath.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
headerPath.add(WSSConstants.TAG_dsig_Signature);
encryptedElementSecurityEvent.setElementPath(headerPath);
policyEnforcer.registerSecurityEvent(encryptedElementSecurityEvent);
encryptedElementSecurityEvent = new EncryptedElementSecurityEvent(null, true, protectionOrder);
headerPath = new ArrayList<QName>();
headerPath.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
headerPath.add(WSSConstants.TAG_wsse11_SignatureConfirmation);
encryptedElementSecurityEvent.setElementPath(headerPath);
policyEnforcer.registerSecurityEvent(encryptedElementSecurityEvent);
SignedPartSecurityEvent signedPartSecurityEvent = new SignedPartSecurityEvent(null, true, protectionOrder);
QName elementName = new QName("http://www.example.com", "bodyChildElement");
signedPartSecurityEvent.setXmlSecEvent(XMLSecEventFactory.createXmlSecStartElement(elementName, null, null));