Reputation: 2215
There are plenty of examples written in C on how to verify a digital signature on a message but my use case requires me to provide only the message hash.
So is there an alternative to EVP_DigestVerifyUpdate(mdctx, msg, strlen(msg));
where I could directly provide a hash?
Upvotes: 1
Views: 1163
Reputation: 1490
Is this what you are looking for?
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
Upvotes: 1