ECDiffieHellmanCng.DeriveKeyMaterial 方法

定义

派生从双方之间的机密协议生成的密钥材料。

重载

DeriveKeyMaterial(CngKey)

在给定包含第二方公钥的 CngKey 对象的情况下,派生从双方之间的机密协议生成的密钥材料。

DeriveKeyMaterial(ECDiffieHellmanPublicKey)

在给定包含第二方公钥的 ECDiffieHellmanPublicKey 对象的情况下,派生从双方之间的机密协议生成的密钥材料。

注解

椭圆曲线Diffie-Hellman (ECDH) 算法接受私钥和其他方的公钥作为输入,并将机密协议生成为输出。 密钥派生函数 (KDF) 然后获取机密协议,并生成密钥材料作为输出。

DeriveKeyMaterial(CngKey)

在给定包含第二方公钥的 CngKey 对象的情况下,派生从双方之间的机密协议生成的密钥材料。

public:
 cli::array <System::Byte> ^ DeriveKeyMaterial(System::Security::Cryptography::CngKey ^ otherPartyPublicKey);
public byte[] DeriveKeyMaterial (System.Security.Cryptography.CngKey otherPartyPublicKey);
[System.Security.SecurityCritical]
public byte[] DeriveKeyMaterial (System.Security.Cryptography.CngKey otherPartyPublicKey);
override this.DeriveKeyMaterial : System.Security.Cryptography.CngKey -> byte[]
[<System.Security.SecurityCritical>]
override this.DeriveKeyMaterial : System.Security.Cryptography.CngKey -> byte[]
Public Function DeriveKeyMaterial (otherPartyPublicKey As CngKey) As Byte()

参数

otherPartyPublicKey
CngKey

一个对象,它包含来自密钥交换中另一方的椭圆曲线 Diffie-Hellman (ECDH) 密钥的公共部分。

返回

Byte[]

一个包含密钥材料的字节数组。 此信息从机密协议生成,机密协议是从当前对象的私钥和指定的公钥计算得到的。

属性

例外

otherPartyPublicKeynull

otherPartyPublicKey 无效。 它的 AlgorithmGroup 属性未指定 ECDiffieHellman,或者其密钥大小与此实例的密钥大小不匹配。

此对象的 KeyDerivationFunction 属性指定了 Tls 密钥派生函数,但 LabelSeednull

所有其他错误。

适用于

DeriveKeyMaterial(ECDiffieHellmanPublicKey)

在给定包含第二方公钥的 ECDiffieHellmanPublicKey 对象的情况下,派生从双方之间的机密协议生成的密钥材料。

public:
 override cli::array <System::Byte> ^ DeriveKeyMaterial(System::Security::Cryptography::ECDiffieHellmanPublicKey ^ otherPartyPublicKey);
public override byte[] DeriveKeyMaterial (System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey);
override this.DeriveKeyMaterial : System.Security.Cryptography.ECDiffieHellmanPublicKey -> byte[]
Public Overrides Function DeriveKeyMaterial (otherPartyPublicKey As ECDiffieHellmanPublicKey) As Byte()

参数

otherPartyPublicKey
ECDiffieHellmanPublicKey

密钥交换中另一方的公钥。

返回

Byte[]

一个包含密钥材料的字节数组。 此信息从机密协议生成,机密协议是从当前对象的私钥和指定的公钥计算得到的。

例外

otherPartyPublicKeynull

otherPartyPublicKey 不是 ECDiffieHellmanCngPublicKey 密钥。

适用于