Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8133535

Better exception messaging in Ucrypto code

XMLWordPrintable

    • b83
    • generic
    • generic
    • Verified

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

              coffeys Sean Coffey
              coffeys Sean Coffey
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: