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

Performance issue with SignatureAndHashAlgorithm.getSupportedAlgorithms

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: 8u66
    • Fix Version/s: None
    • Component/s: security-libs
    • Labels:

      Description

      Inside SignatureAndHashAlgorithm.getSupportedAlgorithms(), there is a collection of supported algorithms, which is loaded each time. This may hurt performance. If the constraints remain the same, supported algorithms can be loaded from a cache.

       static Collection<SignatureAndHashAlgorithm>
                  getSupportedAlgorithms(AlgorithmConstraints constraints) {

              Collection<SignatureAndHashAlgorithm> supported = new ArrayList<>();
              synchronized (priorityMap) {
                  for (SignatureAndHashAlgorithm sigAlg : priorityMap.values()) {
                      if (sigAlg.priority <= SUPPORTED_ALG_PRIORITY_MAX_NUM &&
                              constraints.permits(SIGNATURE_PRIMITIVE_SET,
                                      sigAlg.algorithm, null)) {
                          supported.add(sigAlg);
                      }
                  }
              }

              return supported;
          }

        Attachments

          Activity

            People

            • Assignee:
              xuelei Xue-Lei Fan
              Reporter:
              lwang Luyang Wang (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: