From e3d4d73b6e5f597be5e3cf4d79e8ca527f636bb6 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 16 Apr 2010 09:54:13 +0100 Subject: [PATCH] 6944361: Missing CKR_ values in PKCS11Exception Summary: Allow native NSS errors to be observed and correctly reported Reviewed-by: wetmore, valeriep --- .../classes/sun/security/pkcs11/wrapper/PKCS11Exception.java | 4 ++++ src/share/classes/sun/security/x509/X509Key.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java b/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java index b66e23a73..4d00cf88e 100644 --- a/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java +++ b/src/share/classes/sun/security/pkcs11/wrapper/PKCS11Exception.java @@ -148,6 +148,7 @@ public class PKCS11Exception extends Exception { 0x00000115, 0x00000120, 0x00000121, + 0x00000130, 0x00000150, 0x00000160, 0x00000170, @@ -156,6 +157,7 @@ public class PKCS11Exception extends Exception { 0x00000191, 0x000001A0, 0x000001A1, + 0x00000200, 0x80000000, }; String[] errorMessages = new String[] { @@ -234,6 +236,7 @@ public class PKCS11Exception extends Exception { "CKR_WRAPPING_KEY_TYPE_INCONSISTENT", "CKR_RANDOM_SEED_NOT_SUPPORTED", "CKR_RANDOM_NO_RNG", + "CKR_DOMAIN_PARAMS_INVALID", "CKR_BUFFER_TOO_SMALL", "CKR_SAVED_STATE_INVALID", "CKR_INFORMATION_SENSITIVE", @@ -242,6 +245,7 @@ public class PKCS11Exception extends Exception { "CKR_CRYPTOKI_ALREADY_INITIALIZED", "CKR_MUTEX_BAD", "CKR_MUTEX_NOT_LOCKED", + "CKR_FUNCTION_REJECTED", "CKR_VENDOR_DEFINED", }; errorMap = new HashMap(); diff --git a/src/share/classes/sun/security/x509/X509Key.java b/src/share/classes/sun/security/x509/X509Key.java index 04855b19b..3db634e5f 100644 --- a/src/share/classes/sun/security/x509/X509Key.java +++ b/src/share/classes/sun/security/x509/X509Key.java @@ -171,7 +171,7 @@ public class X509Key implements PublicKey { in.data.getUnalignedBitString()); } catch (InvalidKeyException e) { - throw new IOException("subject key, " + e.getMessage()); + throw new IOException("subject key, " + e.getMessage(), e); } if (in.data.available() != 0) @@ -224,7 +224,7 @@ public class X509Key implements PublicKey { } catch (NoSuchAlgorithmException e) { // Return generic X509Key with opaque key data (see below) } catch (InvalidKeySpecException e) { - throw new InvalidKeyException(e.getMessage()); + throw new InvalidKeyException(e.getMessage(), e); } /* -- GitLab