I want to use a 2048 bit DSA key, and I am using a .NET DSACryptoServiceProvider. I was having trouble loading the key parameters into a .NET DSAParameters object, so I wrote the following code to output the valid key sizes for a DSACryptoServiceProvider:
DSACryptoServiceProvider sampleDSA = new DSACryptoServiceProvider();
Console.Write("----- DSA LEGAL KEY SIZES -----\n");
foreach (KeySizes ks in sampleDSA.LegalKeySizes)
{
Console.WriteLine("Min: " + ks.MinSize.ToString());
Console.WriteLine("Max: " + ks.MaxSize.ToString());
}
There is only one KeySizes object in the array, and the ouput is as follows:
----- DSA LEGAL KEY SIZES -----
Min: 512
Max: 1024
Is there any way to have a 2048 bit key using a DSACryptoServiceProvider? Using a 1024 bit key is not an option.
—-EDIT—–
I have enumerated the LegalKeySizes for all .NET CryptoServiceProvider classes that deal with Digital Signatures. The results are as follows.
System.Security.Cryptography.DSACryptoServiceProvider
Min: 512
Max: 1024
System.Security.Cryptography.RSACryptoServiceProvider
Min: 384
Max: 16384
System.Security.Cryptography.ECDsaCng
Min: 256
Max: 384
Min: 521
Max: 521
What I meant to ask was: Is there a way to tweak this to use a 2048 bit key using a DSACryptoServiceProvider, or am I locked into the 512-1024 bit range?
Based on the legal key sizes output you posted, the .NET implementation will not work with more than 1024 bits.
Perhaps some other crypto provider would work? I’ve used the Bouncycastle (www.bouncycastle.org) .NET provider before for things that .NET’s provider cannot do.