diff options
author | Matt Wringe <mwringe@redhat.com> | 2006-07-14 14:04:44 +0000 |
---|---|---|
committer | Matt Wringe <mwringe@redhat.com> | 2006-07-14 14:04:44 +0000 |
commit | de3947ab8795d59bc623798c6877ddee4a288f51 (patch) | |
tree | 7744d9a91b57b143cf04a78be79ff785338f053a | |
parent | 2b780c44a9dbb0492b4df3edd8fa50ed0146e6fa (diff) | |
download | classpath-de3947ab8795d59bc623798c6877ddee4a288f51.tar.gz |
* gnu/javax/crypto/jce/cipher/CipherAdapter.java
(engineInit): Throw InvalidAlgorithmParameterException
for invalid IVParameterSpec IV length.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gnu/javax/crypto/jce/cipher/CipherAdapter.java | 6 |
2 files changed, 12 insertions, 0 deletions
@@ -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)); |