Expand Minimize
EN
Deze inhoud is niet beschikbaar in uw taal, maar wel in het Engels.

CryptDestroyHash function

The CryptDestroyHash function destroys the hash object referenced by the hHash parameter. After a hash object has been destroyed, it can no longer be used.

To help ensure security, we recommend that hash objects be destroyed after they have been used.

Syntax


BOOL WINAPI CryptDestroyHash(
  _In_  HCRYPTHASH hHash
);

Parameters

hHash [in]

The handle of the hash object to be destroyed.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. For extended error information, call GetLastError.

The error codes prefaced by "NTE" are generated by the particular cryptographic service provider (CSP) you are using. Some possible error codes follow.

Return codeDescription
ERROR_BUSY

The hash object specified by hHash is currently being used and cannot be destroyed.

ERROR_INVALID_HANDLE

The hHash parameter specifies a handle that is not valid.

ERROR_INVALID_PARAMETER

The hHash parameter contains a value that is not valid.

NTE_BAD_ALGID

The hHash handle specifies an algorithm that this CSP does not support.

NTE_BAD_HASH

The hash object specified by the hHash parameter is not valid.

NTE_BAD_UID

The CSP context that was specified when the hash object was created cannot be found.

 

Remarks

When a hash object is destroyed, many CSPs overwrite the memory in the CSP where the hash object was held. The CSP memory is then freed.

There should be a one-to-one correspondence between calls to CryptCreateHash and CryptDestroyHash.

All hash objects that have been created by using a specific CSP must be destroyed before that CSP handle is released with the CryptReleaseContext function.

Examples

For an example that uses the CryptDestroyHash function, see Example C Program: Creating and Hashing a Session Key.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Wincrypt.h

Library

Advapi32.lib

DLL

Advapi32.dll

See also

Hash and Digital Signature Functions
CryptCreateHash
CryptHashData
CryptSignHash

 

 

Community-inhoud

Toevoegen
Weergeven:
© 2014 Microsoft