public byte[] getKey() { try { Method m = Class.forName("com.jcraft.jsch.Util").getDeclaredMethod("fromBase64", new Class[] { byte[].class, int.class, int.class }); m.setAccessible(true); return (byte[]) m.invoke(null, new Object[] { key.getKey().getBytes(), new Integer(0), new Integer(key.getKey().length()) }); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public void add( HostKey hostkey, UserInfo ui ) { Set<byte[]> keys = knownHostsMap.get(hostkey.getHost()); if (keys == null) { keys = new HashSet<>(); } keys.add(hostkey.getKey().getBytes()); knownHostsMap.put(hostkey.getHost(), keys); }
void dump(OutputStream out) throws IOException { try{ HostKey hk; synchronized(pool){ for(int i=0; i<pool.size(); i++){ hk=(HostKey)(pool.elementAt(i)); //hk.dump(out); String host=hk.getHost(); String type=hk.getType(); if(type.equals("UNKNOWN")){ out.write(host.getBytes()); out.write(cr); continue; } out.write(host.getBytes()); out.write(space); out.write(type.getBytes()); out.write(space); out.write(hk.getKey().getBytes()); out.write(cr); } } } catch(Exception e){ System.err.println(e); } } private int getType(byte[] key){
out.write(Util.str2byte(type)); out.write(space); out.write(Util.str2byte(hk.getKey())); if(comment!=null){ out.write(space);
out.write(Util.str2byte(type)); out.write(space); out.write(Util.str2byte(hk.getKey())); if(comment!=null){ out.write(space);
out.write(Util.str2byte(type)); out.write(space); out.write(Util.str2byte(hk.getKey())); if(comment!=null){ out.write(space);
out.write(Util.str2byte(type)); out.write(space); out.write(Util.str2byte(hk.getKey())); if (comment != null) { out.write(space);
String _key = Util.byte2str(Util.toBase64(K_S, 0, K_S.length)); for (HostKey key : keys) { if (keys[i].getKey().equals(_key) && key.getMarker().equals("@revoked")) { if (userinfo != 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){
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){
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){
hostKey.getKey() ); getKnownHostsProvider().addKnownHost( knownHostEntry );
hostKey.getKey() ); getKnownHostsProvider().addKnownHost( knownHostEntry );