private void generateKeys(int keyBitSize) {
        keyByteSize = keyBitSize / 8;
        // Generate Primes for Q and P
        do {
            // Use Cores parallel, if there are more than 1
            if (cores > 1) {
                do {
                    BigInteger[] primes = getPrimesParallel(keyBitSize);
                    p = primes[0];
                    q = primes[1];
                } while (p.compareTo(q) == 0);
            } else {
                do {
                    p = getPrimesParallel(keyBitSize)[0];
                    q = getPrimesParallel(keyBitSize)[0];
                    log2ofPQ = Math.abs(CryptobyHelper.logBigInteger(p) - CryptobyHelper.logBigInteger(q));
                } while (log2ofPQ <= 0.1 || log2ofPQ >= 30);
            }

            // Calculate n Module
            calcN();
            // Calculate Phi Module
            calcPhi();
            // Calculate D Module
            calcD();
        } while (n.toByteArray().length != (keyByteSize)
                || d.toByteArray().length != (keyByteSize));
    }