AssemblySignatureKeyAttribute 类

定义

提供从较旧、更简单的强名称键迁移到具有更强哈希算法的大型密钥。

public ref class AssemblySignatureKeyAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed class AssemblySignatureKeyAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)>]
type AssemblySignatureKeyAttribute = class
    inherit Attribute
Public NotInheritable Class AssemblySignatureKeyAttribute
Inherits Attribute
继承
AssemblySignatureKeyAttribute
属性

注解

新的较大密钥是签名密钥。 在 .NET Framework 4.5 之前的版本中,签名密钥与标识密钥相同。 从 .NET Framework 4.5 开始,AssemblySignatureKeyAttribute 属性允许程序集元数据继续具有旧的公钥令牌和二进制大型对象(BLOB),以便现有程序集引用继续工作。 它还可确保映射来自标识密钥的所有者。

属性的存在并不一定意味着发生强名称验证。 在常见的完全信任方案中,从不考虑该属性,因为永远不会验证强名称签名。 但是,必须验证强名称签名时,必须验证强名称签名和反签名。 程序集的标识密钥不必与签名密钥相同(用于执行实际签名和验证的密钥)。 标识密钥可以映射到其他(更可靠的)签名密钥。 这样,便可以设置程序集的标识,并将签名密钥和算法更新为更安全的版本。

当恶意程序集声明其他一些标识时,反签名解决了安全问题。 例如,恶意 System.Core.dll 程序集在其元数据中可能包含Microsoft公钥,并使用该属性告知强名称验证在没有反签名的情况下使用攻击者的签名密钥。 因此,它可以伪装成经过强名称验证的Microsoft程序集。

有关如何对程序集进行签名以用于此新属性的信息,请参阅 增强型强命名

构造函数

名称 说明
AssemblySignatureKeyAttribute(String, String)

使用指定的公钥和反签名创建类的新实例 AssemblySignatureKeyAttribute

属性

名称 说明
Countersignature

获取此程序集的强名称的反签名。

PublicKey

获取用于对程序集进行签名的强名称的公钥。

TypeId

在派生类中实现时,获取此 Attribute的唯一标识符。

(继承自 Attribute)

方法

名称 说明
Equals(Object)

返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
GetHashCode()

返回此实例的哈希代码。

(继承自 Attribute)
GetType()

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()

在派生类中重写时,指示此实例的值是否为派生类的默认值。

(继承自 Attribute)
Match(Object)

在派生类中重写时,返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

显式接口实现

名称 说明
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,该信息可用于获取接口的类型信息。

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对对象公开的属性和方法的访问。

(继承自 Attribute)

适用于