use of org.apache.ws.security.message.WSSecEncrypt in project webservices-axiom by apache.
the class WSS4JTest method testEncryptHeader.
@Test
public void testEncryptHeader() throws Exception {
Vector<WSEncryptionPart> parts = new Vector<WSEncryptionPart>();
parts.add(new WSEncryptionPart("header", "urn:ns1", "Header"));
WSSecEncrypt encrypt = new WSSecEncrypt();
encrypt.setUserInfo("key2", "password");
encrypt.setEncryptSymmKey(false);
encrypt.setParts(parts);
SOAPMessage message = load("envelope1.xml");
Document doc = (Document) message;
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
encrypt.build(doc, crypto, secHeader);
}
Aggregations