Error occurred during a cryptographic operation

Hi, recently i have configured Azure AD authentication in my MVC web project, using the VS2015 wizard. Everything seems to work fine but, after some hours or a day, i receive an error that set the web unusable.
  • Remove From My Forums
  • Question

  • Hi,
    recently i have configured Azure AD authentication in my MVC web project, using the VS2015 wizard.
    Everything seems to work fine but, after some hours or a day, i receive an error that set the web unusable.

    Here the error details:

    Exception message: Error occurred during a cryptographic operation. at System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2 func, Byte[] input) at System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.Unprotect(Byte[]
    protectedData) at System.Web.Security.MachineKey.Unprotect(ICryptoServiceProvider cryptoServiceProvider, Byte[] protectedData, String[] purposes) at System.Web.Security.MachineKey.Unprotect(Byte[] protectedData, String[] purposes) at StWeb002.Models.ADALTokenCache..ctor(String
    signedInUserId) at StWeb002.Startup.b__7_0(AuthorizationCodeReceivedNotification context) at Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationHandler.d__1a.MoveNext() — End of stack trace from previous location where exception was thrown
    — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationHandler.d__1a.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.d__0.MoveNext() — End of stack trace from previous location where exception was thrown
    — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.d__0.MoveNext()
    — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.d__5.MoveNext()
    — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.d__0.MoveNext()
    — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.d__5.MoveNext()
    — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.d__2.MoveNext()
    — End of stack trace from previous location where exception was thrown — at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult
    ar) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    The application becomes usable only after deleting records into the SQL table
    UserTokenCaches
    .

    Other informations:
    I have 3 «registered apps» in Azure used by 3 different web.config settings (Debug, Staging and Release) where i specify: ClientId, AADInstance, ClientSecret, Domain, TenantId, PostLogoutRedirectUri

    Please, can you help me to solve this error?

    Thank you

    • Edited by

      Monday, December 12, 2016 10:26 AM

Answers

    • Proposed as answer by
      rasmusw
      Wednesday, December 14, 2016 2:54 PM
    • Marked as answer by
      Matteo Pg
      Thursday, December 29, 2016 10:31 AM

Getting «CryptographicException: Error occurred during a cryptographic operation.» on macOS Mojave.

The project runs successfully under docker but not locally on mac.

.NET Core SDK (reflecting any global.json):
 Version:   2.1.500
 Commit:    b68b931422

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.500/

Host (useful for support):
  Version: 2.1.6
  Commit:  3f4f8eebd8

.NET Core SDKs installed:
  1.0.0-preview1-002702 [/usr/local/share/dotnet/sdk]
  2.0.2 [/usr/local/share/dotnet/sdk]
  2.1.300-rc1-008673 [/usr/local/share/dotnet/sdk]
  2.1.300 [/usr/local/share/dotnet/sdk]
  2.1.302 [/usr/local/share/dotnet/sdk]
  2.1.500 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0-rc1-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0-rc1-final [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.0-rc2-3002702 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0-rc1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

This is a real-edge case of working on the Windows platform. Beware.

Are you getting this stack trace?

“System.Security.Cryptography.CryptographicException: Error occurred during a cryptographic operation.”

[CryptographicException: Error occurred during a cryptographic operation.]
   System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2 func, Byte[] input) +115
   System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.Unprotect(Byte[] protectedData) +59
   System.Web.Security.MachineKey.Unprotect(ICryptoServiceProvider cryptoServiceProvider, Byte[] protectedData, String[] purposes) +62
   System.Web.Security.MachineKey.Unprotect(Byte[] protectedData, String[] purposes) +122
   System.IdentityModel.Services.MachineKeyTransform.Decode(Byte[] encoded) +51
   System.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[] cookie, Boolean outbound) +123
   System.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver) +575
   System.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(Byte[] token, SecurityTokenResolver tokenResolver) +76
   System.IdentityModel.Services.SessionAuthenticationModule.ReadSessionTokenFromCookie(Byte[] sessionCookie) +410
   System.IdentityModel.Services.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken& sessionToken) +187
   System.IdentityModel.Services.SessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +126
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Is it working in Internet Explorer but not in any other browser? Then this post is for you.

This assumes you have a certificate that you have installed yourself. All in PowerShell now, you should be able to find it:

$ ls cert:localmachinemy

It gives me

Thumbprint                                Subject
89866139B5D499DFD04FE413E89351A9A2B8A922  CN=INDUCTION

in my case.

But going to https://induction in FireFox crashes. Now try:

$ netsh http show sslcert

