开发者

Is it possible to reuse a CryptVerifySignature() hash object?

开发者 https://www.devze.com 2023-04-06 18:22 出处:网络
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

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号