I'm trying to decrypt using RSACryptoServiceProvider, but I only have the modulus and d pair as a private key and also the exponent.
RsaParameters struct wont make do with these. It rejects me upon decryption with an exception "Bad key".
To my understanding, this pair is enough to decrypt without the entire DQ DP INVERSEQ parts. More over, in an example I found for python with pyCrypto, it has an RSA.construct method that only takes the above parts.
Is it possible with the classes in the .NET framework or another library? I've tried with BountyCastle but had no luck.
With the information you have, you can recover all the information your are missing and then provide the RSACryptServiceProvider with all the parameters it wants. The algorithm you need to get started is here. Look at section 8.2.2(i), "Relation to Factoring". The third paragraph, which starts out "On the other hand", proceeds to outline a simple algorithm which you can use to recover the primes p and q. From these, you can recover the other values easily. You'll need a reasonable BigInteger package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With