EVP_VerifyInit.pod 3.1 KB

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