填充无效,无法删除

时间:2012-02-06 15:31:48

标签: asp.net cryptography rijndaelmanaged

例外: 资料来源:mscorlib 信息: 填充无效,无法删除。

堆栈追踪:

at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) 
at System.Security.Cryptography.CryptoStream.FlushFinalBlock() 
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) 
at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType) 
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context) 
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

我们的机器键也未设置为自动。那么请有人帮忙。感谢

1 个答案:

答案 0 :(得分:0)

加密邮件的来源是什么?如果您确定密钥和IV匹配,那么您必须查看分组密码模式(例如CBC,CTR,ECB)和填充模式是否也在过程的两端匹配。如果所有这些加起来,那么可能是你在加密和解密之间截断字节数组,可能是由于一个错误的错误。

发布一些代码可能有助于我们诊断。