public static String toString(final X509Certificate cert) {
        return new ToStringBuilder(cert, ToStringStyle.NO_CLASS_NAME_STYLE)
            .append("subjectDn", cert.getSubjectDN())
            .append("serialNumber", cert.getSerialNumber())
            .build();
    }
Creates a unique and human-readable representation of the given certificate.

@param cert Certificate.
@return String representation of a certificate that includes the subject and serial number.
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/crypto/CertUtils.java