Information Security Stack Exchange is a question and answer site for information security professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I want to generate strong high quality RSA keys, is there any reason not to use Microsoft's built-in cryptography system? Or should I use something open source like OpenSSL or Bouncy Castle?

I'm not necessarily afraid of backdoors, but I'm wondering whether I can trust the process of finding quality primes. I don't want to find out in a year that all the CSP generated RSA parameters had a flaw and the primes are following a simple pattern. The successful GCD attack on one in every 200 out of thousands of publicly available RSA keys made me wonder.

The generation is a once and done issue, so I'm happy to go the extra mile generating the keys if it's any more secure.

share|improve this question
Reading between the lines, is it fair to say your intent is to prevent copyright issues with your software? – LamonteCristo Apr 18 '12 at 17:15
No. The software itself is not encrypted at all. It is only processing a great deal of personal data over a network. My comment about key verification is only a practical one. – jnm2 Apr 18 '12 at 17:18
the question depends on if you need cross platform compatibility or anything, if it's all windows then it becomes more preference and if you trust them to have written that implementation correctly. Both MSFT's and OpenSSL have been verified by third parties. – ewanm89 Apr 18 '12 at 17:37
FIPS140 is the US government's verification and compliance for crypto libraries: for microsofts implementation. – ewanm89 Apr 18 '12 at 18:03
@ewanm89 I think that would be a good answer... – AviD Apr 18 '12 at 22:16

First if you're considering creating your own cryptography from the ground up, I sugguest reading the following post since there are many things that need to be considered before just using a PKI/RSA:

Lessons learned and misconceptions regarding encryption and cryptology

The benefit of using MSFT's crypto system is that the ciphers are covered by MSFT's warranty and have been analyzed by many people. You may want to ask in Crypto.SE if the MSFT implementation is vulnerable GCD attack

MSFT's implementation also allows for a FIPS only mode that is controlled by GPO. Using Bouncy Castle ignores this restriction and may cause issues for deployments if operating in a FIPS environment.

The good thing about Bouncy Castle is that it offers a higher-level implementation that covers key formats, PGP, and more.

One last thing to note; RijndaelManaged and AesManaged classes can both be used to generate RSA Keys, however they are not interchangeable. They are two different implementations of the Rijndael algorithm. For more information see this answer

share|improve this answer
Openssl also has some level of FIPS compliance if compiled to it. – ewanm89 Apr 18 '12 at 15:34
@Ewanm89 is FIPS mode controlled/enforced by GPO? (I added a link above) – LamonteCristo Apr 18 '12 at 15:41
I'm... not asking about building my own cryptography. I'm actually asking which prebuilt suite to use. Other than that, what I'm doing with it is straightforward textbook stuff. :-) Nothing new. – jnm2 Apr 18 '12 at 15:48
Also, how do you generate RSA keys from RijndaelManaged or AesManaged? Those classes are all about symmetric ciphers. I'm talking about public-key cryptography. – jnm2 Apr 18 '12 at 15:50
@jnm2 I hear you about wanting to use easy and simple PKI/RSA keys. The Crypto API offers too much flexibility that can get the layman developer into trouble. There are many samples on the internet (and MSFT's support site) that violate at least one of the lessons learned. What is the end to end encryption scenario you are considering? Where are the keys held? How are keys published? How are keys validated? This is where things get thorny. Perhaps update your question with this info... – LamonteCristo Apr 18 '12 at 15:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.