]>
Commit | Line | Data |
---|---|---|
f7173262 DSH |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
c952780c RS |
5 | EVP_VerifyInit_ex, |
6 | EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal | |
7 | - EVP signature verification functions | |
f7173262 DSH |
8 | |
9 | =head1 SYNOPSIS | |
10 | ||
11 | #include <openssl/evp.h> | |
12 | ||
3811eed8 DSH |
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); | |
aebb9aac | 15 | int EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf, unsigned int siglen, EVP_PKEY *pkey); |
f7173262 | 16 | |
3811eed8 DSH |
17 | int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type); |
18 | ||
f7173262 DSH |
19 | =head1 DESCRIPTION |
20 | ||
21 | The EVP signature verification routines are a high level interface to digital | |
22 | signatures. | |
23 | ||
3811eed8 | 24 | EVP_VerifyInit_ex() sets up verification context B<ctx> to use digest |
25191fff RL |
25 | B<type> from ENGINE B<impl>. B<ctx> must be created by calling |
26 | EVP_MD_CTX_new() before calling this function. | |
f7173262 DSH |
27 | |
28 | EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the | |
c8973693 | 29 | verification context B<ctx>. This function can be called several times on the |
f7173262 DSH |
30 | same B<ctx> to include additional data. |
31 | ||
32 | EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey> | |
3811eed8 DSH |
33 | and against the B<siglen> bytes at B<sigbuf>. |
34 | ||
35 | EVP_VerifyInit() initializes verification context B<ctx> to use the default | |
36 | implementation of digest B<type>. | |
f7173262 DSH |
37 | |
38 | =head1 RETURN VALUES | |
39 | ||
3811eed8 DSH |
40 | EVP_VerifyInit_ex() and EVP_VerifyUpdate() return 1 for success and 0 for |
41 | failure. | |
f7173262 DSH |
42 | |
43 | EVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some | |
44 | other error occurred. | |
45 | ||
9b86974e | 46 | The error codes can be obtained by L<ERR_get_error(3)>. |
f7173262 DSH |
47 | |
48 | =head1 NOTES | |
49 | ||
50 | The B<EVP> interface to digital signatures should almost always be used in | |
51 | preference to the low level interfaces. This is because the code then becomes | |
52 | transparent to the algorithm used and much more flexible. | |
53 | ||
54 | Due to the link between message digests and public key algorithms the correct | |
55 | digest algorithm must be used with the correct public key type. A list of | |
1bc74519 | 56 | algorithms and associated public key algorithms appears in |
9b86974e | 57 | L<EVP_DigestInit(3)>. |
f7173262 | 58 | |
3811eed8 DSH |
59 | The call to EVP_VerifyFinal() internally finalizes a copy of the digest context. |
60 | This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can be called | |
61 | later to digest and verify additional data. | |
62 | ||
63 | Since only a copy of the digest context is ever finalized the context must | |
64 | be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak | |
65 | will occur. | |
66 | ||
f7173262 DSH |
67 | =head1 BUGS |
68 | ||
1bc74519 | 69 | Older versions of this documentation wrongly stated that calls to |
3811eed8 | 70 | EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal(). |
f7173262 | 71 | |
29cf84c6 DSH |
72 | Since the public key is passed in the call to EVP_SignFinal() any error |
73 | relating to the private key (for example an unsuitable key and digest | |
74 | combination) will not be indicated until after potentially large amounts of | |
75 | data have been passed through EVP_SignUpdate(). | |
76 | ||
77 | It is not possible to change the signing parameters using these function. | |
78 | ||
79 | The previous two bugs are fixed in the newer EVP_VerifyDigest*() function. | |
80 | ||
f7173262 DSH |
81 | =head1 SEE ALSO |
82 | ||
b97fdb57 | 83 | L<evp(7)>, |
9b86974e | 84 | L<EVP_SignInit(3)>, |
73fb82b7 | 85 | L<EVP_DigestInit(3)>, |
b97fdb57 RL |
86 | L<evp(7)>, L<HMAC(3)>, L<MD2(3)>, |
87 | L<MD5(3)>, L<MDC2(3)>, L<RIPEMD160(3)>, | |
88 | L<SHA1(3)>, L<dgst(1)> | |
f7173262 | 89 | |
e2f92610 RS |
90 | =head1 COPYRIGHT |
91 | ||
73fb82b7 | 92 | Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved. |
e2f92610 RS |
93 | |
94 | Licensed under the OpenSSL license (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 | L<https://www.openssl.org/source/license.html>. | |
98 | ||
99 | =cut |