CryptoConfig.AddAlgorithm(Type, String[]) 方法

定义

将一组名称添加到要用于当前应用程序域的算法映射。

[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static void AddAlgorithm(Type algorithm, params string[] names);
public static void AddAlgorithm(Type algorithm, params string[] names);
[System.Security.SecurityCritical]
public static void AddAlgorithm(Type algorithm, params string[] names);

参数

algorithm
Type

要映射到的算法。

names
String[]

要映射到该算法的名称的数组。

属性

例外

algorithmnames 参数为 null

algorithm 不能从该程序集外部访问。

- 或 -

names 参数中的一个条目是空的或为 null

注解

指定的映射优先于内置映射和 machine.config 文件中的映射。 映射用于防止部分信任代码使用受信任的加密操作。

适用于

产品 版本
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1