Is it possible to reuse a CryptVerifySignature() hash object?
MSDN says that after CryptVerifySignature()
you cannot reuse HCRYPTHASH
object to try hashing more data, instead it says you need to recreate it with CryptDestroyHash()
and CryptCreateHash()
. Reusing really fails.
Anyone is familiar with a hack that can save these calls, or it is really impossi开发者_如何学Pythonble?
I imagine the HCRYPTHASH
data structure is more flexible than just being used to call with CryptVerifySignature()
. It's designed to operate on a (possibly discontinuous) stream of data (via CryptHashData()
), which means it stores some state within it on the hash's current values. Therefore, once you've used it on a stream (even partial) the state is irrevocably altered, so you can't use it on another stream.
I guess they could've provided a reset
function for the HCRYPTHASH
structure... but they didn't!
精彩评论