none
CryptographicException = Unknown Error

    Question

  • Hello forum. I'm developing an application which needs decrypt cyphred data on Compact Framework. The problem appears when I "configure" the public key. The public key is saved on a file contains modulus and exponent of public key. These are read and set on a RSAParameter object as:

              System.IO.FileStream file_stream = 
    new
    System.IO.FileStream(licence_file, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None); System.IO.BinaryReader reader = new System.IO.BinaryReader(file_stream); byte [] modulus = reader.ReadBytes(129); byte [] exponent = reader.ReadBytes(3); byte [] ciphred_text = reader.ReadBytes((int )file_stream.Length - 132);
     reader.Close(); file_stream.Close(); /*byte[] modulus = { 0, 134, 116, 116, 107, 94, 55, 100, 138, 195, 154, 19, 85, 210, 75, 169, 49, 25, 155, 128, 204, 121, 29, 15, 243, 230, 253, 173, 208, 188, 103, 66, 130, 13, 250, 221, 129, 7, 224, 115, 146, 158, 122, 92, 82, 104, 49, 122, 234, 170, 21, 214, 178, 39, 82, 5, 120, 180, 145, 107, 68, 191, 177, 233, 124, 222, 233, 20, 254, 58, 177, 18, 47, 252, 121, 89, 63, 164, 253, 226, 176, 140, 250, 86, 190, 13, 96, 212, 117, 40, 119, 191, 209, 255, 180, 11, 230, 96, 169, 16, 21, 232, 216, 13, 212, 212, 252, 81, 160, 247, 4, 131, 37, 226, 144, 89, 59, 6, 190, 153, 128, 155, 201, 183, 146, 62, 210, 190, 251 }; byte[] exponent = { 1, 0, 1 };*/ try { System.Security.Cryptography.RSACryptoServiceProvider rsa_provider = new System.Security.Cryptography.RSACryptoServiceProvider(1024); System.Security.Cryptography.RSAParameters parameters = new System.Security.Cryptography.RSAParameters(); parameters.Modulus = modulus; parameters.Exponent = exponent; rsa_provider.ImportParameters(parameters); byte [] clear_text = rsa_provider.Decrypt(ciphred_text, true ); } catch (Exception ex) { string message = ex.Message; return new LicenceData(); } return LicenceHelper.configure();

    The problem apprats when I perform decrypt function. It raises an exception:

    CryptographicException = Unknown Error '80007015'.

    Can you help me, please?
    I will appreciate your help a lot.
    Thanks for all.
    Wednesday, April 15, 2009 7:08 PM

All replies

  • First, is the error really 80007015? or is it actually 80097015?

    Second, you can't decrypt with RsaCryptoProvider unless you have the private key. In RSA, decryption is done with the private key.
    -Rob Teixeira
    Friday, April 17, 2009 9:25 PM