CryptographicException: Unknown Error '80007005'. when calling RSACryptoServiceProvider.Decrypt() in
Posted
by zensunnit
on Stack Overflow
See other posts from Stack Overflow
or by zensunnit
Published on 2010-06-02T00:40:04Z
Indexed on
2010/06/02
0:43 UTC
Read the original article
Hit count: 293
Hello,
I am trying to use the RSACryptoServiceProvider to encrypt/decrypt. Encrypting works fine, but the Decrypt method() throws an exception with the message: Unknown Error '80007005'.
This is the code:
Byte[] plainData = encoding.GetBytes(plainText); Byte[] encryptedData; RSAParameters rsap1; Byte[] decryptedData; using (RSACryptoServiceProvider rsa1 = new RSACryptoServiceProvider()) { encryptedData = rsa1.Encrypt(plainData, false); rsap1 = rsa1.ExportParameters(false); }
using (RSACryptoServiceProvider rsa2 = new RSACryptoServiceProvider()) { rsa2.ImportParameters(rsap1); decryptedData = rsa2.Decrypt(encryptedData, false); }
decryptedText = encoding.GetString(decryptedData, 0, decryptedData.Length);
Is anyone aware of a workaround?
Thanks!
© Stack Overflow or respective owner