protected boolean corresponds( String alias, List<X509Certificate> certificates ) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException
    {
        if ( !store.containsAlias( alias ) ) {
            return false;
        }

        final Key key = store.getKey( alias, configuration.getPassword() );
        if ( key == null ) {
            return false;
        }

        if ( !(key instanceof PrivateKey)) {
            return false;
        }

        final Certificate certificate = store.getCertificate( alias );
        if ( certificate == null ) {
            return false;
        }

        if ( !(certificate instanceof X509Certificate) ) {
            return false;
        }

        final X509Certificate x509Certificate = (X509Certificate) certificate;

        // First certificate in the chain should correspond with the certificate in the store
        if ( !x509Certificate.getPublicKey().equals(certificates.get(0).getPublicKey()) )
        {
            return false;
        }

        return true;
    }
Imports a certificate (and its chain) in this store.

This method will fail when the provided certificate chain:
<ul>
    <li>does not match the domain of this XMPP service.</li>
    <li>is not a proper chain</li>
</ul>

This method will also fail when a corresponding private key is not already in this store (it is assumed that the
CA reply follows a signing request based on a private key that was added to the store earlier).

@param alias the certificate alias
@param pemCertificates a PEM representation of the certificate or certificate chain (cannot be null or empty).
@throws CertificateStoreConfigException if there was a problem installing the certificate
xmppserver/src/main/java/org/jivesoftware/openfire/keystore/IdentityStore.java