CngKey 類別

定義

定義搭配 Cryptography Next Generation (CNG) 物件使用的金鑰核心功能。Defines the core functionality for keys that are used with Cryptography Next Generation (CNG) objects.

public ref class CngKey sealed : IDisposable
public sealed class CngKey : IDisposable
type CngKey = class
    interface IDisposable
Public NotInheritable Class CngKey
Implements IDisposable
繼承
CngKey
實作

備註

這個類別會包裝 NCrypt 索引鍵,而不是 BCrypt 索引鍵。This class wraps NCrypt keys, not BCrypt keys. NCrypt 是 CNG 的子集,可提供金鑰儲存功能。NCrypt is a subset of CNG that provides key storage functionality. BCrypt 是提供基本密碼編譯服務的子集,例如亂數世代、雜湊函數、簽章和加密金鑰。BCrypt is a subset that provides base cryptographic services such as random number generation, hash functions, signatures, and encryption keys.

建構函式

CngKey()

屬性

Algorithm

取得金鑰使用的演算法。Gets the algorithm that is used by the key.

AlgorithmGroup

取得金鑰使用的演算法群組。Gets the algorithm group that is used by the key.

ExportPolicy

取得金鑰使用的匯出原則。Gets the export policy that is used by the key.

Handle

取得代表原生金鑰 (NCRYPT_KEY_HANDLE) 的安全控制代碼。Gets a safe handle that represents a native key (NCRYPT_KEY_HANDLE).

IsEphemeral

取得金鑰的持續性狀態。Gets the persistence state of the key.

IsMachineKey

取得金鑰的範圍 (電腦或使用者)。Gets the scope (machine or user) of the key.

KeyName

取得金鑰的名稱。Gets the name of the key.

KeySize

取得位元為單位的金鑰大小。Gets the key size in bits.

KeyUsage

取得金鑰指定的密碼編譯作業。Gets the cryptographic operations specified by the key.

ParentWindowHandle

取得或設定視窗控制代碼 (HWND),用於存取金鑰所造成的使用者介面 (UI) 提示。Gets or sets the window handle (HWND) that should be used for user interface (UI) prompts caused by accessing the key.

Provider

取得管理金鑰的金鑰儲存提供者 (KSP)。Gets the key storage provider (KSP) that manages the key.

ProviderHandle

取得金鑰儲存提供者 (KSP) 的原生控制代碼 (NCRYPT_PROV_HANDLE)。Gets a native handle (an NCRYPT_PROV_HANDLE) to the key storage provider (KSP).

UIPolicy

取得控制使用者介面 (UI) 用以存取金鑰的參數。Gets parameters that control the user interface (UI) for accessing the key.

UniqueName

取得金鑰的唯一名稱。Gets the unique name for the key.

方法

Create(CngAlgorithm)

建立 CngKey 物件,可搭配指定的演算法使用。Creates a CngKey object that can be used with the specified algorithm.

Create(CngAlgorithm, String)

建立具名的 CngKey 物件,提供指定的演算法。Creates a named CngKey object that provides the specified algorithm.

Create(CngAlgorithm, String, CngKeyCreationParameters)

建立具名的 CngKey 物件,使用提供的金鑰建立參數提供指定的演算法。Creates a named CngKey object that provides the specified algorithm, using the supplied key creation parameters.

Delete()

移除與物件相關聯的金鑰。Removes the key that is associated with the object.

Dispose()

釋放 CngKey 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the CngKey class.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Exists(String)

查看具名金鑰是否存在預設的金鑰儲存提供者 (KSP) 中。Checks to see whether a named key exists in the default key storage provider (KSP).

Exists(String, CngProvider)

查看具名金鑰是否存在指定的金鑰儲存提供者 (KSP) 中。Checks to see whether a named key exists in the specified key storage provider (KSP).

Exists(String, CngProvider, CngKeyOpenOptions)

根據指定的選項,查看具名金鑰是否存在指定的金鑰儲存提供者 (KSP) 中。Checks to see whether a named key exists in the specified key storage provider (KSP), according to the specified options.

Export(CngKeyBlobFormat)

以指定的格式將金鑰內容匯出到 BLOB 中。Exports the key material into a BLOB, in the specified format.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetProperty(String, CngPropertyOptions)

取得屬性,收到指定名稱和一組屬性選項。Gets a property, given a name and a set of property options.

GetType()

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

(繼承來源 Object)
HasProperty(String, CngPropertyOptions)

查看指定的屬性是否存在金鑰上。Checks to see whether the specified property exists on the key.

Import(Byte[], CngKeyBlobFormat)

藉由將指定的金鑰內容匯入預設的金鑰儲存提供者 (KSP),並使用指定的格式建立新的金鑰。Creates a new key by importing the specified key material into the default key storage provider (KSP) and using the specified format.

Import(Byte[], CngKeyBlobFormat, CngProvider)

使用指定的格式將指定的金鑰內容匯入指定的金鑰儲存提供者 (KSP),以建立新的金鑰。Creates a new key by importing the specified key material into the specified key storage provider (KSP), using the specified format.

MemberwiseClone()

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

(繼承來源 Object)
Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions)

使用現有金鑰的控制代碼建立 CngKey 物件的執行個體。Creates an instance of an CngKey object by using a handle to an existing key.

Open(String)

建立代表現有具名金鑰的 CngKey 物件執行個體。Creates an instance of an CngKey object that represents an existing named key.

Open(String, CngProvider)

使用指定的金鑰儲存提供者 (KSP) 建立代表現有具名金鑰的 CngKey 物件執行個體。Creates an instance of an CngKey object that represents an existing named key, using the specified key storage provider (KSP).

Open(String, CngProvider, CngKeyOpenOptions)

使用指定的金鑰儲存提供者 (KSP) 和金鑰開啟選項,建立代表現有具名金鑰的 CngKey 物件執行個體。Creates an instance of an CngKey object that represents an existing named key, using the specified key storage provider (KSP) and key open options.

SetProperty(CngProperty)

設定金鑰上的具名屬性。Sets a named property on the key.

ToString()

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

(繼承來源 Object)

適用於