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

Better exception logging in crypto code

    XMLWordPrintable

    Details

      Description

      Debugged an issue recently related to crypto provider jar file loading. Some of our crypto code handles failures silently. We should fix that.

      src/share/classes/javax/crypto/JceSecurity.java

          static synchronized Exception getVerificationResult(Provider p) {
              Object o = verificationResults.get(p);
              if (o == PROVIDER_VERIFIED) {
                  return null;
              } else if (o != null) {
                  return (Exception)o;
              }
              if (verifyingProviders.get(p) != null) {
                  // this method is static synchronized, must be recursion
                  // return failure now but do not save the result
                  return new NoSuchProviderException("Recursion during verification");
              }
              try {
                  verifyingProviders.put(p, Boolean.FALSE);
                  URL providerURL = getCodeBase(p.getClass());
                  verifyProviderJar(providerURL);
                  // Verified ok, cache result
                  verificationResults.put(p, PROVIDER_VERIFIED);
                  return null;
              } catch (Exception e) {
                  verificationResults.put(p, e);
                  return e;
              } finally {
                  verifyingProviders.remove(p);
              }
          }

      ==
      we should log issues which are detected with provider jar files.
      ==

      There may be other related cases to be examined.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              coffeys Sean Coffey
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: