| --- src/main/java/com/jcraft/jsch/Session.java 2013-05-08 01:10:10.000000000 +0400 | |
| +++ src/main/java/com/jcraft/jsch/Session.java 2013-10-04 16:45:08.489140895 +0400 | |
| @@ -798,21 +798,23 @@ | |
| HostKey[] keys = | |
| hkr.getHostKey(chost, | |
| (key_type.equals("DSA") ? "ssh-dss" : "ssh-rsa")); | |
| - String _key= Util.byte2str(Util.toBase64(K_S, 0, K_S.length)); | |
| - for(int j=0; j< keys.length; j++){ | |
| - if(keys[i].getKey().equals(_key) && | |
| - keys[j].getMarker().equals("@revoked")){ | |
| - if(userinfo!=null){ | |
| - userinfo.showMessage( | |
| -"The "+ key_type +" host key for "+ host +" is marked as revoked.\n"+ | |
| -"This could mean that a stolen key is being used to "+ | |
| -"impersonate this host."); | |
| + if(keys != null){ | |
| + String _key= Util.byte2str(Util.toBase64(K_S, 0, K_S.length)); | |
| + for(int j=0; j< keys.length; j++){ | |
| + if(keys[i].getKey().equals(_key) && | |
| + keys[j].getMarker().equals("@revoked")){ | |
| + if(userinfo!=null){ | |
| + userinfo.showMessage( | |
| + "The "+ key_type +" host key for "+ host +" is marked as revoked.\n"+ | |
| + "This could mean that a stolen key is being used to "+ | |
| + "impersonate this host."); | |
| + } | |
| + if(JSch.getLogger().isEnabled(Logger.INFO)){ | |
| + JSch.getLogger().log(Logger.INFO, | |
| + "Host '"+host+"' has provided revoked key."); | |
| + } | |
| + throw new JSchException("revoked HostKey: "+host); | |
| } | |
| - if(JSch.getLogger().isEnabled(Logger.INFO)){ | |
| - JSch.getLogger().log(Logger.INFO, | |
| - "Host '"+host+"' has provided revoked key."); | |
| - } | |
| - throw new JSchException("revoked HostKey: "+host); | |
| } | |
| } | |
| } |