/** * Invoked <U>after</U> known host entry located and keys match - by default * checks that entry has not been revoked * * @param clientSession The {@link ClientSession} * @param remoteAddress The remote host address * @param serverKey The presented server {@link PublicKey} * @param entry The {@link KnownHostEntry} value - if {@code null} then no * known matching host entry was found - default will call * {@link #acceptUnknownHostKey(ClientSession, SocketAddress, PublicKey)} * @return {@code true} if OK to accept the server */ protected boolean acceptKnownHostEntry(ClientSession clientSession, SocketAddress remoteAddress, PublicKey serverKey, KnownHostEntry entry) { if (entry == null) { // not really expected, but manage it return acceptUnknownHostKey(clientSession, remoteAddress, serverKey); } if ("revoked".equals(entry.getMarker())) { log.debug("acceptKnownHostEntry({})[{}] key={}-{} marked as {}", clientSession, remoteAddress, KeyUtils.getKeyType(serverKey), KeyUtils.getFingerPrint(serverKey), entry.getMarker()); return false; } if (log.isDebugEnabled()) { log.debug("acceptKnownHostEntry({})[{}] matched key={}-{}", clientSession, remoteAddress, KeyUtils.getKeyType(serverKey), KeyUtils.getFingerPrint(serverKey)); } return true; }
/** * Invoked <U>after</U> known host entry located and keys match - by default * checks that entry has not been revoked * * @param clientSession The {@link ClientSession} * @param remoteAddress The remote host address * @param serverKey The presented server {@link PublicKey} * @param entry The {@link KnownHostEntry} value - if {@code null} then no * known matching host entry was found - default will call * {@link #acceptUnknownHostKey(ClientSession, SocketAddress, PublicKey)} * @return {@code true} if OK to accept the server */ protected boolean acceptKnownHostEntry(ClientSession clientSession, SocketAddress remoteAddress, PublicKey serverKey, KnownHostEntry entry) { if (entry == null) { // not really expected, but manage it return acceptUnknownHostKey(clientSession, remoteAddress, serverKey); } if ("revoked".equals(entry.getMarker())) { log.debug("acceptKnownHostEntry({})[{}] key={}-{} marked as {}", clientSession, remoteAddress, KeyUtils.getKeyType(serverKey), KeyUtils.getFingerPrint(serverKey), entry.getMarker()); return false; } if (log.isDebugEnabled()) { log.debug("acceptKnownHostEntry({})[{}] matched key={}-{}", clientSession, remoteAddress, KeyUtils.getKeyType(serverKey), KeyUtils.getFingerPrint(serverKey)); } return true; }
if (entry.isHostMatch(host.getHostName(), host.getPort())) { boolean isRevoked = MARKER_REVOKED .equals(entry.getMarker()); if (KeyUtils.compareKeys(serverKey, current.getServerKey())) {