|
Relates :
|
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());
}