}
}
if (useJweOutputStream) {
JweEncryption encryption = theEncryptionProvider.createJweEncryption(ctString);
try {
JweCompactProducer.startJweContent(actualOs,
encryption.getHeaders(),
writer,
encryption.getContentEncryptionKey(),
encryption.getIv());
} catch (IOException ex) {
throw new SecurityException(ex);
}
OutputStream jweStream = new JweOutputStream(actualOs, encryption.getCipher(),
encryption.getAuthTagLen());
if (encryption.isCompressionSupported()) {
jweStream = new DeflaterOutputStream(jweStream);
}
ctx.setOutputStream(jweStream);
ctx.proceed();