From 11adae7819b743ac6e1a8040018da69585101a43 Mon Sep 17 00:00:00 2001 From: valeriep Date: Mon, 31 Mar 2008 16:16:12 -0700 Subject: [PATCH] 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 --- src/share/classes/sun/security/pkcs11/P11Cipher.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/share/classes/sun/security/pkcs11/P11Cipher.java b/src/share/classes/sun/security/pkcs11/P11Cipher.java index 918c5ad26..f5da56bec 100644 --- a/src/share/classes/sun/security/pkcs11/P11Cipher.java +++ b/src/share/classes/sun/security/pkcs11/P11Cipher.java @@ -817,7 +817,8 @@ final class P11Cipher extends CipherSpi { 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)); } -- GitLab