CryptographicException Being Thrown - "Bad Data"

Posted by Community Admin on 04-Aug-2018 15:10

CryptographicException Being Thrown - "Bad Data"

All Replies

Posted by Community Admin on 19-Nov-2015 00:00

On my development box I'm getting the following exception in the logs multiple times a day. I've been getting them for a while, but nothing on the site breaks so I never logged it.

But in just under a 5 hour time span yesterday, this error was logged 20 times in my development environment. Here's one of the log entries (they're all the same stack trace and exception):

----------------------------------------
Timestamp: 11/18/2015 8:31:51 PM

Message: HandlingInstanceID: 0cfe0e43-6f01-4d36-9efa-52892f26f7b0
An exception of type 'System.Security.Cryptography.CryptographicException' occurred and was caught.
---------------------------------------------------------------------------------------------------
11/18/2015 15:31:51
Type : System.Security.Cryptography.CryptographicException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Bad Data.

Source : mscorlib
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Void ThrowCryptographicException(Int32)
HResult : -2146893819
Stack Trace :    at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
   at System.Security.Cryptography.Utils._DecryptData(SafeKeyHandle hKey, Byte[] data, Int32 ib, Int32 cb, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode PaddingMode, Boolean fDone)
   at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
   at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
   at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing)
   at System.IO.Stream.Close()
   at System.IO.Stream.Dispose()
   at Telerik.Sitefinity.Security.SecurityManager.DecryptData(Byte[] data)
   at Telerik.Sitefinity.Security.Claims.SitefinityCookieTransform.Decode(Byte[] encoded)
   at Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[] cookie, Boolean outbound)
   at Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver)
   at Telerik.Sitefinity.Security.Claims.SitefinitySessionTokenHandler.ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver)
   at Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(Byte[] token, SecurityTokenResolver tokenResolver)
   at Telerik.Sitefinity.Security.Claims.SitefinitySessionAuthenticationModule.ReadToken(Byte[] sessionCookie)

Additional Info:

MachineName : MyMachine
TimeStamp : 11/18/2015 8:31:51 PM
FullName : Telerik.Sitefinity.Utilities, Version=8.0.5700.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
AppDomainName : /LM/W3SVC/4/ROOT-13-130923522277358276
ThreadIdentity :
WindowsIdentity : MYDOMAIN\MyUser
Requested URL : localhost:60877/.../


Category: ErrorLog

Priority: 0

EventId: 9010

Severity: Warning

Title:Enterprise Library Exception Handling

Machine: MyMachine

App Domain: /LM/W3SVC/4/ROOT-13-130923522277358276

ProcessId: 45268

Process Name: C:\Program Files (x86)\IIS Express\iisexpress.exe

Thread Name:

Win32 ThreadId:23652

Extended Properties:
----------------------------------------

Posted by Community Admin on 24-Nov-2015 00:00

Hello,

We have replied in the support thread you have opened. Please, continue the communication there. When the issue is resolved, feel free to share it with the community.

Regards,
Nikola Zagorchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 30-Nov-2015 00:00

Hi,

We've just upgraded a site from 8.0 to 8.2 and are getting this error when we try to login to backend. Can you post suggested solutions here please..

Thank you,

Nidhi

Posted by Community Admin on 30-Nov-2015 00:00

Hello,

Are you using load balancing environment? One possible reason for the exception might be if it fails to decrypt the authentication request between the two servers in load balancing. If you are in NLB,

You can double check the machine key for both application and replace it with a new one(identical on all nodes).

I would like to suggest to enable temporarily the additional logging as described here: http://docs.sitefinity.com/administration-ensure-content-consistency-on-all-nodes#-troubleshooting-nbsp-


In order to troubleshoot this issue I would like to kindly ask you to set a copy of your project locally and check whether this issue can be replicated.

In case everything is working properly on your local machine I would like to ask you to check whether your environment is configured according following documentation article. There is a PowerShell script available that you can execute to ensure that all features needed from Sitefinity are enabled.

Configuring the IIS to host Sitefinity projects


Regards,
Nikola Zagorchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed