我通過在開發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是不夠的?