comparison src/ch/ethz/ssh2/KnownHosts.java @ 286:4656869af8fe ganymed

start conversion from trilead to ganymed
author Carl Byington <carl@five-ten-sg.com>
date Fri, 18 Jul 2014 19:26:29 -0700
parents 486df527ddc5
children db9b028016de
comparison
equal deleted inserted replaced
285:486df527ddc5 286:4656869af8fe
23 import ch.ethz.ssh2.crypto.Base64; 23 import ch.ethz.ssh2.crypto.Base64;
24 import ch.ethz.ssh2.crypto.digest.Digest; 24 import ch.ethz.ssh2.crypto.digest.Digest;
25 import ch.ethz.ssh2.crypto.digest.HMAC; 25 import ch.ethz.ssh2.crypto.digest.HMAC;
26 import ch.ethz.ssh2.crypto.digest.MD5; 26 import ch.ethz.ssh2.crypto.digest.MD5;
27 import ch.ethz.ssh2.crypto.digest.SHA1; 27 import ch.ethz.ssh2.crypto.digest.SHA1;
28 import java.security.KeyPair;
29 import java.security.PrivateKey;
28 import java.security.PublicKey; 30 import java.security.PublicKey;
29 import java.security.interfaces.DSAPublicKey; 31 import java.security.interfaces.DSAPublicKey;
30 import java.security.interfaces.ECPublicKey; 32 import java.security.interfaces.ECPublicKey;
31 import java.security.interfaces.RSAPublicKey; 33 import java.security.interfaces.RSAPublicKey;
32 import ch.ethz.ssh2.signature.DSASHA1Verify; 34 import ch.ethz.ssh2.signature.DSASHA1Verify;
55 public static final int HOSTKEY_IS_NEW = 1; 57 public static final int HOSTKEY_IS_NEW = 1;
56 public static final int HOSTKEY_HAS_CHANGED = 2; 58 public static final int HOSTKEY_HAS_CHANGED = 2;
57 59
58 private class KnownHostsEntry { 60 private class KnownHostsEntry {
59 String[] patterns; 61 String[] patterns;
60 Object key; 62 PublicKey key;
61 63
62 KnownHostsEntry(String[] patterns, Object key) { 64 KnownHostsEntry(String[] patterns, PublicKey key) {
63 this.patterns = patterns; 65 this.patterns = patterns;
64 this.key = key; 66 this.key = key;
65 } 67 }
66 } 68 }
67 69
233 } 235 }
234 236
235 return true; 237 return true;
236 } 238 }
237 239
238 private int checkKey(String remoteHostname, Object remoteKey) { 240 private int checkKey(String remoteHostname, PublicKey remoteKey) {
239 int result = HOSTKEY_IS_NEW; 241 int result = HOSTKEY_IS_NEW;
240 242
241 synchronized(publicKeys) { 243 synchronized(publicKeys) {
242 for(KnownHostsEntry ke : publicKeys) { 244 for(KnownHostsEntry ke : publicKeys) {
243 if(hostnameMatches(ke.patterns, remoteHostname) == false) { 245 if(hostnameMatches(ke.patterns, remoteHostname) == false) {