コード例 #1
0
  public PacketUserauthFailure(byte payload[], int off, int len) throws IOException {
    this.payload = new byte[len];
    System.arraycopy(payload, off, this.payload, 0, len);

    TypesReader tr = new TypesReader(payload, off, len);

    int packet_type = tr.readByte();

    if (packet_type != Packets.SSH_MSG_USERAUTH_FAILURE)
      throw new IOException("This is not a SSH_MSG_USERAUTH_FAILURE! (" + packet_type + ")");

    authThatCanContinue = tr.readNameList();
    partialSuccess = tr.readBoolean();

    if (tr.remain() != 0) throw new IOException("Padding in SSH_MSG_USERAUTH_FAILURE packet!");
  }
コード例 #2
0
  public PacketKexDhGexGroup(byte payload[], int off, int len) throws IOException {
    this.payload = new byte[len];
    System.arraycopy(payload, off, this.payload, 0, len);

    TypesReader tr = new TypesReader(payload, off, len);

    int packet_type = tr.readByte();

    if (packet_type != Packets.SSH_MSG_KEX_DH_GEX_GROUP)
      throw new IllegalArgumentException(
          "This is not a SSH_MSG_KEX_DH_GEX_GROUP! (" + packet_type + ")");

    p = tr.readMPINT();
    g = tr.readMPINT();

    if (tr.remain() != 0) throw new IOException("PADDING IN SSH_MSG_KEX_DH_GEX_GROUP!");
  }
コード例 #3
0
  public PacketKexInit(byte payload[], int off, int len) throws IOException {
    this.payload = new byte[len];
    System.arraycopy(payload, off, this.payload, 0, len);

    TypesReader tr = new TypesReader(payload, off, len);

    int packet_type = tr.readByte();

    if (packet_type != Packets.SSH_MSG_KEXINIT)
      throw new IOException("This is not a KexInitPacket! (" + packet_type + ")");

    kp.cookie = tr.readBytes(16);
    kp.kex_algorithms = tr.readNameList();
    kp.server_host_key_algorithms = tr.readNameList();
    kp.encryption_algorithms_client_to_server = tr.readNameList();
    kp.encryption_algorithms_server_to_client = tr.readNameList();
    kp.mac_algorithms_client_to_server = tr.readNameList();
    kp.mac_algorithms_server_to_client = tr.readNameList();
    kp.compression_algorithms_client_to_server = tr.readNameList();
    kp.compression_algorithms_server_to_client = tr.readNameList();
    kp.languages_client_to_server = tr.readNameList();
    kp.languages_server_to_client = tr.readNameList();
    kp.first_kex_packet_follows = tr.readBoolean();
    kp.reserved_field1 = tr.readUINT32();

    if (tr.remain() != 0) throw new IOException("Padding in KexInitPacket!");
  }