RSA calculating e in C# I would like the have a second opinion on my code I've written to calculate e

e is an integer that you wherefore the following counts gcd(φ(n),e) = 1 with 1 &lt; e &lt; φ(n)

public int calce()
{
    do
    {
        e = priemgen.newKey(1, euler);
    } while (GCD(euler, e) != 1);  

    return e;
}

private int GCD(int value1, int value2)
{
    while (value1 != 0 &amp;&amp; value2 != 0)
    {
        if (value1 &gt; value2)
        {
            value1 %= value2;
        }
        else
            value2 %= value1;
    }

    return Math.Max(value1, value2);
}

private int NewPrime(int lowerbound, int upperbound)
{
    return priemgen.newKey(lowerbound, upperbound);
}
There is not a huge amount of code to review here, just a few things:


You have a method NewPrime which I assume provides a prime number between the two bounds provided. Yet you do not use it and call priemgen.newKey directly in calce. You should either get rid of the wrapper method or use it consistently.
Braces are used inconsistently:

else
    value2 %= value1;


Should be same as the if block:

else
{
    value2 %= value1;
}

The naming conventions are inconsistent. Standard naming convention for C# for methods and fields is PascalCase and local variables and parameters are camelCase:


calce -> CalculateE
newKey on priemgen should be NewKey
priemgen - I assume it's a field so should be PrimGenerator
lowerbound -> lowerBound
upperbound -> upperBound
GCD -> Gcd

If priemgen is what it sounds like then the name for nextKey should be NextPrime.
What does priemgen.newKey return if there is no prime within the given bounds?