1EVP_VERIFYINIT(3ossl) OpenSSL EVP_VERIFYINIT(3ossl)
2
3
4
6 EVP_VerifyInit_ex, EVP_VerifyInit, EVP_VerifyUpdate,
7 EVP_VerifyFinal_ex, EVP_VerifyFinal - EVP signature verification
8 functions
9
11 #include <openssl/evp.h>
12
13 int EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
14 int EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
15 int EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
16 unsigned int siglen, EVP_PKEY *pkey,
17 OSSL_LIB_CTX *libctx, const char *propq);
18 int EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf, unsigned int siglen,
19 EVP_PKEY *pkey);
20
21 int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type);
22
24 The EVP signature verification routines are a high-level interface to
25 digital signatures.
26
27 EVP_VerifyInit_ex() sets up verification context ctx to use digest type
28 from ENGINE impl. ctx must be created by calling EVP_MD_CTX_new()
29 before calling this function.
30
31 EVP_VerifyUpdate() hashes cnt bytes of data at d into the verification
32 context ctx. This function can be called several times on the same ctx
33 to include additional data.
34
35 EVP_VerifyFinal_ex() verifies the data in ctx using the public key pkey
36 and siglen bytes in sigbuf. The library context libctx and property
37 query propq are used when creating a context to use with the key pkey.
38
39 EVP_VerifyFinal() is similar to EVP_VerifyFinal_ex() but uses default
40 values of NULL for the library context libctx and the property query
41 propq.
42
43 EVP_VerifyInit() initializes verification context ctx to use the
44 default implementation of digest type.
45
47 EVP_VerifyInit_ex() and EVP_VerifyUpdate() return 1 for success and 0
48 for failure.
49
50 EVP_VerifyFinal_ex() and EVP_VerifyFinal() return 1 for a correct
51 signature, 0 for failure and a negative value if some other error
52 occurred.
53
54 The error codes can be obtained by ERR_get_error(3).
55
57 The EVP interface to digital signatures should almost always be used in
58 preference to the low-level interfaces. This is because the code then
59 becomes transparent to the algorithm used and much more flexible.
60
61 The call to EVP_VerifyFinal() internally finalizes a copy of the digest
62 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_free() or a memory
68 leak will occur.
69
71 Older versions of this documentation wrongly stated that calls to
72 EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal().
73
74 Since the public key is passed in the call to EVP_SignFinal() any error
75 relating to the private key (for example an unsuitable key and digest
76 combination) will not be indicated until after potentially large
77 amounts of data have been passed through EVP_SignUpdate().
78
79 It is not possible to change the signing parameters using these
80 function.
81
82 The previous two bugs are fixed in the newer EVP_DigestVerify*()
83 function.
84
86 evp(7), EVP_SignInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3),
87 MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1)
88
90 The function EVP_VerifyFinal_ex() was added in OpenSSL 3.0.
91
93 Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
94
95 Licensed under the Apache License 2.0 (the "License"). You may not use
96 this file except in compliance with the License. You can obtain a copy
97 in the file LICENSE in the source distribution or at
98 <https://www.openssl.org/source/license.html>.
99
100
101
1023.1.1 2023-08-31 EVP_VERIFYINIT(3ossl)