系统.安全.加密.SHA256Cng .NET Core

Kir*_*ryl 5 c# dll sha256 azure .net-core

我有一个 .net core 应用程序作为控制台,我正在尝试从 Azure Db 获取一些值。该代码在 .NET Framework(标准)上完美运行,我总是能获取数据,但我需要使用 .NET Core。简而言之,我有一种从另一个(.dll)获取配置的方法,每次遇到异常时:

例外

System.AggregateException: 'One or more errors occurred. (Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.)'
Run Code Online (Sandbox Code Playgroud)

我知道.NET Core有System.Core,但它没有“SHA256Cng”,只有“SHA256”。也许我可以使用 .net Framework .dll 还是有其他方法来解决这个问题?附言。仅需要使用 .NET Core(.net 控制台应用程序和其他)。

方法

public ITenantConfigurationProvider CreateTenantConfigurationProvider(ITenantClient client, string tenantId)
        {
            return client.GetConfigAsync(tenantId).Result;
        }
Run Code Online (Sandbox Code Playgroud)

小智 0

我相信 SHA256 类是“System.Security.Cryptography”的一部分。你有那个图书馆吗?