6682417: JCK test failed w/ ProviderException when decrypted data is not multiple of blocks
authorvaleriep
Mon, 31 Mar 2008 16:16:12 -0700
changeset 297 bec12c857972
parent 296 a26e4ea2ca63
child 298 bae6558c1edd
6682417: JCK test failed w/ ProviderException when decrypted data is not multiple of blocks Summary: Check for CKR_ENCRYPTED_DATA_LEN_RANGE and throw IllegalBlockSizeException Reviewed-by: wetmore
jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	Mon Mar 31 16:12:37 2008 -0700
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Cipher.java	Mon Mar 31 16:16:12 2008 -0700
@@ -817,7 +817,8 @@
         if (errorCode == CKR_BUFFER_TOO_SMALL) {
             throw (ShortBufferException)
                     (new ShortBufferException().initCause(e));
-        } else if (errorCode == CKR_DATA_LEN_RANGE) {
+        } else if (errorCode == CKR_DATA_LEN_RANGE ||
+                   errorCode == CKR_ENCRYPTED_DATA_LEN_RANGE) {
             throw (IllegalBlockSizeException)
                     (new IllegalBlockSizeException(e.toString()).initCause(e));
         }