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

Performance issue with SignatureAndHashAlgorithm.getSupportedAlgorithms

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 8u66
    • 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;
          }

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

              Created:
              Updated:
              Resolved: