comparison src/ch/ethz/ssh2/KnownHosts.java @ 299:4c3a4e88c027 ganymed

add ecdsa key support everywhere
author Carl Byington <carl@five-ten-sg.com>
date Tue, 29 Jul 2014 18:08:09 -0700
parents ab3a99f11a36
children beaccc9df37b
comparison
equal deleted inserted replaced
298:ab3a99f11a36 299:4c3a4e88c027
112 112
113 synchronized(publicKeys) { 113 synchronized(publicKeys) {
114 publicKeys.add(new KnownHostsEntry(hostnames, dpk)); 114 publicKeys.add(new KnownHostsEntry(hostnames, dpk));
115 } 115 }
116 } 116 }
117 else if (serverHostKeyAlgorithm.startsWith("ecdsa-")) { 117 else if (serverHostKeyAlgorithm.startsWith("ecdsa-sha2-")) {
118 ECPublicKey epk = ECDSASHA2Verify.decodeSSHECDSAPublicKey(serverHostKey); 118 ECPublicKey epk = ECDSASHA2Verify.decodeSSHECDSAPublicKey(serverHostKey);
119 119
120 synchronized(publicKeys) { 120 synchronized(publicKeys) {
121 publicKeys.add(new KnownHostsEntry(hostnames, epk)); 121 publicKeys.add(new KnownHostsEntry(hostnames, epk));
122 } 122 }
402 } 402 }
403 403
404 String[] arr = line.split(" "); 404 String[] arr = line.split(" ");
405 405
406 if(arr.length >= 3) { 406 if(arr.length >= 3) {
407 if((arr[1].compareTo("ssh-rsa") == 0) || 407 if ((arr[1].compareTo("ssh-rsa") == 0) ||
408 (arr[1].compareTo("ssh-dss") == 0) || 408 (arr[1].compareTo("ssh-dss") == 0) ||
409 (arr[1].startsWith("ecdsa-sha2-") == 0)) { 409 (arr[1].startsWith("ecdsa-sha2-"))) {
410 String[] hostnames = arr[0].split(","); 410 String[] hostnames = arr[0].split(",");
411 411
412 byte[] msg = Base64.decode(arr[2].toCharArray()); 412 byte[] msg = Base64.decode(arr[2].toCharArray());
413 413
414 try { 414 try {
700 700
701 if("ssh-rsa".equals(keyType)) { 701 if("ssh-rsa".equals(keyType)) {
702 } 702 }
703 else if("ssh-dss".equals(keyType)) { 703 else if("ssh-dss".equals(keyType)) {
704 } 704 }
705 else if (keyType.startsWith("ecdsa-sha2-") { 705 else if (keyType.startsWith("ecdsa-sha2-")) {
706 } 706 }
707 else { 707 else {
708 throw new IllegalArgumentException("Unknown key type " + keyType); 708 throw new IllegalArgumentException("Unknown key type " + keyType);
709 } 709 }
710 710