ECDiffieHellmanCng.DeriveSecretAgreementHandle Method

Definition

Gets a handle to the secret agreement generated between two parties.

Overloads

DeriveSecretAgreementHandle(ECDiffieHellmanPublicKey)

Gets a handle to the secret agreement generated between two parties, given an ECDiffieHellmanPublicKey object that contains the second party's public key.

DeriveSecretAgreementHandle(CngKey)

Gets a handle to the secret agreement generated between two parties, given a CngKey object that contains the second party's public key.

Remarks

The DeriveSecretAgreementHandle method overloads are for advanced users who need a handle to the raw secret agreement instead of the key material. The secret agreement handle can be used in platform invoke calls to perform any work that is not wrapped by the ECDiffieHellmanCng class.

DeriveSecretAgreementHandle(ECDiffieHellmanPublicKey)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

Gets a handle to the secret agreement generated between two parties, given an ECDiffieHellmanPublicKey object that contains the second party's public key.

public:
 Microsoft::Win32::SafeHandles::SafeNCryptSecretHandle ^ DeriveSecretAgreementHandle(System::Security::Cryptography::ECDiffieHellmanPublicKey ^ otherPartyPublicKey);
public Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle DeriveSecretAgreementHandle (System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey);
member this.DeriveSecretAgreementHandle : System.Security.Cryptography.ECDiffieHellmanPublicKey -> Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle
Public Function DeriveSecretAgreementHandle (otherPartyPublicKey As ECDiffieHellmanPublicKey) As SafeNCryptSecretHandle

Parameters

otherPartyPublicKey
ECDiffieHellmanPublicKey

The public key from the other party in the key exchange.

Returns

A handle to the secret agreement. This information is calculated from the current object's private key and the specified public key.

Exceptions

otherPartyPublicKey is null.

otherPartyPublicKey is not an ECDiffieHellmanPublicKey key.

Applies to

DeriveSecretAgreementHandle(CngKey)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

Gets a handle to the secret agreement generated between two parties, given a CngKey object that contains the second party's public key.

public:
 Microsoft::Win32::SafeHandles::SafeNCryptSecretHandle ^ DeriveSecretAgreementHandle(System::Security::Cryptography::CngKey ^ otherPartyPublicKey);
public Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle DeriveSecretAgreementHandle (System.Security.Cryptography.CngKey otherPartyPublicKey);
[System.Security.SecurityCritical]
public Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle DeriveSecretAgreementHandle (System.Security.Cryptography.CngKey otherPartyPublicKey);
member this.DeriveSecretAgreementHandle : System.Security.Cryptography.CngKey -> Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle
[<System.Security.SecurityCritical>]
member this.DeriveSecretAgreementHandle : System.Security.Cryptography.CngKey -> Microsoft.Win32.SafeHandles.SafeNCryptSecretHandle
Public Function DeriveSecretAgreementHandle (otherPartyPublicKey As CngKey) As SafeNCryptSecretHandle

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 handle to the secret agreement. This information is calculated from the current object's private key and the specified public key.

Attributes

Exceptions

otherPartyPublicKey is null.

otherPartyPublicKey is not an ECDH key, or it is not the correct size.

All other errors.

Applies to