ECDiffieHellmanCng.DeriveKeyMaterial 方法

定义

派生从双方之间的机密协议生成的密钥材料。Derives the key material that is generated from the secret agreement between two parties.

重载

DeriveKeyMaterial(CngKey)

在给定包含第二方公钥的 CngKey 对象的情况下,派生从双方之间的机密协议生成的密钥材料。Derives the key material that is generated from the secret agreement between two parties, given a CngKey object that contains the second party's public key.

DeriveKeyMaterial(ECDiffieHellmanPublicKey)

在给定包含第二方公钥的 ECDiffieHellmanPublicKey 对象的情况下,派生从双方之间的机密协议生成的密钥材料。Derives the key material that is generated from the secret agreement between two parties, given an ECDiffieHellmanPublicKey object that contains the second party's public key.

注解

椭圆曲线 Diffie-hellman (ECDH) 算法接受私钥和另一方的公钥作为输入, 并生成机密协议作为输出。The Elliptic Curve Diffie-Hellman (ECDH) algorithm accepts the private key and the other party's public key as input, and produces the secret agreement as output. 然后, 密钥派生函数 (KDF) 采用机密协议, 并生成密钥材料作为输出。The key derivation function (KDF) then takes the secret agreement and produces the key material as output.

DeriveKeyMaterial(CngKey)

在给定包含第二方公钥的 CngKey 对象的情况下,派生从双方之间的机密协议生成的密钥材料。Derives the key material that is generated from the secret agreement between two parties, given a CngKey object that contains the second party's public key.

public:
 cli::array <System::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[]
Public Function DeriveKeyMaterial (otherPartyPublicKey As CngKey) As Byte()

参数

otherPartyPublicKey
CngKey

一个对象,它包含来自密钥交换中另一方的椭圆曲线 Diffie-Hellman (ECDH) 密钥的公共部分。An object that contains the public part of the Elliptic Curve Diffie-Hellman (ECDH) key from the other party in the key exchange.

返回

Byte[]

一个包含密钥材料的字节数组。A byte array that contains the key material. 此信息从机密协议生成,机密协议是从当前对象的私钥和指定的公钥计算得到的。This information is generated from the secret agreement that is calculated from the current object's private key and the specified public key.

属性

异常

otherPartyPublicKeynullotherPartyPublicKey is null.

otherPartyPublicKey 无效。otherPartyPublicKey is invalid. 它的 AlgorithmGroup 属性未指定 ECDiffieHellman,或者其密钥大小与此实例的密钥大小不匹配。Either its AlgorithmGroup property does not specify ECDiffieHellman or its key size does not match the key size of this instance.

此对象的 KeyDerivationFunction 属性指定了 Tls 密钥派生函数,但 LabelSeednullThis object's KeyDerivationFunction property specifies the Tls key derivation function, but either Label or Seed is null.

所有其他错误。All other errors.

DeriveKeyMaterial(ECDiffieHellmanPublicKey)

在给定包含第二方公钥的 ECDiffieHellmanPublicKey 对象的情况下,派生从双方之间的机密协议生成的密钥材料。Derives the key material that is generated from the secret agreement between two parties, given an ECDiffieHellmanPublicKey object that contains the second party's public key.

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

密钥交换中另一方的公钥。The public key from the other party in the key exchange.

返回

Byte[]

一个包含密钥材料的字节数组。A byte array that contains the key material. 此信息从机密协议生成,机密协议是从当前对象的私钥和指定的公钥计算得到的。This information is generated from the secret agreement that is calculated from the current object's private key and the specified public key.

异常

otherPartyPublicKeynullotherPartyPublicKey is null.

otherPartyPublicKey 不是 ECDiffieHellmanCngPublicKey 密钥。otherPartyPublicKey is not an ECDiffieHellmanCngPublicKey key.

适用于