Пример #1
0
 public static KexInitData createInstanceFromPacket(SshPacket2 packet) {
   KexInitData out = new KexInitData();
   out.cookie = packet.getBytes(16);
   out.kexAlgorithms = packet.getStringList();
   out.serverHostKeyAlgorithms = packet.getStringList();
   out.clientToServerCryptoAlgorithms = packet.getStringList();
   out.serverToClientCryptoAlgorithms = packet.getStringList();
   out.MACClientToServer = packet.getStringList();
   out.MACServerToClient = packet.getStringList();
   out.compressionClientToServer = packet.getStringList();
   out.compressionServerToClient = packet.getStringList();
   out.languagesClientToServer = packet.getStringList();
   out.languagesServerToClient = packet.getStringList();
   out.firstKEXPacketFollowing = packet.getByte() == 1;
   out.reserved = packet.getInt32();
   return out;
 }
Пример #2
0
  public static KexInitData createInstance() {
    // @todo - we can support the full range of allowed hashes
    // now that we've switched over to BB crypto.
    // Note that in all cases,we must list our preferred choice *first*
    KexInitData out = new KexInitData();
    out.cookie = RandomSource.getBytes(16);
    out.kexAlgorithms = SUPPORTED_KEX_ALGORITHMS;
    out.serverHostKeyAlgorithms = SUPPORTED_HOST_KEY_ALGORITHMS;
    out.clientToServerCryptoAlgorithms = CipherManager.getInstance().getSupportedCiphers();
    out.serverToClientCryptoAlgorithms = out.clientToServerCryptoAlgorithms;
    out.MACClientToServer = SUPPORTED_HMAC_ALGORITHMS;
    out.MACServerToClient = SUPPORTED_HMAC_ALGORITHMS;
    out.compressionClientToServer = SUPPORTED_COMPRESSION;
    out.compressionServerToClient = SUPPORTED_COMPRESSION;
    out.languagesClientToServer = new String[] {};
    out.languagesServerToClient = new String[] {};

    // @todo - we must support server sending 'first KEX' TRUE, AND guessing correctly!
    out.firstKEXPacketFollowing = false;
    out.reserved = 0;
    return out;
  }