summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Wringe <mwringe@redhat.com>2006-07-14 14:04:44 +0000
committerMatt Wringe <mwringe@redhat.com>2006-07-14 14:04:44 +0000
commitde3947ab8795d59bc623798c6877ddee4a288f51 (patch)
tree7744d9a91b57b143cf04a78be79ff785338f053a
parent2b780c44a9dbb0492b4df3edd8fa50ed0146e6fa (diff)
downloadclasspath-de3947ab8795d59bc623798c6877ddee4a288f51.tar.gz
* gnu/javax/crypto/jce/cipher/CipherAdapter.java
(engineInit): Throw InvalidAlgorithmParameterException for invalid IVParameterSpec IV length.
-rw-r--r--ChangeLog6
-rw-r--r--gnu/javax/crypto/jce/cipher/CipherAdapter.java6
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index cf66b6342..623accb33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-07-14 Matt Wringe <mwringe@redhat.com>
+
+ * gnu/javax/crypto/jce/cipher/CipherAdapter.java
+ (engineInit): Throw InvalidAlgorithmParameterException
+ for invalid IVParameterSpec IV length.
+
2006-07-14 David Gilbert <david.gilbert@object-refinery.com>
* java/awt/image/MultiPixelPackedSampleModel.java
diff --git a/gnu/javax/crypto/jce/cipher/CipherAdapter.java b/gnu/javax/crypto/jce/cipher/CipherAdapter.java
index 9dbc40df7..b7cd755f5 100644
--- a/gnu/javax/crypto/jce/cipher/CipherAdapter.java
+++ b/gnu/javax/crypto/jce/cipher/CipherAdapter.java
@@ -343,6 +343,12 @@ class CipherAdapter
}
else if (params instanceof IvParameterSpec)
{
+ // The size of the IV must match the block size
+ if (((IvParameterSpec) params).getIV().length != cipher.defaultBlockSize())
+ {
+ throw new InvalidAlgorithmParameterException();
+ }
+
attributes.put(IMode.IV, ((IvParameterSpec) params).getIV());
blockLen = cipher.defaultBlockSize();
attributes.put(IBlockCipher.CIPHER_BLOCK_SIZE, Integer.valueOf(blockLen));