SSL Certificate bindings:
-------------------------
IP:port                      : 0.0.0.0:443
...
Certificate Store Name       : (null)
...

What you need to do in this case, is to re-register the certificate:

$ netsh http delete sslcert "ipport=0.0.0.0:443"
$ netsh http add sslcert "ipport=0.0.0.0:443" "appid={$appId}" "certhash=$tp" "certstorename=MY"

$appId is a guid, $tp is the thumbprint (found by doing ‘ls cert:localmachinemy’). The important part here is “certstorename=MY”, because without it, you might get an error in HomogenizingCryptoServiceWrapper.Unprotect – an interesting choice of name for that class for sure.

Now running:

$ netsh http show sslcert

SSL Certificate bindings:
-------------------------
IP:port                      : 0.0.0.0:443
...
Certificate Store Name       : MY

Shows the problem to be solved.

Stephen
asked on 01 Sep 2017, 02:59 PM

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:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Filesvs82ed21aae4b970d2App_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)


Offline

two_oceans

 


#211
Оставлено
:

15 февраля 2022 г. 10:05:16(UTC)

two_oceans

Статус: Эксперт

Группы: Участники

Зарегистрирован: 05.03.2015(UTC)
Сообщений: 1,598
Российская Федерация
Откуда: Иркутская область

Сказал(а) «Спасибо»: 110 раз
Поблагодарили: 388 раз в 363 постах

Автор: emejibka Перейти к цитате

Спасибо, дешифрование ответа прошло без ошибок.

Добрый день. Штатными методами и с ключом, это «расшифрование», а не «дешифрование». https://www.securitylab….sonal/Morning/351274.php

Отредактировано пользователем 15 февраля 2022 г. 10:06:30(UTC)
 | Причина: Не указана


Вверх


Offline

Владимир Сид

 


#212
Оставлено
:

3 марта 2022 г. 16:25:55(UTC)

Владимир Сид

Статус: Новичок

Группы: Участники

Зарегистрирован: 03.03.2022(UTC)
Сообщений: 4
Российская Федерация

Добрый день. Возникает конфликт System.Security.Cryptography.Xml.dll между NuGET пакетом и из сборки CoreFX через Reference. Когда подключаешь СМЭВ wcf то ставится пакет System.ServiceModel.Security, который включает в себя System.Security.Cryptography.Xml.dll и начинаются проблемы.

Отредактировано пользователем 3 марта 2022 г. 16:29:41(UTC)
 | Причина: Не указана


Вверх


Offline

Mekkeliard

 


#213
Оставлено
:

9 марта 2022 г. 15:41:54(UTC)

Mekkeliard

Статус: Новичок

Группы: Участники

Зарегистрирован: 09.03.2022(UTC)
Сообщений: 1

Добрый день.
Разворачиваю Docker-linux на debian.
Установлена CryptoPro R3 (последней версии). NetCore 3.1. CoreFx скачал последние библиотеки. Использую runtime/linux-x64/…
При попытке создать классическим путём сигнатуру:

Цитата:

var cmsSigner = new CmsSigner(_cert);
var contentInfo = new ContentInfo(message);
var signedCms = new SignedCms(contentInfo, true);
signedCms.ComputeSignature(cmsSigner);
var signature = signedCms.Encode();

Выпадает ошибка:

Unable to load shared library ‘crypt32.dll’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libcrypt32.dll: cannot open shared object file: No such file or directory

Конечно, crypt32 — библиотека из Windows, и ей не от куда взяться в Unix, но всё же может быть есть решение?


Вверх


Offline

Артём Макаров

 


#214
Оставлено
:

10 марта 2022 г. 9:03:26(UTC)

Артём Макаров

Статус: Сотрудник

Группы: Участники

Зарегистрирован: 20.02.2017(UTC)
Сообщений: 185

Сказал(а) «Спасибо»: 4 раз
Поблагодарили: 48 раз в 48 постах

Автор: Mekkeliard Перейти к цитате

Добрый день.
Разворачиваю Docker-linux на debian.
Установлена CryptoPro R3 (последней версии). NetCore 3.1. CoreFx скачал последние библиотеки. Использую runtime/linux-x64/…
При попытке создать классическим путём сигнатуру:

Цитата:

var cmsSigner = new CmsSigner(_cert);
var contentInfo = new ContentInfo(message);
var signedCms = new SignedCms(contentInfo, true);
signedCms.ComputeSignature(cmsSigner);
var signature = signedCms.Encode();

Выпадает ошибка:

