Preventing a possible NPE in JweOutputStream
@@ -79,11 +79,13 @@ public class JweOutputStream extends FilterOutputStream {
private void encryptAndWrite(byte[] chunk, int off, int len) throws IOException {
byte[] encrypted = encryptingCipher.update(chunk, off, len);
+ if (encrypted != null) {
if (authTagProducer != null) {
authTagProducer.update(encrypted, 0, encrypted.length);
}
encodeAndWrite(encrypted, 0, encrypted.length, false);
}
+ }
private void encodeAndWrite(byte[] encryptedChunk, int off, int len, boolean finalWrite) throws IOException {
byte[] theChunk = lastEncryptedDataChunk;
int lenToEncode = len;
