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 74:             Using cs As New CryptoStream(ms, encryptor.CreateDecryptor(), CryptoStreamMode.Write)
Line 75:                 cs.Write(cipherBytes, 0, cipherBytes.Length)
Line 76:                 cs.Close()
Line 77:             End Using
Line 78:             cipherText = Encoding.Unicode.GetString(ms.ToArray())

Source File: h:\root\home\fsolis-001\www\capacitate\App_Code\Generador.vb    Line: 76

Stack Trace:


[CryptographicException: Padding is invalid and cannot be removed.]
   System.Security.Cryptography.CapiSymmetricAlgorithm.DepadBlock(Byte[] block, Int32 offset, Int32 count) +4882940
   System.Security.Cryptography.CapiSymmetricAlgorithm.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) +266
   System.Security.Cryptography.CryptoStream.FlushFinalBlock() +34
   System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing) +52
   System.IO.Stream.Close() +21
   Generador.Decrypt(String cipherText, String EncryptionKey) in h:\root\home\fsolis-001\www\capacitate\App_Code\Generador.vb:76
   Default2.Page_Load(Object sender, EventArgs e) in h:\root\home\fsolis-001\www\capacitate\Oferta.aspx.vb:21
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


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