}
@Test
public void testTripleDESKW() throws Exception {
// Set up the Configuration
XMLSecurityProperties properties = new XMLSecurityProperties();
List<XMLSecurityConstants.Action> actions = new ArrayList<XMLSecurityConstants.Action>();
actions.add(XMLSecurityConstants.ENCRYPT);
properties.setActions(actions);
// Set up the Key
KeyGenerator keygen = KeyGenerator.getInstance("DESede");
keygen.init(192);
SecretKey key = keygen.generateKey();
properties.setEncryptionKey(key);
String algorithm = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
properties.setEncryptionSymAlgorithm(algorithm);
// Set up the Key Wrapping Key
keygen = KeyGenerator.getInstance("DESede");
keygen.init(192);
SecretKey keyWrappingKey = keygen.generateKey();
String wrappingAlgorithm = "http://www.w3.org/2001/04/xmlenc#kw-tripledes";
properties.setEncryptionKeyTransportAlgorithm(wrappingAlgorithm);
properties.setEncryptionTransportKey(keyWrappingKey);
SecurePart securePart =
new SecurePart(new QName("urn:example:po", "PaymentInfo"), SecurePart.Modifier.Element);
properties.addEncryptionPart(securePart);
OutboundXMLSec outboundXMLSec = XMLSec.getOutboundXMLSec(properties);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamWriter xmlStreamWriter = outboundXMLSec.processOutMessage(baos, "UTF-8");