Mercurial > 510Connectbot
comparison src/ch/ethz/ssh2/KnownHosts.java @ 287:db9b028016de ganymed
start conversion from trilead to ganymed
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Fri, 18 Jul 2014 19:52:08 -0700 |
parents | 4656869af8fe |
children | ab3a99f11a36 |
comparison
equal
deleted
inserted
replaced
286:4656869af8fe | 287:db9b028016de |
---|---|
562 * (man-in-the-middle attack?)</li> | 562 * (man-in-the-middle attack?)</li> |
563 * </ul> | 563 * </ul> |
564 * @throws IOException if the supplied key blob cannot be parsed or does not match the given hostkey type. | 564 * @throws IOException if the supplied key blob cannot be parsed or does not match the given hostkey type. |
565 */ | 565 */ |
566 public int verifyHostkey(String hostname, String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException { | 566 public int verifyHostkey(String hostname, String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException { |
567 Object remoteKey; | 567 PublicKey remoteKey; |
568 | 568 |
569 if("ssh-rsa".equals(serverHostKeyAlgorithm)) { | 569 if("ssh-rsa".equals(serverHostKeyAlgorithm)) { |
570 remoteKey = RSASHA1Verify.decodeSSHRSAPublicKey(serverHostKey); | 570 remoteKey = RSASHA1Verify.decodeSSHRSAPublicKey(serverHostKey); |
571 } | 571 } |
572 else if("ssh-dss".equals(serverHostKeyAlgorithm)) { | 572 else if("ssh-dss".equals(serverHostKeyAlgorithm)) { |
573 remoteKey = DSASHA1Verify.decodeSSHDSAPublicKey(serverHostKey); | 573 remoteKey = DSASHA1Verify.decodeSSHDSAPublicKey(serverHostKey); |
574 } | |
575 else if (serverHostKeyAlgorithm.startsWith("ecdsa-sha2-")) { | |
576 remoteKey = ECDSASHA2Verify.decodeSSHECDSAPublicKey(serverHostKey); | |
574 } | 577 } |
575 else { | 578 else { |
576 throw new IllegalArgumentException("Unknown hostkey type " + serverHostKeyAlgorithm); | 579 throw new IllegalArgumentException("Unknown hostkey type " + serverHostKeyAlgorithm); |
577 } | 580 } |
578 | 581 |