1EVP_DigestVerifyInit(3) OpenSSL EVP_DigestVerifyInit(3)
2
3
4
6 EVP_DigestVerifyInit, EVP_DigestVerifyUpdate, EVP_DigestVerifyFinal -
7 EVP signature verification functions
8
10 #include <openssl/evp.h>
11
12 int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
13 const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
14 int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);
15 int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen);
16
18 The EVP signature routines are a high level interface to digital
19 signatures.
20
21 EVP_DigestVerifyInit() sets up verification context ctx to use digest
22 type from ENGINE impl and public key pkey. ctx must be initialized with
23 EVP_MD_CTX_init() before calling this function. If pctx is not NULL the
24 EVP_PKEY_CTX of the verification operation will be written to *pctx:
25 this can be used to set alternative verification options.
26
27 EVP_DigestVerifyUpdate() hashes cnt bytes of data at d into the
28 verification context ctx. This function can be called several times on
29 the same ctx to include additional data. This function is currently
30 implemented using a macro.
31
32 EVP_DigestVerifyFinal() verifies the data in ctx against the signature
33 in sig of length siglen.
34
36 EVP_DigestVerifyInit() and EVP_DigestVerifyUpdate() return 1 for
37 success and 0 or a negative value for failure. In particular a return
38 value of -2 indicates the operation is not supported by the public key
39 algorithm.
40
41 EVP_DigestVerifyFinal() returns 1 for success; any other value
42 indicates failure. A return value of zero indicates that the signature
43 did not verify successfully (that is, tbs did not match the original
44 data or the signature had an invalid form), while other values indicate
45 a more serious error (and sometimes also indicate an invalid signature
46 form).
47
48 The error codes can be obtained from ERR_get_error(3).
49
51 The EVP interface to digital signatures should almost always be used in
52 preference to the low level interfaces. This is because the code then
53 becomes transparent to the algorithm used and much more flexible.
54
55 In previous versions of OpenSSL there was a link between message digest
56 types and public key algorithms. This meant that "clone" digests such
57 as EVP_dss1() needed to be used to sign using SHA1 and DSA. This is no
58 longer necessary and the use of clone digest is now discouraged.
59
60 For some key types and parameters the random number generator must be
61 seeded or the operation will fail.
62
63 The call to EVP_DigestVerifyFinal() internally finalizes a copy of the
64 digest context. This means that EVP_VerifyUpdate() and
65 EVP_VerifyFinal() can be called later to digest and verify additional
66 data.
67
68 Since only a copy of the digest context is ever finalized the context
69 must be cleaned up after use by calling EVP_MD_CTX_cleanup() or a
70 memory leak will occur.
71
73 EVP_DigestSignInit(3), EVP_DigestInit(3), err(3), evp(3), hmac(3),
74 md2(3), md5(3), mdc2(3), ripemd(3), sha(3), dgst(1)
75
77 EVP_DigestVerifyInit(), EVP_DigestVerifyUpdate() and
78 EVP_DigestVerifyFinal() were first added to OpenSSL 1.0.0.
79
80
81
821.0.2o 2020-08-01 EVP_DigestVerifyInit(3)