Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有很多用 C 语言编写的关于如何验证消息上的数字签名的示例,但我的用例要求我只提供消息哈希。
那么有没有替代EVP_DigestVerifyUpdate(mdctx, msg, strlen(msg));我可以直接提供哈希的地方?
EVP_DigestVerifyUpdate(mdctx, msg, strlen(msg));
这是你想要的?
EVP_PKEY *public_key = ...; EVP_PKEY_CTX *public_key_ctx = EVP_PKEY_CTX_new(public_key, NULL); EVP_PKEY_verify_init(public_key_ctx); if (1 != EVP_PKEY_verify(public_key_ctx, sig, siglen, hash, hashlen)) // invalid signature