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
--- 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));
}