This enhancement simplifies and improves the performance of the Comparator that the PKIX CertPathBuilder uses to sort candidate certificates.
[RFC 5280](https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.1) requires that certificates include authority and subject key identifiers to facilitate cert path discovery. When the certificates comply with RFC 5280, the sorting algorithm is fast and efficient. However, there may be cases where certificates do not include the proper KIDs, for legacy or other reasons. This enhancement targets those cases and increases the performance of `CertPathBuilder.build` by approximately 2x in tests involving certificates that do not contain KIDs. Specific changes include: - Removed and simplified some of the steps in `PKIXCertComparator.compare` method. Some of these steps were not a good representation of common certificate hierarchies and were overly expensive to perform. - Several methods in `X500Name` and `Builder` have been made obsolete and thus removed. - `X500Name` has been changed to use shared secrets instead of reflection to access non-public members of `X500Principal`, and vice-versa. - The `CertificateBuilder` test code has been enhanced to set reasonable defaults for serial number and validity fields of a certificate ------------- Commit messages: - Fix whitespace. - Update copyrights. - Merge - Simplify and improve performance of PKIXCertComparator. - Regression test. - Use shared secrets instead of reflection. - Remove obsolete methods. - Enhance code to use defaults for serial number and validity fields. - Use shared secrets instead of reflection. Remove obsolete methods. - Use shared secrets instead of reflection to access X500Name. - ... and 1 more: https://git.openjdk.org/jdk/compare/84c23792...7098b73c Changes: https://git.openjdk.org/jdk/pull/17248/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17248&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8317431 Stats: 811 lines in 8 files changed: 319 ins; 460 del; 32 mod Patch: https://git.openjdk.org/jdk/pull/17248.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/17248/head:pull/17248 PR: https://git.openjdk.org/jdk/pull/17248