The NCryptSecretAgreement function creates a secret agreement value from a private and a public key.
SECURITY_STATUS NCryptSecretAgreement( NCRYPT_KEY_HANDLE hPrivKey, NCRYPT_KEY_HANDLE hPubKey, NCRYPT_SECRET_HANDLE *phAgreedSecret, DWORD dwFlags );
The handle of the private key to use to create the secret agreement value. This key and the hPubKey key must come from the same key storage provider.
The handle of the public key to use to create the secret agreement value. This key and the hPrivKey key must come from the same key storage provider.
A pointer to an NCRYPT_SECRET_HANDLE variable that receives a handle that represents the secret agreement value. When this handle is no longer needed, release it by passing it to the NCryptFreeObject function.
Flags that modify function behavior. This can be zero or a combination of one or more of the following values. The set of valid flags is specific to each key storage provider. The following flag applies to all providers.
||Requests that the key service provider (KSP) not display any user interface. If the provider must display the UI to operate, the call fails and the KSP should set the NTE_SILENT_CONTEXT error code as the last error.|
Returns a status code that indicates the success or failure of the function.
Possible return codes include, but are not limited to, the following.
||The function was successful.|
||The hPrivKey or the hPubKey parameter is not valid.|
||One or more parameters are not valid.|
||A memory allocation failure occurred.|
A service must not call this function from its StartService Function. If a service calls this function from its StartService function, a deadlock can occur, and the service may stop responding.
|Minimum supported client||Windows Vista [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2008 [desktop apps | UWP apps]|