Unable to load shared library ‘crypt32.dll’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libcrypt32.dll: cannot open shared object file: No such file or directory

Конечно, crypt32 — библиотека из Windows, и ей не от куда взяться в Unix, но всё же может быть есть решение?

Добрый день. Убедитесь, что используете корректный nuget пакет с рантаймом для unix (различные пакеты по win и unix). Подробнее — в инструкции к тестовому проекту (пункты 4 и 5).
https://github.com/Crypt…lob/master/docs/Linux.md

Техническую поддержку оказываем тут
Наша база знаний


Вверх


Offline

Andrey Poturaev

 


#215
Оставлено
:

10 марта 2022 г. 11:08:00(UTC)

Andrey Poturaev

Статус: Новичок

Группы: Участники

Зарегистрирован: 10.03.2022(UTC)
Сообщений: 1

Добрый день
Какой roadmap по .net core со стороны КриптоПро?
Я смотрю в репозитории 2 года уже не было телодвижений.
В частности интересует планируется ли (и если да то когда) обновление на .net 6


Вверх


Offline

Владимир Сид

 


#216
Оставлено
:

14 марта 2022 г. 10:32:47(UTC)

Владимир Сид

Статус: Новичок

Группы: Участники

Зарегистрирован: 03.03.2022(UTC)
Сообщений: 4
Российская Федерация

Добрый день. В примерах по подключению к net core описан способ подключения Cryptography.Xml.dll, но если в проекте уже есть пакеты nuget, содержащие System.Security.Cryptography.Xml.dll, то подключить таким способом не получается:
<Reference Include=»System.Security.Cryptography.Xml.dll»>
<HintPath>pathtoSystem.Security.Cryptography.Xml.dll</HintPath>
</Reference>

Как тогда подключить System.Security.Cryptography.Xml.dll от крипто про?


Вверх


Offline

Артём Макаров

 


#217
Оставлено
:

15 марта 2022 г. 8:02:48(UTC)

Артём Макаров

Статус: Сотрудник

Группы: Участники

Зарегистрирован: 20.02.2017(UTC)
Сообщений: 185

Сказал(а) «Спасибо»: 4 раз
Поблагодарили: 48 раз в 48 постах

Автор: Владимир Сид Перейти к цитате

Добрый день. В примерах по подключению к net core описан способ подключения Cryptography.Xml.dll, но если в проекте уже есть пакеты nuget, содержащие System.Security.Cryptography.Xml.dll, то подключить таким способом не получается:
<Reference Include=»System.Security.Cryptography.Xml.dll»>
<HintPath>pathtoSystem.Security.Cryptography.Xml.dll</HintPath>
</Reference>

Как тогда подключить System.Security.Cryptography.Xml.dll от крипто про?

Добрый день. Не смогу подсказать в сожалению. Если зависимость, которая использует System.Security.Cryptography.Xml, с открытым кодом — возможно стоит попробовать пересобрать её с использованием System.Security.Cryptography.Xml из форка.

Техническую поддержку оказываем тут
Наша база знаний


Вверх


Offline

Владимир Сид

 


#218
Оставлено
:

17 марта 2022 г. 12:53:27(UTC)

Владимир Сид

Статус: Новичок

Группы: Участники

Зарегистрирован: 03.03.2022(UTC)
Сообщений: 4
Российская Федерация

Автор: Артём Макаров Перейти к цитате

Автор: Владимир Сид Перейти к цитате

Добрый день. В примерах по подключению к net core описан способ подключения Cryptography.Xml.dll, но если в проекте уже есть пакеты nuget, содержащие System.Security.Cryptography.Xml.dll, то подключить таким способом не получается:
<Reference Include=»System.Security.Cryptography.Xml.dll»>
<HintPath>pathtoSystem.Security.Cryptography.Xml.dll</HintPath>
</Reference>

Как тогда подключить System.Security.Cryptography.Xml.dll от крипто про?

Добрый день. Не смогу подсказать в сожалению. Если зависимость, которая использует System.Security.Cryptography.Xml, с открытым кодом — возможно стоит попробовать пересобрать её с использованием System.Security.Cryptography.Xml из форка.

Вот например NuGet пакет — System.ServiceModel.Http (4.9.0) Если даже просто его добавить в проект примера DotnetSampleProject, то ссылка на System.Security.Cryptography.Xml автоматически переключается на /user/.nuget/..


Вверх


Offline

ZiCold

 


#219
Оставлено
:

23 марта 2022 г. 19:28:56(UTC)

ZiCold

Статус: Участник

Группы: Участники

