ECDiffieHellman 类

定义

提供一个抽象基类,可以从它派生椭圆曲线 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
继承
ECDiffieHellman
派生

注解

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

构造函数

ECDiffieHellman()

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

字段

KeySizeValue

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

(继承自 AsymmetricAlgorithm)
LegalKeySizesValue

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

(继承自 AsymmetricAlgorithm)

属性

KeyExchangeAlgorithm

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

KeySize

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

(继承自 AsymmetricAlgorithm)
LegalKeySizes

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

(继承自 AsymmetricAlgorithm)
PublicKey

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

SignatureAlgorithm

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

方法

Clear()

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

(继承自 AsymmetricAlgorithm)
Create()

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

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)

创建椭圆曲线 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)

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

DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName)

使用指定的哈希算法执行密钥派生。Performs key derivation using a specified hash algorithm.

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

在派生类中实现时,使用指定的哈希算法对可选的添加数据或追加数据执行密钥派生。When implemented in a derived class, performs key derivation using a specified hash algorithm with optional prepended or appended data.

DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[])

使用指定的 HMAC(基于哈希的消息验证代码)算法执行密钥派生。Performs key derivation using a specified HMAC (Hash-based Message Authentication Code) algorithm.

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

在派生类中实现时,使用指定的 HMAC(基于哈希的消息验证代码)算法对可选的添加数据或追加数据执行密钥派生。When implemented in a derived class, performs key derivation using a specified HMAC (Hash-based Message Authentication Code) algorithm with optional prepended or appended data.

DeriveKeyMaterial(ECDiffieHellmanPublicKey)

在派生类中实现时,对共享机密执行密钥派生。When implemented in a derived class, performs a key derivation on the shared secret.

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

在派生类中实现时,使用 TLS(传输层安全性)1.1 PRF(伪随机函数)执行密钥派生。When implemented in a derived class, performs key derivation using the TLS (Transport Layer Security) 1.1 PRF (Pseudo-Random Function).

Dispose()

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

(继承自 AsymmetricAlgorithm)
Dispose(Boolean)

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

(继承自 AsymmetricAlgorithm)
Equals(Object)

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

(继承自 Object)
ExportECPrivateKey()

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

ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

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

(继承自 AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters)

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

(继承自 AsymmetricAlgorithm)
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)

在派生类中替换时,从正常运行的 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()

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

(继承自 AsymmetricAlgorithm)
ExportSubjectPublicKeyInfo()

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

(继承自 AsymmetricAlgorithm)
FromXmlString(String)

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

FromXmlString(String)

当在派生类中重写时,从 XML 字符串重新构造 AsymmetricAlgorithm 对象。When overridden in a derived class, reconstructs an AsymmetricAlgorithm object from an XML string. 否则,将引发 NotImplementedExceptionOtherwise, throws a NotImplementedException.

(继承自 AsymmetricAlgorithm)
GenerateKey(ECCurve)

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

GetHashCode()

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

(继承自 Object)
GetType()

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

(继承自 Object)
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)

使用基于字节的密码解密之后,从 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<Byte>, ReadOnlySpan<Byte>, Int32)

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

(继承自 AsymmetricAlgorithm)
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.

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

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

(继承自 AsymmetricAlgorithm)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>) (继承自 AsymmetricAlgorithm)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>) (继承自 AsymmetricAlgorithm)
ImportFromPem(ReadOnlySpan<Char>)
ImportFromPem(ReadOnlySpan<Char>) (继承自 AsymmetricAlgorithm)
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)

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

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

在派生的类中替代时,解密后从 PKCS#8 PrivateKeyInfo 结构中导入公/私钥对,以替换此对象的密钥。When overriden in a derived class, imports the public/private keypair from a PKCS#8 PrivateKeyInfo structure after decryption, replacing the keys for this object.

(继承自 AsymmetricAlgorithm)
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.

ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

在派生的类中替代时,解密后从 X.509 SubjectPublicKeyInfo 结构中导入公/私钥对,以替换此对象的密钥。When overriden in a derived class, imports the public key from an X.509 SubjectPublicKeyInfo structure after decryption, replacing the keys for this object.

(继承自 AsymmetricAlgorithm)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)
ToXmlString(Boolean)

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

ToXmlString(Boolean)

当在派生类中重写时,创建并返回当前 AsymmetricAlgorithm 对象的 XML 字符串表示形式。When overridden in a derived class, creates and returns an XML string representation of the current AsymmetricAlgorithm object. 否则,将引发 NotImplementedExceptionOtherwise, throws a NotImplementedException.

(继承自 AsymmetricAlgorithm)
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)

尝试使用基于字节的密码以 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<Byte>, PbeParameters, Span<Byte>, Int32)

在派生的类中替代时,尝试使用基于字节的密码以 PKCS#8 EncryptedPrivateKeyInfo 格式将当前密钥导出到所提供的缓冲区。When overridden in a derived class, attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password.

(继承自 AsymmetricAlgorithm)
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.

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

在派生的类中替代时,尝试使用基于字符的密码以 PKCS#8 EncryptedPrivateKeyInfo 格式将当前密钥导出到所提供的缓冲区。When overriden in a derived class, attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.

(继承自 AsymmetricAlgorithm)
TryExportPkcs8PrivateKey(Span<Byte>, Int32)

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

TryExportPkcs8PrivateKey(Span<Byte>, Int32)

在派生的类中替代时,尝试以 PKCS#8 PrivateKeyInfo 格式将当前密钥导出到所提供的缓冲区。When overridden in a derived class, attempts to export the current key in the PKCS#8 PrivateKeyInfo format into a provided buffer.

(继承自 AsymmetricAlgorithm)
TryExportSubjectPublicKeyInfo(Span<Byte>, Int32)

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

TryExportSubjectPublicKeyInfo(Span<Byte>, Int32)

在派生的类中替代时,尝试以 X.509 SubjectPublicKeyInfo 格式将当前密钥导出到所提供的缓冲区。When overridden in a derived class, attempts to export the current key in the X.509 SubjectPublicKeyInfo format into a provided buffer.

(继承自 AsymmetricAlgorithm)

显式接口实现

IDisposable.Dispose()

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

(继承自 AsymmetricAlgorithm)

适用于