@Override public boolean verify(final String hostname, final int port, final PublicKey key) { final KeyType type = KeyType.fromKey(key); if (type == KeyType.UNKNOWN) { return false; } final String adjustedHostname = (port != 22) ? "[" + hostname + "]:" + port : hostname; boolean foundApplicableHostEntry = false; for (KnownHostEntry e : entries) { try { if (e.appliesTo(type, adjustedHostname)) { foundApplicableHostEntry = true; if (e.verify(key)) { return true; } } } catch (IOException ioe) { log.error("Error with {}: {}", e, ioe); return false; } } if (foundApplicableHostEntry) { return hostKeyChangedAction(adjustedHostname, key); } return hostKeyUnverifiableAction(adjustedHostname, key); }
@Override public boolean verify(final String hostname, final int port, final PublicKey key) { final KeyType type = KeyType.fromKey(key); if (type == KeyType.UNKNOWN) return false; final String adjustedHostname = (port != 22) ? "[" + hostname + "]:" + port : hostname; for (HostEntry e : entries) { try { if (e.appliesTo(type, adjustedHostname)) return e.verify(key) || hostKeyChangedAction(e, adjustedHostname, key); } catch (IOException ioe) { log.error("Error with {}: {}", e, ioe); return false; } } return hostKeyUnverifiableAction(adjustedHostname, key); }
@Override public boolean verify(final String hostname, final int port, final PublicKey key) { final KeyType type = KeyType.fromKey(key); if (type == KeyType.UNKNOWN) { return false; } final String adjustedHostname = (port != 22) ? "[" + hostname + "]:" + port : hostname; boolean foundApplicableHostEntry = false; for (KnownHostEntry e : entries) { try { if (e.appliesTo(type, adjustedHostname)) { foundApplicableHostEntry = true; if (e.verify(key)) { return true; } } } catch (IOException ioe) { log.error("Error with {}: {}", e, ioe); return false; } } if (foundApplicableHostEntry) { return hostKeyChangedAction(adjustedHostname, key); } return hostKeyUnverifiableAction(adjustedHostname, key); }