use of org.apache.ws.security.WSEncryptionPart 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);
}
use of org.apache.ws.security.WSEncryptionPart in project webservices-axiom by apache.
the class WSS4JTest method testSignHeaderAndBody.
@Test
public void testSignHeaderAndBody() throws Exception {
Vector<WSEncryptionPart> parts = new Vector<WSEncryptionPart>();
parts.add(new WSEncryptionPart("header", "urn:ns1", ""));
parts.add(new WSEncryptionPart("Body", "http://schemas.xmlsoap.org/soap/envelope/", ""));
testSignature("envelope1.xml", parts);
}
use of org.apache.ws.security.WSEncryptionPart in project webservices-axiom by apache.
the class WSS4JTest method testSignPartById.
@Test
public void testSignPartById() throws Exception {
Vector<WSEncryptionPart> parts = new Vector<WSEncryptionPart>();
parts.add(new WSEncryptionPart("my-id"));
testSignature("envelope2.xml", parts);
}
Aggregations