JDK-8133535 : Better exception messaging in Ucrypto code
  • Type: Enhancement
  • Component: security-libs
  • Sub-Component: javax.crypto
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2015-08-13
  • Updated: 2016-08-24
  • Resolved: 2015-09-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u102Fixed 9 b83Fixed
Related Reports
Relates :  
Description
Some areas of exception handling in Ucrypto could be improved to give more information back to end user.

e.g. : 
--- a/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java
+++ b/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java
@@ -204,9 +204,11 @@

         // Make sure the proper opmode uses the proper key
         if (doEncrypt && (!(newKey instanceof RSAPublicKey))) {
-            throw new InvalidKeyException("RSAPublicKey required for encryption");
+            throw new InvalidKeyException("RSAPublicKey required for encryption." +
+                " Received: " + newKey.getClass().getName());
         } else if (!doEncrypt && (!(newKey instanceof RSAPrivateCrtKey))) {
-            throw new InvalidKeyException("RSAPrivateCrtKey required for decryption");
+            throw new InvalidKeyException("RSAPrivateCrtKey required for decryption." +
+                " Received: " + newKey.getClass().getName());
         }