private OutboundWSSec outboundWSSecCompressed = null;
private void doStreamingSecurityOutboundCompressed(File source, File output, String compress) throws Exception {
if (outboundWSSecCompressed == null) {
WSSSecurityProperties securityProperties = new WSSSecurityProperties();
securityProperties.setCallbackHandler(new CallbackHandlerImpl());
securityProperties.setEncryptionUser("receiver");
securityProperties.loadEncryptionKeystore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
securityProperties.setSignatureUser("transmitter");
securityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
List<WSSConstants.Action> actions = new ArrayList<WSSConstants.Action>();
actions.add(WSSConstants.TIMESTAMP);
actions.add(WSSConstants.SIGNATURE);
actions.add(WSSConstants.ENCRYPT);
securityProperties.setActions(actions);
securityProperties.setTimestampTTL(60 * 60 * 24 * 7); //a week for testing:)
securityProperties.setEncryptionCompressionAlgorithm(compress);
outboundWSSecCompressed = WSSec.getOutboundWSSec(securityProperties);
}
InputStream sourceDocument = new BufferedInputStream(new FileInputStream(source));
XMLStreamWriter xmlStreamWriter = outboundWSSecCompressed.processOutMessage(new BufferedOutputStream(new FileOutputStream(output)), "UTF-8", new ArrayList<SecurityEvent>());