0

Using the Windows CryptoAPI, is there any way to specify which public exponent to use when generating a new key-pair (ie. 3 instead of 65537)?

As a bonus question: how would I access this functionality using .NET RSACryptoServiceProvider?

EDIT: My guess is that the answer is "No", but I would like to get confirmation.

Rasmus Faber
  • 48,631
  • 24
  • 141
  • 189

2 Answers2

3

No - there we go :) More seriously CryptGenKey The only parameters you can send to CryptGenKey are set in CryptSetKeyParam. You can see from the documentation you can only set a limited number of properties for each key type, and only one for RSA keys.

(Plus, as I'm sure you're aware, small exponents are dangerous anyway)

blowdart
  • 55,577
  • 12
  • 114
  • 149
  • Prime? Generator? If you are talking about KP_G and KP_P, those are for DSA. – Rasmus Faber Nov 18 '09 at 13:52
  • Errr doh. Slows how asleep I am :) Still, the parameters structure still applies, it's the only way to effect key generation, and there's nothing there for RSA except for KP_OAEP_PARAMS – blowdart Nov 18 '09 at 14:10
1

I think this answers your second question:

EncryptTo/DecryptTo: Encryption in .NET with CryptoAPI Certificate Stores