1EVP_VERIFYINIT(3ossl)               OpenSSL              EVP_VERIFYINIT(3ossl)
2
3
4

NAME

6       EVP_VerifyInit_ex, EVP_VerifyInit, EVP_VerifyUpdate,
7       EVP_VerifyFinal_ex, EVP_VerifyFinal - EVP signature verification
8       functions
9

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUES

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 -1 if some other error occurred.
52
53       The error codes can be obtained by ERR_get_error(3).
54

NOTES

56       The EVP interface to digital signatures should almost always be used in
57       preference to the low-level interfaces. This is because the code then
58       becomes transparent to the algorithm used and much more flexible.
59
60       The call to EVP_VerifyFinal() internally finalizes a copy of the digest
61       context.  This means that calls to EVP_VerifyUpdate() and
62       EVP_VerifyFinal() can be called later to digest and verify additional
63       data.
64
65       Since only a copy of the digest context is ever finalized the context
66       must be cleaned up after use by calling EVP_MD_CTX_free() or a memory
67       leak will occur.
68

BUGS

70       Older versions of this documentation wrongly stated that calls to
71       EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal().
72
73       Since the public key is passed in the call to EVP_SignFinal() any error
74       relating to the private key (for example an unsuitable key and digest
75       combination) will not be indicated until after potentially large
76       amounts of data have been passed through EVP_SignUpdate().
77
78       It is not possible to change the signing parameters using these
79       function.
80
81       The previous two bugs are fixed in the newer EVP_DigestVerify*()
82       function.
83

SEE ALSO

85       evp(7), EVP_SignInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3),
86       MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1)
87

HISTORY

89       The function EVP_VerifyFinal_ex() was added in OpenSSL 3.0.
90
92       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
93
94       Licensed under the Apache License 2.0 (the "License").  You may not use
95       this file except in compliance with the License.  You can obtain a copy
96       in the file LICENSE in the source distribution or at
97       <https://www.openssl.org/source/license.html>.
98
99
100
1013.0.5                             2022-07-05             EVP_VERIFYINIT(3ossl)
Impressum