private static String checkTrustedCertStatus(final X509Certificate certificate,
                                                 final X509TrustManager[] trustManagers) {
        for (val trustManager : trustManagers) {
            for (val trustedCert : trustManager.getAcceptedIssuers()) {
                try {
                    certificate.verify(trustedCert.getPublicKey());
                    return "Matches found: " + trustedCert.getIssuerDN().getName();
                } catch (final Exception e) {
                    LOGGER.trace("[{}]: [{}]", trustedCert.getIssuerDN().getName(), e.getMessage());
                }
            }
        }

        return "Not matched in trust store (which is expected of the host certificate that is part of a chain)";
    }
This is {@link ValidateEndpointCommand}.

@author Misagh Moayyed
@author John Gasper
@since 5.3.0
support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/util/ValidateEndpointCommand.java