NCryptSecretAgreement function
The NCryptSecretAgreement function creates a secret agreement value from a private and a public key.
Syntax
SECURITY_STATUS WINAPI NCryptSecretAgreement( _In_ NCRYPT_KEY_HANDLE hPrivKey, _In_ NCRYPT_KEY_HANDLE hPubKey, _Out_ NCRYPT_SECRET_HANDLE *phSecret, _In_ DWORD dwFlags );
Parameters
- hPrivKey [in]
-
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.
- hPubKey [in]
-
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.
- phSecret [out]
-
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.
- dwFlags [in]
-
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.
Return value
Returns a status code that indicates the success or failure of the function.
Possible return codes include, but are not limited to, the following.
| Return code | Description |
|---|---|
|
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. |
Remarks
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.
Requirements
|
Minimum supported client |
Windows Vista [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2008 [desktop apps | Windows Store apps] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also