static public byte[] encrypteRSAPkcs1Twice(byte[] clearData, byte[] server_key_public_exponent,
                                               byte[] server_key_public_modulus, byte[] host_key_public_exponent,
                                               byte[] host_key_public_modulus) {

        // At each encryption step, a multiple-precision integer is constructed
        //
        // the integer is interpreted as a sequence of bytes, msb first;
        // the number of bytes is the number of bytes needed to represent the modulus.
        //
        // cf PKCS #1: RSA Encryption Standard.  Available for anonymous ftp at ftp.rsa.com.
        //  The sequence of byte is as follows:
        // The most significant byte is zero.
        // The next byte contains the value 2 (stands for public-key encrypted data)
        // Then, there are non zero random bytes to fill any unused space
        // a zero byte,
        // and the data to be encrypted

        byte[] key1exp, key1mod, key2exp, key2mod;

        if (server_key_public_modulus.length < host_key_public_modulus.length) {
            key1exp = server_key_public_exponent;
            key1mod = server_key_public_modulus;
            key2exp = host_key_public_exponent;
            key2mod = host_key_public_modulus;
        } else {
            key1exp = host_key_public_exponent;
            key1mod = host_key_public_modulus;
            key2exp = server_key_public_exponent;
            key2mod = server_key_public_modulus;
        }

        byte[] EncryptionBlock;    //what will be encrypted

        int offset = 0;
        EncryptionBlock = new byte[key1mod.length];
        EncryptionBlock[0] = 0;
        EncryptionBlock[1] = 2;
        offset = 2;
        for (int i = 2; i < (EncryptionBlock.length - clearData.length - 1); i++) {
            EncryptionBlock[offset++] = SshMisc.getNotZeroRandomByte();
        }
        EncryptionBlock[offset++] = 0;
        for (byte aClearData1 : clearData) {
            EncryptionBlock[offset++] = aClearData1;
        }

        //EncryptionBlock can be encrypted now !
        BigInteger m, e, message;
        byte[] messageByte;


        m = new BigInteger(1, key1mod);
        e = new BigInteger(1, key1exp);
        message = new BigInteger(1, EncryptionBlock);
        message = message.modPow(e, m);    //RSA Encryption !!

        byte[] messageByteTemp = message.toByteArray();

        //there should be no zeroes a the begining but we have to fix it (JDK bug !!)
        messageByte = new byte[key1mod.length];
        int tempOffset = 0;
        while (messageByteTemp[tempOffset] == 0) {
            tempOffset++;
        }
        for (int i = messageByte.length - messageByteTemp.length + tempOffset; i < messageByte.length; i++) {
            messageByte[i] = messageByteTemp[tempOffset++];
        }

        clearData = messageByte;


        //SECOND ROUND !!

        offset = 0;
        EncryptionBlock = new byte[key2mod.length];
        EncryptionBlock[0] = 0;
        EncryptionBlock[1] = 2;

        offset = 2;
        for (int i = 2; i < (EncryptionBlock.length - clearData.length - 1); i++) {
            EncryptionBlock[offset++] = SshMisc.getNotZeroRandomByte();    //random !=0
        }
        EncryptionBlock[offset++] = 0;
        for (byte aClearData : clearData) {
            EncryptionBlock[offset++] = aClearData;
        }

        //EncryptionBlock can be encrypted now !

        m = new BigInteger(1, key2mod);
        e = new BigInteger(1, key2exp);
        message = new BigInteger(1, EncryptionBlock);
        message = message.modPow(e, m);

        messageByteTemp = message.toByteArray();

        //there should be no zeroes a the begining but we have to fix it (JDK bug !!)
        messageByte = new byte[key2mod.length];
        tempOffset = 0;
        while (messageByteTemp[tempOffset] == 0) {
            tempOffset++;
        }
        for (int i = messageByte.length - messageByteTemp.length + tempOffset; i < messageByte.length; i++) {
            messageByte[i] = messageByteTemp[tempOffset++];
        }

        //Second encrypted key : encrypted_session_key //mp-int

        byte[] encrypted_session_key = new byte[key2mod.length + 2];

        //the lengh of the mp-int.
        encrypted_session_key[1] = (byte) ((8 * key2mod.length) & 0xff);
        encrypted_session_key[0] = (byte) (((8 * key2mod.length) >> 8) & 0xff);

        //the mp-int
        System.arraycopy(messageByte, 0, encrypted_session_key, 2, key2mod.length);
        return encrypted_session_key;
    }