ECDiffieHellmanCng.DeriveKeyMaterial Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Derives the key material that is generated from the secret agreement between two parties.
Overloads
DeriveKeyMaterial(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) |
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. |
Remarks
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. The key derivation function (KDF) then takes the secret agreement and produces the key material as output.
DeriveKeyMaterial(CngKey)
- Source:
- Cng.NotSupported.cs
- Source:
- Cng.NotSupported.cs
- Source:
- Cng.NotSupported.cs
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);
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()
Parameters
- otherPartyPublicKey
- CngKey
An object that contains the public part of the Elliptic Curve Diffie-Hellman (ECDH) key from the other party in the key exchange.
Returns
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.
- Attributes
Exceptions
otherPartyPublicKey
is null
.
otherPartyPublicKey
is invalid. Either its AlgorithmGroup property does not specify ECDiffieHellman or its key size does not match the key size of this instance.
This object's KeyDerivationFunction property specifies the Tls key derivation function, but either Label or Seed is null
.
All other errors.
Applies to
DeriveKeyMaterial(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()
Parameters
- otherPartyPublicKey
- ECDiffieHellmanPublicKey
The public key from the other party in the key exchange.
Returns
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.
Exceptions
otherPartyPublicKey
is null
.
otherPartyPublicKey
is not an ECDiffieHellmanCngPublicKey key.