class FossologyHostKeyRepository implements HostKeyRepository {

    @Override
    public int check(String host, byte[] key) {
        String fingerPrint;
        try {
            fingerPrint = new HostKey(host, key).getFingerPrint(J_SHC);

            for (FossologyHostFingerPrint savedFingerPrint : hostKeyDb.getAll()) {
                if (fingerPrint.equals(savedFingerPrint.getFingerPrint())) {
                    if (savedFingerPrint.isTrusted()) {
                        return OK;
                    } else {
                        log.error("attempting connection to untrusted Host");
                        return NOT_INCLUDED;
                    }
                }
            }
        } catch (Exception e) {
            log.error(format("exception while verifying host '%s'", host), e);
            return NOT_INCLUDED;
        }
        log.error(format("cannot verify host '%s', fingerprint = '%s'", host, fingerPrint));

        final FossologyHostFingerPrint newFossologyHostFingerPrint = new FossologyHostFingerPrint().setFingerPrint(fingerPrint).setTrusted(false);
        hostKeyDb.add(newFossologyHostFingerPrint);
        return NOT_INCLUDED;
    }

    @Autowired public  FossologyHostKeyRepository(FossologyFingerPrintRepository fossologyFingerPrintRepository);

}