AssemblySignatureKeyAttribute AssemblySignatureKeyAttribute AssemblySignatureKeyAttribute AssemblySignatureKeyAttribute Class

定義

從舊的、較簡單的強式名稱金鑰移轉到具有較強的雜湊演算法、較大的金鑰。Provides migration from an older, simpler strong name key to a larger key with a stronger hashing algorithm.

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

備註

新的較大索引鍵是簽章金鑰。The new larger key is the signature key. 在之前.NET Framework 4.5.NET Framework 4.5的版本中,簽章金鑰與身分識別金鑰相同。In versions before the .NET Framework 4.5.NET Framework 4.5, the signature key was identical to the identity key. .NET Framework 4.5.NET Framework 4.5從開始AssemblySignatureKeyAttribute ,屬性允許元件中繼資料繼續具有舊的公開金鑰標記和二進位大型物件(BLOB),因此現有的元件參考會繼續工作。Starting with the .NET Framework 4.5.NET Framework 4.5, the AssemblySignatureKeyAttribute attribute allows the assembly metadata to continue to have the old public key token and binary large object (BLOB) so that existing assembly references continue to work. 它也可確保對應來自身分識別索引鍵的擁有者。It also ensures that the mapping comes from an owner of the identity key.

屬性的存在不一定表示會進行強式名稱驗證。The presence of the attribute does not necessarily mean that strong name validation takes place. 在一般的完全信任案例中,永遠不會考慮屬性,因為強式名稱簽章永遠不會經過驗證。In common full-trust scenarios, the attribute is never considered, because strong name signatures are never validated. 不過,如果必須驗證強式名稱簽章,就必須驗證強式名稱簽章和副署。However, when the strong name signature does have to be validated, both the strong name signature and the countersignature must be validated. 元件的身分識別索引鍵不一定要與簽章金鑰(用來執行實際簽署和驗證的金鑰)完全相同。The assembly's identity key does not have to be identical to the signature key (the key used to do the actual signing and validation). 身分識別金鑰可以對應至不同(更健全的)簽署金鑰。The identity key can be mapped to a different (more robust) signing key. 這可讓您設定元件的身分識別,並將簽署金鑰和演算法更新為更安全的版本。This lets you set the identity of an assembly, and update the signing keys and algorithms to more secure versions.

當惡意元件宣告一些其他身分識別時,副署會解決安全性考慮。The countersignature addresses security concerns when a malicious assembly claims some other identity. 例如,惡意的 system.string 元件可能會在其中繼資料中包含 Microsoft 公開金鑰,並使用屬性來指示強式名稱驗證,以在沒有任何副署時使用攻擊者的簽章金鑰。For example, a malicious System.Core.dll assembly could contain the Microsoft public key in its metadata, and use the attribute to tell strong name validation to use the attacker's signature key if no countersignature is present. 因此,它可以偽裝成強式名稱驗證的 Microsoft 元件。Thus, it could masquerade as a strong name-validated Microsoft assembly.

如需如何簽署元件以用於這個新屬性的詳細資訊,請參閱增強型強式命名For information about how to sign assemblies for use with this new attribute, see Enhanced Strong Naming.

建構函式

AssemblySignatureKeyAttribute(String, String) AssemblySignatureKeyAttribute(String, String) AssemblySignatureKeyAttribute(String, String) AssemblySignatureKeyAttribute(String, String)

使用指定的公開金鑰和副署,建立 AssemblySignatureKeyAttribute 類別的新執行個體。Creates a new instance of the AssemblySignatureKeyAttribute class by using the specified public key and countersignature.

屬性

Countersignature Countersignature Countersignature Countersignature

取得這個組件的強式名稱副署。Gets the countersignature for the strong name for this assembly.

PublicKey PublicKey PublicKey PublicKey

取得用來簽署組件之強式名稱的公開金鑰。Gets the public key for the strong name used to sign the assembly.

TypeId TypeId TypeId TypeId

在衍生類別中實作時,取得這個 Attribute 的唯一識別碼。When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from Attribute)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

傳回這個執行個體的雜湊碼。Returns the hash code for this instance.

(Inherited from Attribute)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute()

在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object) Match(Object) Match(Object) Match(Object)

在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

明確介面實作

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。Retrieves the type information for an object, which can be used to get the type information for an interface.

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。Provides access to properties and methods exposed by an object.

(Inherited from Attribute)

適用於