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, unsigned int cnt);
15 int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, 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 Unlike other functions the return value 0 from EVP_DigestVerifyFinal()
42 only indicates that the signature did not not verify successfully (that
43 is tbs did not match the original data or the signature was of invalid
44 form) it is not an indication of a more serious error.
45
46 The error codes can be obtained from ERR_get_error(3).
47
49 The EVP interface to digital signatures should almost always be used in
50 preference to the low level interfaces. This is because the code then
51 becomes transparent to the algorithm used and much more flexible.
52
53 In previous versions of OpenSSL there was a link between message digest
54 types and public key algorithms. This meant that "clone" digests such
55 as EVP_dss1() needed to be used to sign using SHA1 and DSA. This is no
56 longer necessary and the use of clone digest is now discouraged.
57
58 For some key types and parameters the random number generator must be
59 seeded or the operation will fail.
60
61 The call to EVP_DigestVerifyFinal() internally finalizes a copy of the
62 digest context. This means that calls to EVP_VerifyUpdate() and
63 EVP_VerifyFinal() can be called later to digest and verify additional
64 data.
65
66 Since only a copy of the digest context is ever finalized the context
67 must be cleaned up after use by calling EVP_MD_CTX_cleanup() or a
68 memory leak will occur.
69
71 EVP_DigestSignInit(3), EVP_DigestInit(3), err(3), evp(3), hmac(3),
72 md2(3), md5(3), mdc2(3), ripemd(3), sha(3), dgst(1)
73
75 EVP_DigestVerifyInit(), EVP_DigestVerifyUpdate() and
76 EVP_DigestVerifyFinal() were first added to OpenSSL 1.0.0.
77
78
79
801.0.1e 2013-02-11 EVP_DigestVerifyInit(3)