CngKey 类
定义
定义用于下一代加密技术 (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() |
获取当前实例的 Type。Gets 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 的浅表副本。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) |