OCSP_REQUEST_new.pod 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. =pod
  2. =head1 NAME
  3. OCSP_REQUEST_new, OCSP_REQUEST_free, OCSP_request_add0_id, OCSP_request_sign,
  4. OCSP_request_add1_cert, OCSP_request_onereq_count,
  5. OCSP_request_onereq_get0 - OCSP request functions
  6. =head1 SYNOPSIS
  7. #include <openssl/ocsp.h>
  8. OCSP_REQUEST *OCSP_REQUEST_new(void);
  9. void OCSP_REQUEST_free(OCSP_REQUEST *req);
  10. OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);
  11. int OCSP_request_sign(OCSP_REQUEST *req,
  12. X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
  13. STACK_OF(X509) *certs, unsigned long flags);
  14. int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);
  15. int OCSP_request_onereq_count(OCSP_REQUEST *req);
  16. OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);
  17. =head1 DESCRIPTION
  18. OCSP_REQUEST_new() allocates and returns an empty B<OCSP_REQUEST> structure.
  19. OCSP_REQUEST_free() frees up the request structure B<req>.
  20. If the argument is NULL, nothing is done.
  21. OCSP_request_add0_id() adds certificate ID B<cid> to B<req>. It returns
  22. the B<OCSP_ONEREQ> structure added so an application can add additional
  23. extensions to the request. The B<id> parameter B<MUST NOT> be freed up after
  24. the operation.
  25. OCSP_request_sign() signs OCSP request B<req> using certificate
  26. B<signer>, private key B<key>, digest B<dgst> and additional certificates
  27. B<certs>. If the B<flags> option B<OCSP_NOCERTS> is set then no certificates
  28. will be included in the request.
  29. OCSP_request_add1_cert() adds certificate B<cert> to request B<req>. The
  30. application is responsible for freeing up B<cert> after use.
  31. OCSP_request_onereq_count() returns the total number of B<OCSP_ONEREQ>
  32. structures in B<req>.
  33. OCSP_request_onereq_get0() returns an internal pointer to the B<OCSP_ONEREQ>
  34. contained in B<req> of index B<i>. The index value B<i> runs from 0 to
  35. OCSP_request_onereq_count(req) - 1.
  36. =head1 RETURN VALUES
  37. OCSP_REQUEST_new() returns an empty B<OCSP_REQUEST> structure or B<NULL> if
  38. an error occurred.
  39. OCSP_request_add0_id() returns the B<OCSP_ONEREQ> structure containing B<cid>
  40. or B<NULL> if an error occurred.
  41. OCSP_request_sign() and OCSP_request_add1_cert() return 1 for success and 0
  42. for failure.
  43. OCSP_request_onereq_count() returns the total number of B<OCSP_ONEREQ>
  44. structures in B<req> and -1 on error.
  45. OCSP_request_onereq_get0() returns a pointer to an B<OCSP_ONEREQ> structure
  46. or B<NULL> if the index value is out or range.
  47. =head1 NOTES
  48. An OCSP request structure contains one or more B<OCSP_ONEREQ> structures
  49. corresponding to each certificate.
  50. OCSP_request_onereq_count() and OCSP_request_onereq_get0() are mainly used by
  51. OCSP responders.
  52. =head1 EXAMPLES
  53. Create an B<OCSP_REQUEST> structure for certificate B<cert> with issuer
  54. B<issuer>:
  55. OCSP_REQUEST *req;
  56. OCSP_ID *cid;
  57. req = OCSP_REQUEST_new();
  58. if (req == NULL)
  59. /* error */
  60. cid = OCSP_cert_to_id(EVP_sha1(), cert, issuer);
  61. if (cid == NULL)
  62. /* error */
  63. if (OCSP_REQUEST_add0_id(req, cid) == NULL)
  64. /* error */
  65. /* Do something with req, e.g. query responder */
  66. OCSP_REQUEST_free(req);
  67. =head1 SEE ALSO
  68. L<crypto(7)>,
  69. L<OCSP_cert_to_id(3)>,
  70. L<OCSP_request_add1_nonce(3)>,
  71. L<OCSP_resp_find_status(3)>,
  72. L<OCSP_response_status(3)>,
  73. L<OCSP_sendreq_new(3)>
  74. =head1 COPYRIGHT
  75. Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved.
  76. Licensed under the Apache License 2.0 (the "License"). You may not use
  77. this file except in compliance with the License. You can obtain a copy
  78. in the file LICENSE in the source distribution or at
  79. L<https://www.openssl.org/source/license.html>.
  80. =cut