Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RSAParameters - do I need to have *everything*

5 views
Skip to first unread message

Stephen Garner

unread,
Aug 17, 2009, 5:50:00 AM8/17/09
to
There are 2 representations of an RSA private key:

-as a pair (n,d)
-as a quintuple (p, q, dP, dQ, qInv)

I have the private key in the 2nd format, but when I create an
RSAParameters with these parameters I get the error "bad data" when I
use it with my RSACryptoServiceProvider. I've tried using a key from
another source where I have access to all these variables and if I
include everything (including n and d) it works.

Do I always need to calculate d for my RSAParameters?

I'm not really sure of the maths, I have all the variables apart from d
as byte arrays

Is there an easy way of calculating d to complete my RSAParameters?

(I guess I'll need to think about dealing with big numbers and whole
number arithmetic.)

Thanks in advance for your help.

Stephen Garner

unread,
Aug 19, 2009, 10:05:44 AM8/19/09
to

In the end I used a library from http://www.bouncycastle.org which lets
you initialise a private key with CRT (Chinese Remainder Theorem)
parameters (the quintuple above).

Don't know why you can't do this with MS' version. Looks like it's based
on some very old Windows cryptography code and could do with an update.

0 new messages