Зарегистрирован: 16.09.2021(UTC)
Сообщений: 19
Российская Федерация

Автор: Артём Макаров Перейти к цитате

Автор: ZiCold Перейти к цитате

Добрый день! Возникла ошибка при попытке запустить приложение WebApi с CoreFx на сервере.

Код:

 System.MissingMethodException: Method not found: 'System.Security.Cryptography.HashAlgorithmName System.Security.Cryptography.HashAlgorithmName.get_Gost3411_2012_256()'.rn 
  at Internal.Cryptography.PkcsHelpers.GetDigestAlgorithm(String oidValue, Boolean forVerification)rn   at System.Security.Cryptography.Pkcs.SignerInfo.GetDigestAlgorithm() in C:\projects\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignerInfo.cs:line 737rn  
 at System.Security.Cryptography.Pkcs.SignerInfo.PrepareDigest(Boolean compatMode) in C:\projects\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignerInfo.cs:line 510rn 
  at System.Security.Cryptography.Pkcs.SignerInfo.VerifySignature(CmsSignature signatureProcessor, X509Certificate2 certificate, Boolean compatMode) in C:\projects\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignerInfo.cs:line 698rn  
 at System.Security.Cryptography.Pkcs.SignerInfo.Verify(X509Certificate2Collection extraStore, X509Certificate2 certificate, Boolean verifySignatureOnly) in C:\projects\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignerInfo.cs:line 647rn
  at System.Security.Cryptography.Pkcs.SignerInfo.CheckSignature(X509Certificate2Collection extraStore, Boolean verifySignatureOnly) in C:\projects\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignerInfo.cs:line 415rn 
  at System.Security.Cryptography.Pkcs.SignedCms.CheckSignatures(SignerInfoCollection signers, X509Certificate2Collection extraStore, Boolean verifySignatureOnly) in C:\projects\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignedCms.cs:line 595rn 
  at System.Security.Cryptography.Pkcs.SignedCms.CheckSignature(X509Certificate2Collection extraStore, Boolean verifySignatureOnly) in C:\projects\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignedCms.cs:line 578rn  
 at System.Security.Cryptography.Pkcs.SignedCms.CheckSignature(Boolean verifySignatureOnly) in C:\projects\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignedCms.cs:line 569rn  

Сам проект WebApi собирал согласно инструкции CoreFX инструкции. Всё на локальное машине работает.
На сервере устанавливал SDK и Hosting пакеты — не помогло. Даже полностью вычищал все установленные версии Net Core.
Что еще можно сделать?

Добрый день.

Каким образом и на какой операционной системе происходит попытка запуска приложения на сервере?
IIS + Windows увы пока не поддерживаем, ибо рантайм для IIS не в курсе нашего изменённого рантайма.

upd: что то похожее было тут в начале https://github.com/CryptoPro/corefx/issues/29.
Ещё раз проверить, что установлены именно требуемые версии рантаймов и что используется модифицированная сборка pcks.

Каким образом и на какой операционной системе происходит попытка запуска приложения на сервере?
Windows Server 2012 R2 + IIS.

IIS + Windows увы пока не поддерживаем, ибо рантайм для IIS не в курсе нашего изменённого рантайма.
Вот это было неожиданно. Вы хотя бы написали про это где-нибудь. Тогда остаётся вариант только с .NetFramework реализовывать.
Правда реально странно, что на локальной машине с Windows 10 всё в порядке.
Создам этот же запрос на гитхабе пожалуй.


Вверх


Offline

Владимир Сид

 


#220
Оставлено
:

3 апреля 2022 г. 17:44:04(UTC)

Владимир Сид

Статус: Новичок

Группы: Участники

Зарегистрирован: 03.03.2022(UTC)
Сообщений: 4
Российская Федерация

В текущей ситуации в мире стоит надеяться на выход под .Net6 ?


Вверх

Пользователи, просматривающие эту тему

Guest

Быстрый переход
 

Вы не можете создавать новые темы в этом форуме.

Вы не можете отвечать в этом форуме.

Вы не можете удалять Ваши сообщения в этом форуме.

Вы не можете редактировать Ваши сообщения в этом форуме.

Вы не можете создавать опросы в этом форуме.

Вы не можете голосовать в этом форуме.

Понравилась статья? Поделить с друзьями:
  • Error open driver handle failure
  • Error ooce machine type and serial number are invalid
  • Error occurred in loading omnisharp from omnisharp path
  • Error occurred in install product workflow with error code 190 error message
  • Error only virtual member functions can be marked override