I need to implement DSA without any libaries (except key generation) in C# as part of my homework. I managed to generate the public and private key but when i try to get the parameters like G or Y and convert them into a BigInteger i sometimes get negative parameters. The parameters itself are positive in the byte array! They just turn into negative ones when i convert them into BigInteger. Here is the way i try it:
DSAParameters keys;
DSACryptoServiceProvider DSAalg = new DSACryptoServiceProvider();
keys = DSAalg.ExportParameters(true);
BigInteger G = new BigInteger(keys.G);
Console.WriteLine("G is {0} \n", G);
Any ideas how i could solve that?