java.lang.Object
org.miaixz.bus.http.secure.CertificateChainCleaner
org.miaixz.bus.http.secure.BasicCertificateChainCleaner
A certificate chain cleaner that builds a trust chain starting from a server certificate, following the chain of
issuers until a trusted root certificate is found. This class duplicates the clean chain building that is performed
by the TLS implementation. It is used when other mechanisms, such as those provided by the platform (e.g., on
Android), are not available.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionBasicCertificateChainCleaner(TrustRootIndex trustRootIndex) Constructs a new BasicCertificateChainCleaner. -
Method Summary
Modifier and TypeMethodDescriptionclean(List<Certificate> chain, String hostname) Returns a cleaned chain forchain.booleaninthashCode()Methods inherited from class org.miaixz.bus.http.secure.CertificateChainCleaner
get, get
-
Constructor Details
-
BasicCertificateChainCleaner
Constructs a new BasicCertificateChainCleaner.- Parameters:
trustRootIndex- An index of trusted root certificates to use for building the chain.
-
-
Method Details
-
clean
public List<Certificate> clean(List<Certificate> chain, String hostname) throws SSLPeerUnverifiedException Returns a cleaned chain forchain. This method throws if the complete chain to a trusted CA certificate cannot be constructed. This is unexpected unless the trust root index in this class has a different trust manager than what was used to establishchain.- Specified by:
cleanin classCertificateChainCleaner- Parameters:
chain- The raw certificate chain from the peer.hostname- The hostname of the peer.- Returns:
- A validated and cleaned certificate chain.
- Throws:
SSLPeerUnverifiedException- if the chain cannot be validated.
-
hashCode
public int hashCode() -
equals
-