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