File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
prov/src/main/java/org/bouncycastle/jcajce/io Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ public class CipherInputStream
3131 private final Cipher cipher ;
3232 private final byte [] inputBuffer = new byte [512 ];
3333 private boolean finalized = false ;
34+ private boolean nextChunkCalled = false ;
3435 private byte [] buf ;
3536 private int maxBuf ;
3637 private int bufOff ;
@@ -58,6 +59,7 @@ private int nextChunk()
5859 return -1 ;
5960 }
6061
62+ nextChunkCalled = true ;
6163 bufOff = 0 ;
6264 maxBuf = 0 ;
6365
@@ -86,10 +88,16 @@ private int nextChunk()
8688 }
8789
8890 private byte [] finaliseCipher ()
89- throws InvalidCipherTextIOException
91+ throws InvalidCipherTextIOException , IOException
9092 {
9193 try
9294 {
95+ // for an AEAD cipher with 0 encrypted Data nextChunk may not have been
96+ // called - we still need to read the MAC though!
97+ if (!nextChunkCalled )
98+ {
99+ nextChunk ();
100+ }
93101 if (!finalized )
94102 {
95103 finalized = true ;
You can’t perform that action at this time.
0 commit comments