public static boolean isSelfSignedCertificate(X509Certificate certificate) {
        try {
            certificate.verify(certificate.getPublicKey());
            return true;
        } catch (GeneralSecurityException e) {
            return false;
        }
    }
Returns true if the specified certificate is a self-signed certificate.
@param certificate  the certificate to check
@return true if the specified certificate is a self-signed certificate.
xmppserver/src/main/java/org/jivesoftware/util/CertificateManager.java