public static boolean isForThisDomain( X509Certificate certificate )
    {
        final String domainName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();

        final List<String> serverIdentities = CertificateManager.getServerIdentities( certificate );
        for ( String identity : serverIdentities )
        {
            if ( DNSUtil.isNameCoveredByPattern( domainName, identity ) )
            {
                return true;
            }
        }

        Log.info( "The supplied certificate chain does not cover the domain of this XMPP service ('" + domainName + "'). Instead, it covers " + Arrays.toString( serverIdentities.toArray(new String[0]) ) );
        return false;
    }
Verifies that the subject of the certificate matches the domain of this XMPP service.

@param certificate The certificate to verify (cannot be null)
@return true when the certificate subject is this domain, otherwise false.
xmppserver/src/main/java/org/jivesoftware/openfire/keystore/IdentityStore.java