Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Whittington <bc@whittington.net.nz>2014-03-07 00:15:11 +0400
committerTim Whittington <bc@whittington.net.nz>2014-03-10 12:27:39 +0400
commitf5212359caf7e5931ae0f48f00e328cc3b017317 (patch)
tree59c9fdb29509651205f28019b1d9c187de515955 /core/src/main/java/org/bouncycastle/crypto/io/CipherIOException.java
parent8eca220a9b2c68938b19ee6b88e0534d0a07c618 (diff)
Fix buffer underflows in cipher light weight API input/output streams and beef up testing.
Buffer underflows could occur when: - decrypting data > internal buffer size in output stream (input stream was fixed in prior commit) - packet mode AE cipher (e.g. CCM) is used with a data size > internal buffer size (since all output is buffered) Buffer is now sized appropriately to every cipher operation immediately prior to it (using getUpdateOutputSize/getOutputSize as appropriate) in both streams. Tests now run over boundaries of various block/buffer sizes to try to expose issues (0, 64 bit block, 128 bit block, 1K, 2K, 4K).
Diffstat (limited to 'core/src/main/java/org/bouncycastle/crypto/io/CipherIOException.java')
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/io/CipherIOException.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/io/CipherIOException.java b/core/src/main/java/org/bouncycastle/crypto/io/CipherIOException.java
new file mode 100644
index 00000000..beeb60bc
--- /dev/null
+++ b/core/src/main/java/org/bouncycastle/crypto/io/CipherIOException.java
@@ -0,0 +1,26 @@
+package org.bouncycastle.crypto.io;
+
+import java.io.IOException;
+
+/**
+ * {@link IOException} wrapper around an exception indicating a problem with the use of a cipher.
+ */
+public class CipherIOException
+ extends IOException
+{
+ private static final long serialVersionUID = 1L;
+
+ private final Throwable cause;
+
+ public CipherIOException(String message, Throwable cause)
+ {
+ super(message);
+
+ this.cause = cause;
+ }
+
+ public Throwable getCause()
+ {
+ return cause;
+ }
+} \ No newline at end of file