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 impossible?
I imagine the
HCRYPTHASHdata structure is more flexible than just being used to call withCryptVerifySignature(). It’s designed to operate on a (possibly discontinuous) stream of data (viaCryptHashData()), 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
resetfunction for theHCRYPTHASHstructure… but they didn’t!