// Set the key up
SecretKey key = generateDESSecretKey();
properties.setEncryptionKey(key);
properties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#tripledes-cbc");
SecurePart securePart =
new SecurePart(new QName("urn:example:po", "PaymentInfo"), SecurePart.Modifier.Content);
properties.addEncryptionPart(securePart);
securePart =
new SecurePart(new QName("urn:example:po", "ShippingAddress"), SecurePart.Modifier.Content);
properties.addEncryptionPart(securePart);
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");