Ejemplo n.º 1
0
 public byte[] getSessionId() {
   if (_keys == null) {
     return _getSessionId(_host.getModulusBytes(), _server.getModulusBytes());
   } else {
     return _getSessionId(
         _keys[1].getModulus().toByteArray(), _keys[0].getModulus().toByteArray());
   }
 }
Ejemplo n.º 2
0
  @Override
  public byte[] toByteArray(StreamCipher cipher) {
    byte[] server = _server.toByteArray();
    byte[] host = _host.toByteArray();
    byte[] out = new byte[server.length + host.length + 8 + 12];
    int pos = 0;
    System.arraycopy(_cookie, 0, out, pos, _cookie.length);
    pos += _cookie.length;
    System.arraycopy(server, 0, out, pos, server.length);
    pos += server.length;
    System.arraycopy(host, 0, out, pos, host.length);
    pos += host.length;
    punchInt(out, pos, 0);
    pos += 4;
    punchInt(out, pos, _cipherMask);
    pos += 4;
    punchInt(out, pos, _authMask);

    return makePacket(cipher, out);
  }