I need to generate large prime numbers for a cryptography project. I noticed that .NET 4.0 has some built-in cryptographic primitive (for example RSA) which use random generated large primes (p,q for RSA). Do they all use a common built-in library which is public and can be accessed from outside their class scopes, or do I have to use an external library (I know there are simple algorithms for primality tests, I just don’t want to implement more than i have to.).
I need to generate large prime numbers for a cryptography project. I noticed that
Share
In .NET v4 (and later) Microsoft provides a new assembly,
System.Numerics.dll, which includes aBigIntegertype. However it does not provide any method to check for primes.Mono (since before 1.0) also provides a
[BigInteger][3]type located in it’sMono.Security.dllassembly. You can either use it as is or port the prime-checking methods (several methods exists) to the new MicrosoftBigIntegertype.Yes, both
RSACryptoServiceProviderandDSACryptoServiceProvidercalls into CryptoAPI to do this. However CAPI does not expose it’s own BigInteger code (even to native code) so it won’t help you.