Server Error in '/' Application.

Padding is invalid and cannot be removed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.

Source Error:


Line 89:             // Write the data and make it do the decryption 
Line 90:             cryptoStream.Write(cipherData, 0, cipherData.Length);
Line 91:             cryptoStream.Close();
Line 92: 
Line 93:             // Convert the decrypted stream to a byte array 

Source File: c:\inetpub\vhosts\nitsjk.com\itisopore.com\App_Code\Encryption.cs    Line: 91

Stack Trace:


[CryptographicException: Padding is invalid and cannot be removed.]
   System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast) +4784618
   System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) +181
   System.Security.Cryptography.CryptoStream.FlushFinalBlock() +34
   System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing) +96
   System.IO.Stream.Close() +21
   Nits.ENC.Encryption.Decrypt(Byte[] cipherData, Byte[] key, Byte[] initialisationVector) in c:\inetpub\vhosts\nitsjk.com\itisopore.com\App_Code\Encryption.cs:91
   Nits.ENC.Encryption.Decrypt(String encryptedText, String password) in c:\inetpub\vhosts\nitsjk.com\itisopore.com\App_Code\Encryption.cs:39
   CMS_PageDescDisplay.Page_Load(Object sender, EventArgs e) in c:\inetpub\vhosts\nitsjk.com\itisopore.com\CMS\PageDescDisplay.ascx.cs:29
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Control.LoadRecursive() +134
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0