ECDiffieHellman ECDiffieHellman ECDiffieHellman ECDiffieHellman Class

定义

提供一个抽象基类,可以从它派生椭圆曲线 Diffie-Hellman (ECDH) 算法实现。Provides an abstract base class that Elliptic Curve Diffie-Hellman (ECDH) algorithm implementations can derive from. 此类提供一个所有 ECDH 实现都必须支持的基本操作集。This class provides the basic set of operations that all ECDH implementations must support.

public ref class ECDiffieHellman abstract : System::Security::Cryptography::AsymmetricAlgorithm
public abstract class ECDiffieHellman : System.Security.Cryptography.AsymmetricAlgorithm
type ECDiffieHellman = class
    inherit AsymmetricAlgorithm
Public MustInherit Class ECDiffieHellman
Inherits AsymmetricAlgorithm
继承
派生

注解

此类用作 ECDH 实现的抽象基类。This class serves as the abstract base class for ECDH implementations.

构造函数

ECDiffieHellman() ECDiffieHellman() ECDiffieHellman() ECDiffieHellman()

初始化 ECDiffieHellman 类的新实例。Initializes a new instance of the ECDiffieHellman class.

属性

KeyExchangeAlgorithm KeyExchangeAlgorithm KeyExchangeAlgorithm KeyExchangeAlgorithm

获取密钥交换算法的名称。Gets the name of the key exchange algorithm.

KeySize KeySize KeySize KeySize

获取或设置非对称算法所用密钥模块的大小(以位为单位)。Gets or sets the size, in bits, of the key modulus used by the asymmetric algorithm.

(Inherited from AsymmetricAlgorithm)
LegalKeySizes LegalKeySizes LegalKeySizes LegalKeySizes

获取非对称算法支持的密钥大小。Gets the key sizes that are supported by the asymmetric algorithm.

(Inherited from AsymmetricAlgorithm)
PublicKey PublicKey PublicKey PublicKey

获取当前椭圆曲线 Diffie-Hellman (ECDH) 实例正在使用的公钥。Gets the public key that is being used by the current Elliptic Curve Diffie-Hellman (ECDH) instance.

SignatureAlgorithm SignatureAlgorithm SignatureAlgorithm SignatureAlgorithm

获取签名算法的名称。Gets the name of the signature algorithm.

方法

Clear() Clear() Clear() Clear()

释放 AsymmetricAlgorithm 类使用的所有资源。Releases all resources used by the AsymmetricAlgorithm class.

(Inherited from AsymmetricAlgorithm)
Create() Create() Create() Create()

创建椭圆曲线 Diffie-Hellman (ECDH) 算法的默认实现的一个新实例。Creates a new instance of the default implementation of the Elliptic Curve Diffie-Hellman (ECDH) algorithm.

Create(ECCurve) Create(ECCurve) Create(ECCurve) Create(ECCurve)

使用通过指定曲线生成的新公钥/私钥对,创建椭圆曲线 Diffie-Hellman (ECDH) 算法的默认实现的新实例。Creates a new instance of the default implementation of the Elliptic Curve Diffie-Hellman (ECDH) algorithm with a new public/private key-pair generated over the specified curve.

Create(ECParameters) Create(ECParameters) Create(ECParameters) Create(ECParameters)

创建椭圆曲线 Diffie-Hellman (ECDH) 算法的默认实现的新实例,密钥由指定的 ECParameters 对象描述。Creates a new instance of the default implementation of the Elliptic Curve Diffie-Hellman (ECDH) algorithm with the key described by the specified ECParameters object.

Create(String) Create(String) Create(String) Create(String)

创建椭圆曲线 Diffie-hellman (ECDH) 算法的特定实现的新实例。Creates a new instance of the specified implementation of the Elliptic Curve Diffie-Hellman (ECDH) algorithm.

DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName) DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName) DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName) DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName)

若给定了另一方的公钥和哈希算法的名称,使用哈希函数派生可用作密钥的字节。Derives bytes that can be used as a key using a hash function, given another party's public key and hash algorithm's name.

DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[]) DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[]) DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[]) DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[])

在派生类中实现时,使用哈希函数、给定的另一方公钥、哈希算法的名称、预置值和追加值可派生用作密钥的字节。When implemented in a derived class, derives bytes that can be used as a key using a hash function, given another party's public key, hash algorithm's name, a prepend value and an append value.

DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[]) DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[]) DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[]) DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[])

使用基于哈希的消息验证代码 (HMAC) 派生可用作密钥的字节。Derives bytes that can be used as a key using a Hash-based Message Authentication Code (HMAC).

DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[], Byte[]) DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[], Byte[]) DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[], Byte[]) DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[], Byte[])

