Create RSACryptoServiceProvider with publicExponent, privateExponent and modulus RRS feed

  • Question

  • Hi folks,

    I have a XML file which contains the data of the private and the public key.
    However, this is the representation form 1, which means:
    I only have the publicExponent, the modulus and the privateExponent (D). I do NOT have P and Q!
    However, for the RSA algorithm, the three values I have are enough to encrpyt and decrypt data.
    But I can't create an RSACryptoServiceProvider with only this data, it seems, .NET only supports the second representation with p and q.
    Is there any way to instantiate a RSACryptoServiceProvider with the data I have?

    Thanks in advance
    Monday, April 6, 2009 2:19 PM

All replies

  • Nobody? This is really important for me.
    If it is not possible, is there any other way to do it, maybe with a third party component?

    Wednesday, April 8, 2009 6:04 AM
  • According to the RSA algorithm specification at Wikipedia, q and q needs to be part of the private key for efficient reason:

    For efficiency the following values may be precomputed and stored as part of the private key:
    • p and q : the primes from the key generation,
    • d\mod (p - 1) and d\mod(q - 1) ,
    • q^{-1} \mod(p) .
    So p and q value should also be included. I am not an expert in RSA, so I might miss something very basic (as something like "the second representation with p and q" as you've mentioned above), I am just trying to be helpful.


    Another Paradigm Shift
    Friday, April 10, 2009 8:48 AM