mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-08 16:18:05 +03:00
don't need an interface as well as an abstract class, all inside one class!
This commit is contained in:
@@ -44,22 +44,7 @@ import java.util.List;
|
|||||||
public class OpenSSHKnownHosts
|
public class OpenSSHKnownHosts
|
||||||
implements HostKeyVerifier {
|
implements HostKeyVerifier {
|
||||||
|
|
||||||
public static interface Entry {
|
public static abstract class Entry {
|
||||||
|
|
||||||
KeyType getType();
|
|
||||||
|
|
||||||
boolean appliesTo(String host)
|
|
||||||
throws IOException;
|
|
||||||
|
|
||||||
PublicKey getKey()
|
|
||||||
throws IOException;
|
|
||||||
|
|
||||||
String getLine();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static abstract class BaseEntry
|
|
||||||
implements Entry {
|
|
||||||
|
|
||||||
private KeyType type;
|
private KeyType type;
|
||||||
private PublicKey key;
|
private PublicKey key;
|
||||||
@@ -116,10 +101,13 @@ public class OpenSSHKnownHosts
|
|||||||
|
|
||||||
protected abstract String getHostPart();
|
protected abstract String getHostPart();
|
||||||
|
|
||||||
|
public abstract boolean appliesTo(String host)
|
||||||
|
throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SimpleEntry
|
public static class SimpleEntry
|
||||||
extends BaseEntry {
|
extends Entry {
|
||||||
|
|
||||||
private final List<String> hosts;
|
private final List<String> hosts;
|
||||||
|
|
||||||
@@ -163,7 +151,7 @@ public class OpenSSHKnownHosts
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class HashedEntry
|
public static class HashedEntry
|
||||||
extends BaseEntry {
|
extends Entry {
|
||||||
|
|
||||||
private final MAC sha1 = new HMACSHA1();
|
private final MAC sha1 = new HMACSHA1();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user