当在派生基类中实现时,使用基于哈希的消息身份验证代码 (HMAC) 派生可用作密钥的字节。When implemented in a derived class, derives bytes that can be used as a key using a Hash-based Message Authentication Code (HMAC).

DeriveKeyMaterial(ECDiffieHellmanPublicKey) DeriveKeyMaterial(ECDiffieHellmanPublicKey) DeriveKeyMaterial(ECDiffieHellmanPublicKey) DeriveKeyMaterial(ECDiffieHellmanPublicKey)

在给定另一方公钥的情况下派生可以用作密钥的字节。Derives bytes that can be used as a key, given another party's public key.

DeriveKeyTls(ECDiffieHellmanPublicKey, Byte[], Byte[]) DeriveKeyTls(ECDiffieHellmanPublicKey, Byte[], Byte[]) DeriveKeyTls(ECDiffieHellmanPublicKey, Byte[], Byte[]) DeriveKeyTls(ECDiffieHellmanPublicKey, Byte[], Byte[])

在派生类中实现时,使用传输层安全性 (TLS) 伪随机功能 (PRF) 派生算法派生可用作密钥的字节。When implemented in a derived class, derives bytes that can be used as a key using a Transport Layer Security (TLS) Pseudo-Random Function (PRF) derivation algorithm.

Dispose() Dispose() Dispose() Dispose()

释放 AsymmetricAlgorithm 类的当前实例所使用的所有资源。Releases all resources used by the current instance of the AsymmetricAlgorithm class.

(Inherited from AsymmetricAlgorithm)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

释放 AsymmetricAlgorithm 类使用的非托管资源,并可以选择释放托管资源。Releases the unmanaged resources used by the AsymmetricAlgorithm class and optionally releases the managed resources.

(Inherited from AsymmetricAlgorithm)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
ExportECPrivateKey() ExportECPrivateKey() ExportECPrivateKey() ExportECPrivateKey()

以 ECPrivateKey 格式导出当前密钥。Exports the current key in the ECPrivateKey format.

ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters) ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters) ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters) ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

使用基于字节的密码以 PKCS#8 EncryptedPrivateKeyInfo 格式导出当前密钥。Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password.

(Inherited from AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters) ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters) ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters) ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters)

使用基于字符的密码以 PKCS#8 EncryptedPrivateKeyInfo 格式导出当前密钥。Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.

(Inherited from AsymmetricAlgorithm)
ExportExplicitParameters(Boolean) ExportExplicitParameters(Boolean) ExportExplicitParameters(Boolean) ExportExplicitParameters(Boolean)

在派生类中替换时,使用显式曲线形式,从正常运行的 ECDiffieHellman 密钥将公钥或公钥和私钥信息导出到 ECParameters 结构,使其可传递到 ImportParameters(ECParameters) 方法。When overridden in a derived class, exports either the public or the public and private key information using the explicit curve form from a working ECDiffieHellman key to an ECParameters structure so that it can be passed to the ImportParameters(ECParameters) method.

ExportParameters(Boolean) ExportParameters(Boolean) ExportParameters(Boolean) ExportParameters(Boolean)

在派生类中替换时,从正常运行的 ECDiffieHellman 密钥将公钥或公钥和私钥信息导出到 ECParameters 结构,使其可传递到 ImportParameters(ECParameters) 方法。When overridden in a derived class, exports either the public or the public and private key information from a working ECDiffieHellman key to an ECParameters structure so that it can be passed to the ImportParameters(ECParameters) method.

ExportPkcs8PrivateKey() ExportPkcs8PrivateKey() ExportPkcs8PrivateKey() ExportPkcs8PrivateKey()

以 PKCS#8 PrivateKeyInfo 格式导出当前密钥。Exports the current key in the PKCS#8 PrivateKeyInfo format.

(Inherited from AsymmetricAlgorithm)
ExportSubjectPublicKeyInfo() ExportSubjectPublicKeyInfo() ExportSubjectPublicKeyInfo() ExportSubjectPublicKeyInfo()

以 X.509 SubjectPublicKeyInfo 格式导出当前密钥的公钥部分。Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format.

(Inherited from AsymmetricAlgorithm)
FromXmlString(String) FromXmlString(String) FromXmlString(String) FromXmlString(String)

在所有情况下均引发此方法。This method throws in all cases.

GenerateKey(ECCurve) GenerateKey(ECCurve) GenerateKey(ECCurve) GenerateKey(ECCurve)

