<enforceFIPSPolicy > 元素<enforceFIPSPolicy> Element

指定是否强制执行以下计算机配置要求:加密算法必须符合美国联邦信息处理标准 (FIPS)。Specifies whether to enforce a computer configuration requirement that cryptographic algorithms must comply with the Federal Information Processing Standards (FIPS).

<configuration> <configuration>
    <runtime >   <runtime>
     <enforceFIPSPolicy >    <enforceFIPSPolicy>

语法Syntax

<enforceFIPSPolicy enabled="true|false" />  

特性和元素Attributes and Elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.

特性Attributes

特性Attribute 描述Description
enabledenabled 必需的特性。Required attribute.

指定是否允许强制执行计算机配置要求,要求加密算法必须符合 FIPS。Specifies whether to enable the enforcement of a computer configuration requirement that cryptographic algorithms must be compliant with FIPS.

enabled 特性enabled Attribute

“值”Value 描述Description
true 如果你的计算机配置为要求加密算法符合 FIPS 标准,则强制实施此要求。If your computer is configured to require cryptographic algorithms to be FIPS compliant, that requirement is enforced. 如果某个类实现了不符合 FIPS 的算法,则在该计算机上运行时,该类的构造函数或 Create 方法将引发异常。If a class implements an algorithm that is not compliant with FIPS, the constructors or Create methods for that class throw exceptions when they are run on that computer. 这是默认设置。This is the default.
false 无论计算机配置如何,应用程序使用的加密算法都无需符合 FIPS。Cryptographic algorithms that are used by the application are not required to be compliant with FIPS, regardless of computer configuration.

子元素Child Elements

无。None.

父元素Parent Elements

元素Element 描述Description
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有关程序集绑定和垃圾回收的信息。Contains information about assembly binding and garbage collection.

备注Remarks

从 .NET Framework 2.0 开始,实现加密算法的类的创建由计算机的配置控制。Starting with the .NET Framework 2.0, the creation of classes that implement cryptographic algorithms is controlled by the configuration of the computer. 如果计算机配置为要求算法符合 FIPS,并且类实现了不符合 FIPS 的算法,则创建该类的实例的任何尝试都将引发异常。If the computer is configured to require algorithms to be compliant with FIPS, and a class implements an algorithm that is not compliant with FIPS, any attempt to create an instance of that class throws an exception. 构造函数引发 InvalidOperationException 异常,Create 方法引发一个 TargetInvocationException 异常,其中包含内部 InvalidOperationException 异常。Constructors throw an InvalidOperationException exception, and Create methods throw a TargetInvocationException exception with an inner InvalidOperationException exception.

如果你的应用程序运行在其配置要求符合 FIPS 的计算机上,并且你的应用程序使用不符合 FIPS 的算法,则可以使用配置文件中的此元素来阻止公共语言运行时(CLR)强制执行 FIPS 相容性。If your application runs on computers whose configurations require compliance with FIPS, and your application uses an algorithm that is not compliant with FIPS, you can use this element in your configuration file to prevent the common language runtime (CLR) from enforcing FIPS compliance. 此元素是在 .NET Framework 2.0 Service Pack 1 中引入的。This element was introduced in the .NET Framework 2.0 Service Pack 1.

示例Example

下面的示例演示如何阻止 CLR 强制实施 FIPS 相容性。The following example shows how to prevent the CLR from enforcing FIPS compliance.

<configuration>  
    <runtime>  
        <enforceFIPSPolicy enabled="false"/>  
    </runtime>  
</configuration>  

请参阅See also