I'm implementing hashing (aka. digest) and signing in an app that uses the OpenSSL EVP API. However the API has three very similar methods, which are confusing:
Sign
which sounds like it should be used for signing, howeverEVP_SignInit
is simply a#define
toEVP_DigestInit
Digest
which seems like it can only be used only for hash generation, there is no way to specify anEVP_PKEY
.DigestSign
which looks like it does both the hashing and the signing.
But the documentation recomments to use DigestSign
for signing (and not the actual Sign
).
I'm not a cryptography expert, so this is very confusing to me. What is the difference between them? Which one is a good choice for implementing signing?