在派生类中替换时,为指定曲线生成新的临时公钥/私钥对。When overridden in a derived class, generates a new ephemeral public/private key pair for the specified curve.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
ImportECPrivateKey(ReadOnlySpan<Byte>, Int32) ImportECPrivateKey(ReadOnlySpan<Byte>, Int32) ImportECPrivateKey(ReadOnlySpan<Byte>, Int32) ImportECPrivateKey(ReadOnlySpan<Byte>, Int32)

从 ECPrivateKey 结构中导入公共/私有密钥对,替换此对象的密钥。Imports the public/private keypair from an ECPrivateKey structure, replacing the keys for this object.

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32) ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32) ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32) ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

使用基于字节的密码解密之后,从 PKCS#8 EncryptedPrivateKeyInfo 结构中导入公/私钥对,以替换此对象的密钥。Imports the public/private keypair from a PKCS#8 EncryptedPrivateKeyInfo structure after decrypting with a byte-based password, replacing the keys for this object.

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32) ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32) ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32) ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

使用基于字符的密码解密之后,从 PKCS#8 EncryptedPrivateKeyInfo 结构中导入公/私钥对,以替换此对象的密钥。Imports the public/private keypair from a PKCS#8 EncryptedPrivateKeyInfo structure after decrypting with a char-based password, replacing the keys for this object.

ImportParameters(ECParameters) ImportParameters(ECParameters) ImportParameters(ECParameters) ImportParameters(ECParameters)

在派生类中替代时,将 ECCurve 的指定参数作为临时密钥导入到当前 ECDiffieHellman 对象。When overridden in a derived class, imports the specified parameters for an ECCurve as an ephemeral key into the current ECDiffieHellman object.

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32) ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32) ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32) ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

解密后,从 PKCS#8 PrivateKeyInfo 结构中导入公/私钥对,以替换此对象的密钥。Imports the public/private keypair from a PKCS#8 PrivateKeyInfo structure after decryption, replacing the keys for this object.

ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32) ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32) ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32) ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

解密后,从 X.509 SubjectPublicKeyInfo 结构中导入公钥,以替换此对象的密钥。Imports the public key from an X.509 SubjectPublicKeyInfo structure after decryption, replacing the keys for this object.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。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)
ToXmlString(Boolean) ToXmlString(Boolean) ToXmlString(Boolean) ToXmlString(Boolean)

在所有情况下均引发此方法。This method throws in all cases.

TryExportECPrivateKey(Span<Byte>, Int32) TryExportECPrivateKey(Span<Byte>, Int32) TryExportECPrivateKey(Span<Byte>, Int32) TryExportECPrivateKey(Span<Byte>, Int32)

尝试以 ECPrivateKey 格式将当前密钥导入所提供的缓冲区。Attempts to export the current key in the ECPrivateKey format into a provided buffer.

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32) TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32) TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32) TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

尝试使用基于字节的密码以 PKCS#8 EncryptedPrivateKeyInfo 格式将当前密钥导出到所提供的缓冲区。Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password.

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32) TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32) TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32) TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

尝试使用基于字符的密码以 PKCS#8 EncryptedPrivateKeyInfo 格式将当前密钥导入所提供的缓冲区。Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.

TryExportPkcs8PrivateKey(Span<Byte>, Int32) TryExportPkcs8PrivateKey(Span<Byte>, Int32) TryExportPkcs8PrivateKey(Span<Byte>, Int32) TryExportPkcs8PrivateKey(Span<Byte>, Int32)

尝试以 PKCS#8 PrivateKeyInfo 格式将当前密钥导出到所提供的缓冲区。Attempts to export the current key in the PKCS#8 PrivateKeyInfo format into a provided buffer.

TryExportSubjectPublicKeyInfo(Span<Byte>, Int32) TryExportSubjectPublicKeyInfo(Span<Byte>, Int32) TryExportSubjectPublicKeyInfo(Span<Byte>, Int32) TryExportSubjectPublicKeyInfo(Span<Byte>, Int32)

尝试以 X.509 SubjectPublicKeyInfo 格式将当前密钥导出到所提供的缓冲区。Attempts to export the current key in the X.509 SubjectPublicKeyInfo format into a provided buffer.

字段

KeySizeValue KeySizeValue KeySizeValue KeySizeValue

表示非对称算法所用密钥模块的大小(以位为单位)。Represents the size, in bits, of the key modulus used by the asymmetric algorithm.

(Inherited from AsymmetricAlgorithm)
LegalKeySizesValue LegalKeySizesValue LegalKeySizesValue LegalKeySizesValue

指定非对称算法支持的密钥大小。Specifies the key sizes that are supported by the asymmetric algorithm.

(Inherited from AsymmetricAlgorithm)

显式界面实现

IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose()

有关此成员的说明,请参见 Dispose()For a description of this member, see Dispose().

(Inherited from AsymmetricAlgorithm)

适用于