Performance issue with SignatureAndHashAlgorithm.getSupportedAlgorithms

XMLWordPrintable

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

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

            Assignee:
            Xuelei Fan
            Reporter:
            Luyang Wang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: