首页 新闻 赞助 找找看

C#解密错误:CryptographicException: Bad Data

0
悬赏园豆:50 [待解决问题]

在C#中进行解密时,有时会出现下面的错误:

System.Security.Cryptography.CryptographicException: Bad Data.
   at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
   at System.Security.Cryptography.RSACryptoServiceProvider.DecryptKey(SafeKeyHandle pKeyContext, 
Byte[] pbEncryptedKey, Int32 cbEncryptedKey, Boolean fOAEP, ObjectHandleOnStack ohRetDecryptedKey)
   at System.Security.Cryptography.RSACryptoServiceProvider.Decrypt(Byte[] rgb, Boolean fOAEP)

而同样的密文,再次执行同样的解密代码,却能正常解密,很是奇怪。

C#
dudu的主页 dudu | 高人七级 | 园豆:31075
提问于:2015-11-17 17:09
< >
分享
所有回答(1)
0

有一种加载失败的感觉,流文件的处理会对这个有影响么?

Sky.Grain | 园豆:308 (菜鸟二级) | 2015-11-17 20:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册