public void RSAEncrypt(int length) throws RdesktopException {
		byte[] inr = new byte[length];
		// int outlength = 0;
		BigInteger mod = null;
		BigInteger exp = null;
		BigInteger x = null;

		this.reverse(this.exponent);
		this.reverse(this.modulus);
		System.arraycopy(this.client_random, 0, inr, 0, length);
		this.reverse(inr);

		if ((this.modulus[0] & 0x80) != 0) {
			byte[] temp = new byte[this.modulus.length + 1];
			System.arraycopy(this.modulus, 0, temp, 1, this.modulus.length);
			temp[0] = 0;
			mod = new BigInteger(temp);
		} else {
			mod = new BigInteger(this.modulus);
		}
		if ((this.exponent[0] & 0x80) != 0) {
			byte[] temp = new byte[this.exponent.length + 1];
			System.arraycopy(this.exponent, 0, temp, 1, this.exponent.length);
			temp[0] = 0;
			exp = new BigInteger(temp);
		} else {
			exp = new BigInteger(this.exponent);
		}
		if ((inr[0] & 0x80) != 0) {
			byte[] temp = new byte[inr.length + 1];
			System.arraycopy(inr, 0, temp, 1, inr.length);
			temp[0] = 0;
			x = new BigInteger(temp);
		} else {
			x = new BigInteger(inr);
		}

		BigInteger y = x.modPow(exp, mod);
		this.sec_crypted_random = y.toByteArray();

		if ((this.sec_crypted_random[0] & 0x80) != 0) {
			throw new RdesktopException(
					"Wrong Sign! Expected positive Integer!");
		}

		if (this.sec_crypted_random.length > SEC_MODULUS_SIZE) {
			// logger.warn("sec_crypted_random too big!"); /* FIXME */
		}
		this.reverse(this.sec_crypted_random);

		byte[] temp = new byte[SEC_MODULUS_SIZE];

		if (this.sec_crypted_random.length < SEC_MODULUS_SIZE) {
			System.arraycopy(this.sec_crypted_random, 0, temp, 0,
					this.sec_crypted_random.length);
			for (int i = this.sec_crypted_random.length; i < temp.length; i++) {
				temp[i] = 0;
			}
			this.sec_crypted_random = temp;

		}

	}