OCSP_REQUEST_new.pod 3.4 KB

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