EVP_VerifyInit.pod 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. =pod
  2. =head1 NAME
  3. EVP_VerifyInit_ex,
  4. EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal
  5. - EVP signature verification functions
  6. =head1 SYNOPSIS
  7. #include <openssl/evp.h>
  8. int EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
  9. int EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
  10. int EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf, unsigned int siglen, EVP_PKEY *pkey);
  11. int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type);
  12. =head1 DESCRIPTION
  13. The EVP signature verification routines are a high level interface to digital
  14. signatures.
  15. EVP_VerifyInit_ex() sets up verification context B<ctx> to use digest
  16. B<type> from ENGINE B<impl>. B<ctx> must be created by calling
  17. EVP_MD_CTX_new() before calling this function.
  18. EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the
  19. verification context B<ctx>. This function can be called several times on the
  20. same B<ctx> to include additional data.
  21. EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey>
  22. and against the B<siglen> bytes at B<sigbuf>.
  23. EVP_VerifyInit() initializes verification context B<ctx> to use the default
  24. implementation of digest B<type>.
  25. =head1 RETURN VALUES
  26. EVP_VerifyInit_ex() and EVP_VerifyUpdate() return 1 for success and 0 for
  27. failure.
  28. EVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some
  29. other error occurred.
  30. The error codes can be obtained by L<ERR_get_error(3)>.
  31. =head1 NOTES
  32. The B<EVP> interface to digital signatures should almost always be used in
  33. preference to the low level interfaces. This is because the code then becomes
  34. transparent to the algorithm used and much more flexible.
  35. The call to EVP_VerifyFinal() internally finalizes a copy of the digest context.
  36. This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can be called
  37. later to digest and verify additional data.
  38. Since only a copy of the digest context is ever finalized the context must
  39. be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak
  40. will occur.
  41. =head1 BUGS
  42. Older versions of this documentation wrongly stated that calls to
  43. EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal().
  44. Since the public key is passed in the call to EVP_SignFinal() any error
  45. relating to the private key (for example an unsuitable key and digest
  46. combination) will not be indicated until after potentially large amounts of
  47. data have been passed through EVP_SignUpdate().
  48. It is not possible to change the signing parameters using these function.
  49. The previous two bugs are fixed in the newer EVP_VerifyDigest*() function.
  50. =head1 SEE ALSO
  51. L<evp(7)>,
  52. L<EVP_SignInit(3)>,
  53. L<EVP_DigestInit(3)>,
  54. L<evp(7)>, L<HMAC(3)>, L<MD2(3)>,
  55. L<MD5(3)>, L<MDC2(3)>, L<RIPEMD160(3)>,
  56. L<SHA1(3)>, L<dgst(1)>
  57. =head1 COPYRIGHT
  58. Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
  59. Licensed under the OpenSSL license (the "License"). You may not use
  60. this file except in compliance with the License. You can obtain a copy
  61. in the file LICENSE in the source distribution or at
  62. L<https://www.openssl.org/source/license.html>.
  63. =cut