WSSecEncrypt builder = new WSSecEncrypt();
builder.setKeyIdentifierType(WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER);
builder.setSymmetricKey(key);
builder.setEncryptSymmKey(false);
Document securedDocument = builder.build(doc, null, secHeader);
XPathExpression xPathExpression = getXPath("/soap:Envelope/soap:Body/xenc:EncryptedData/dsig:KeyInfo/wsse:SecurityTokenReference/wsse:KeyIdentifier[@ValueType='http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKeySHA1']");
Node node = (Node) xPathExpression.evaluate(securedDocument, XPathConstants.NODE);
Assert.assertNotNull(node);