v2017.2.711.45 Error occurred during a cryptographic operation

3 posts, 1 answers
  1. Stephen
    Stephen avatar
    5 posts
    Member since:
    Aug 2013

    Posted 01 Sep Link to this post

    Hi,

    We've downloaded the latest version of the Telerik libraries - 2017.2.711.45 - and when we drop them into our web application we get the error

    Error occurred during a cryptographic operation

    with the stack trace pasted at the end of this message in our log files.

    The error itself is pretty generic and suggested fixes include clearing the browser cache or tokens from the UserTokenCaches table. However, none of these solutions is working for us, so we've had to do a bit more digging.

    What we've discovered is that this error is occuring on any page that uses the RadAsyncUpload control (we're not sure that it's only this control but other Telerik controls seem to be fine). It only happens with the 2017.2.711.45 libraries - if we copy back in the 2017.2.503.45 libraries our web application works again as normal.

    We've tried recreating the problem in a simple web application but we can't and our real web application is far too complex to whittle down to demonstrable size.

    Any help would be appreciated.

    Stephen.

     

     

    2017-09-01 15:49:08,552 [33] [Admin] [pftilg0judh5r3uukzo3cyew] [(null)] ERROR UI.Web.Global - Application_Error : Unhandled exception.
    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Security.Cryptography.CryptographicException: Error occurred during a cryptographic operation.
       at System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2 func, Byte[] input)
       at System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.Protect(Byte[] clearData)
       at System.Web.Security.MachineKey.Protect(ICryptoServiceProvider cryptoServiceProvider, Byte[] userData, String[] purposes)
       at System.Web.Security.MachineKey.Protect(Byte[] userData, String[] purposes)
       at Telerik.Web.UI.CryptoService.EncryptWithMachineKey(String clearText)
       at Telerik.Web.UI.CryptoService.Encrypt(String plainString)
       at Telerik.Web.UI.RadAsyncUpload.DescribeComponent(IScriptDescriptor descriptor)
       at Telerik.Web.UI.RadWebControl.Telerik.Web.IControl.DescribeComponent(IScriptDescriptor descriptor)
       at Telerik.Web.UI.ScriptRegistrar.GetScriptDescriptors(Control control)
       at Telerik.Web.UI.RadWebControl.GetScriptDescriptors()
       at Telerik.Web.UI.RadWebControl.System.Web.UI.IScriptControl.GetScriptDescriptors()
       at System.Web.UI.ScriptControlManager.RegisterScriptDescriptors(IScriptControl scriptControl)
       at Telerik.Web.UI.RadWebControl.RegisterScriptDescriptors()
       at Telerik.Web.UI.RadWebControl.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.Control.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.Control.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.Control.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.PageRequestManager.RenderFormCallback(HtmlTextWriter writer, Control containerControl)
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)
       at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.HtmlFormWrapper.System.Web.UI.IHtmlForm.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.PageRequestManager.RenderPageCallback(HtmlTextWriter writer, Control pageControl)
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.Page.Render(HtmlTextWriter writer)
       at System.Web.UI.Adapters.ControlAdapter.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page)
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.Page.Render(HtmlTextWriter writer)
       at System.Web.UI.Adapters.ControlAdapter.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.HandleError(Exception e)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest()
       at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
       at System.Web.UI.Page.ProcessRequest(HttpContext context)
       at ASP.members_framework_frameworklisting_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\82ed21aa\e4b970d2\App_Web_mg1k0qrw.1.cs:line 0
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

     

  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3908 posts

    Posted 04 Sep Link to this post

    Hi Stephen,

    The error is quite generic and is thrown by the .NET methods we use for encryption (hence, the final lines of the stack trace pointing to the System.Web.Security.Cryptography namespace/class and seems to go through using the machine key for encrypting.

    What I can suggest you try is:

    • Make sure you have the three Telerik-specific encryption keys (see the Mandatory Additions to the web.config article). The idea is to use those keys instead of fall back to the machine key.
    • See if you are running in Medium Trust. If so, try switching for Full Trust for a bit (if you have a suitable staging environment) to see if this is the cause of the problem. Some methods and reflection operations are not allowed under Medium Trust and reaching the machine key is one of them.
    • Make sure you are not adding the RadAsyncUpload to the page during a callback. You can add IScriptControl instances (such as our controls) only during postbacks (including partial postbacks), but not during callbacks.
    • If you are using RadScriptManager, try either setting its EnableScriptCombine property to false, or using the Telerik scripts CDN.
    • If this is not urgent, wait for the upcoming R3 2017 release (planned for mid-September) that will contain a fix for a concurrency issue under heavy loads related to the CryptoService. If you open a private support ticket, I could send you an internal build with it that you could test with.

     

    Regards,

    Marin Bratanov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Stephen
    Stephen avatar
    5 posts
    Member since:
    Aug 2013

    Posted 04 Sep in reply to Marin Bratanov Link to this post

    Adding the unique encryption keys seems to have solved our problem.

    Thanks.

Back to Top