class PreferencesHostKeyVerifier extends AbstractHostKeyCallback {

    @Override
    public boolean verify(final Host host, final PublicKey key)
        throws ConnectionCanceledException, ChecksumException {
        final String lookup = preferences.getProperty(this.getFormat(host, key));
        if(StringUtils.equals(Base64.toBase64String(key.getEncoded()), lookup)) {
            if(log.isInfoEnabled()) {
                log.info(String.format("Accepted host key %s matching %s", key, lookup));
            }
            return true;
        }
        final boolean accept;
        if(null == lookup) {
            accept = this.isUnknownKeyAccepted(host, key);
        }
        else {
            accept = this.isChangedKeyAccepted(host, key);
        }
        return accept;
    }

}