Module bus.http

Class BasicTrustRootIndex

java.lang.Object
org.miaixz.bus.http.secure.BasicTrustRootIndex
All Implemented Interfaces:
TrustRootIndex

public class BasicTrustRootIndex extends Object implements TrustRootIndex
An in-memory index of trusted root certificates. This class holds a cache of CA certificates, indexed by their subject distinguished name, to allow for quick lookups when building a certificate chain.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • BasicTrustRootIndex

      public BasicTrustRootIndex(X509Certificate... caCerts)
      Creates a new index from a set of CA certificates.
      Parameters:
      caCerts - The trusted CA certificates.
  • Method Details

    • findByIssuerAndSignature

      public X509Certificate findByIssuerAndSignature(X509Certificate cert)
      Finds a trusted CA certificate that signed the given certificate. This method works by first finding candidate certificates based on the issuer's distinguished name and then verifying the signature.
      Specified by:
      findByIssuerAndSignature in interface TrustRootIndex
      Parameters:
      cert - The certificate for which to find the issuer.
      Returns:
      The signing CA certificate, or null if no trusted issuer is found.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object