我通过在开发Web场上部署的.Net 4.0 ASP.Net Web应用程序中的FormsAuthentication.Encrypt(数据)将数据加密到cookie中。我已经指定了一个machineKey属性来对ValidationKey,DecryptionKey和Decryption(算法)进行硬编码。
现在,我试图使用我的开发工作站上构建的应用程序解密该cookie。我能够通过Request.Cookies时得到的饼干[“CookieName”]但是当我试图通过FormsAuthentication.Decrypt(encCookie)解密的价值,我得到以下错误:解密使用FormsAuthentication.Encrypt加密的数据
Unable to validate data. at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo, Boolean useLegacyMode, IVType ivType, Boolean signData) at System.Web.Security.FormsAuthentication.Decrypt(String encryptedTicket) at TuoVanitySite.Default.Page_Load(Object sender, EventArgs e) in c:\src\ets_2008\main\ebtDev\Sandboxes\rrozinov\TuoVanitySite\TuoVanitySite\Default.aspx.cs:line 22
这里是blurp从我网络配置(键被删除):
<machineKey
validationKey="keyA"
decryptionKey="keyB"
decryption="3DES"
compatibilityMode="Framework20SP1"/>
任何人已经处理了这种情况machineKey是不够的?