please dont rip this site Prev Next

CryptSetHashParam info  Overview  Group

The CryptSetHashParam function, in theory, allows applications to customize the operations of a hash object. Currently, only a single parameter is defined for this function.

BOOL CRYPTFUNC CryptSetHashParam(

    HCRYPTHASH hHash,

    DWORD dwParam,

    BYTE *pbData,

    DWORD dwFlags

   );

Parameters

hHash
[in] A handle to the hash object on which to set parameters.
dwParam
[in] The parameter number. See the “Remarks” section for a list of valid parameters.
pbData
[in] The parameter data buffer. Place the parameter data in this buffer before calling CryptSetHashParam. The form of this data will vary, depending on the parameter number.
dwFlags
[in] The flag values. This parameter is reserved for future use and should always be zero.

Remarks

The dwParam parameter can be set to one of the following values:

HP_HASHVAL
Hash value. The pbData buffer should contain a byte array containing a hash value to place directly into the hash object. Before setting this parameter, the size of the hash value should be determined by reading the HP_HASHSIZE parameter with the CryptGetHashParam function.

Normal applications should never set this parameter. In fact, some CSPs may not even support this capability. Occasionally though, it is convenient to sign a hash value that has been generated elsewhere. This is the usual sequence of operations:

  1. The application creates a hash object with CryptCreateHash.

  2. It specifies a hash value by setting the HP_HASHVAL parameter.

  3. It signs the hash value using CryptSignHash, obtaining a digital signature block.

    Because the binding between the hashed data and the signature is fairly tenuous, no description string can be passed into CryptSignHash in this situation.

  4. It destroys the hash object using CryptDestroyHash.

Note that some CSP types may add additional parameters that can be set with this function.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To retrieve extended error information, use the GetLastError function.

The following table lists the error codes most commonly returned by the GetLastError function. The error codes prefaced by “NTE” are generated by the particular CSP you are using.

Error

Description

ERROR_INVALID_HANDLE

One of the parameters specifies an invalid handle.

ERROR_BUSY

The CSP context is currently being used by another process.

ERROR_INVALID_PARAMETER

One of the parameters contains an invalid value. This is most often an illegal pointer.

NTE_BAD_FLAGS

The dwFlags parameter is nonzero or the pbData buffer contains an invalid value.

NTE_BAD_HASH

The hash object specified by the hHash parameter is invalid.

NTE_BAD_TYPE

The dwParam parameter specifies an unknown parameter.

NTE_BAD_UID

The CSP context that was specified when the hKey key was created cannot be found.

NTE_FAIL

The function failed in some unexpected way.

Example

This function is used in a way similar to the CryptSetKeyParam function.

See Also

CryptCreateHash, CryptDestroyHash, CryptGetHashParam, CryptSetKeyParam, CryptSignHash 


file: /Techref/os/win/api/win32/func/src/f12_15.htm, 6KB, , updated: 2000/4/7 11:19, local time: 2024/11/13 06:25,
TOP NEW HELP FIND: 
3.15.29.209:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/Techref/os/win/api/win32/func/src/f12_15.htm"> CryptSetHashParam Release 2]</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?