OCSP_sendreq_new.pod 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. =pod
  2. =head1 NAME
  3. OCSP_sendreq_new,
  4. OCSP_sendreq_nbio,
  5. OCSP_sendreq_bio,
  6. OCSP_REQ_CTX_i2d,
  7. OCSP_REQ_CTX_add1_header,
  8. OCSP_REQ_CTX_free,
  9. OCSP_set_max_response_length,
  10. OCSP_REQ_CTX_set1_req
  11. - OCSP responder query functions
  12. =head1 SYNOPSIS
  13. #include <openssl/ocsp.h>
  14. OSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path,
  15. const OCSP_REQUEST *req, int maxline);
  16. int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OSSL_HTTP_REQ_CTX *rctx);
  17. OCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req);
  18. Deprecated since OpenSSL 3.0, can be hidden entirely by defining
  19. B<OPENSSL_API_COMPAT> with a suitable version value, see
  20. L<openssl_user_macros(7)>:
  21. int OCSP_REQ_CTX_i2d(OCSP_REQ_CT *rctx, const ASN1_ITEM *it, ASN1_VALUE *req);
  22. int OCSP_REQ_CTX_add1_header(OCSP_REQ_CT *rctx,
  23. const char *name, const char *value);
  24. void OCSP_REQ_CTX_free(OSSL_HTTP_REQ_CTX *rctx);
  25. void OCSP_set_max_response_length(OCSP_REQ_CT *rctx,
  26. unsigned long len);
  27. int OCSP_REQ_CTX_set1_req(OSSL_HTTP_REQ_CTX *rctx, const OCSP_REQUEST *req);
  28. =head1 DESCRIPTION
  29. These functions perform an OCSP POST request / response transfer over HTTP,
  30. using the HTTP request functions described in L<OSSL_HTTP_REQ_CTX(3)>.
  31. The function OCSP_sendreq_new() builds a complete B<OSSL_HTTP_REQ_CTX>
  32. structure using connection B<BIO> I<io>, the URL path I<path>, the OCSP
  33. request I<req>, and with a response header maximum line length of I<maxline>.
  34. If I<maxline> is zero a default value of 4k is used.
  35. The I<req> may be set to NULL and provided later using OCSP_REQ_CTX_set1_req()
  36. or L<OSSL_HTTP_REQ_CTX_i2d(3)> .
  37. The I<io> and I<path> arguments to OCSP_sendreq_new() correspond to the
  38. components of the URL.
  39. For example if the responder URL is C<http://example.com/ocspreq> the BIO
  40. I<io> should be connected to host C<example.com> on port 80 and I<path>
  41. should be set to C</ocspreq>.
  42. OCSP_sendreq_nbio() performs I/O on the OCSP request context I<rctx>.
  43. When the operation is complete it assigns the response, a pointer to a
  44. B<OCSP_RESPONSE> structure, in I<*presp>.
  45. OCSP_sendreq_bio() is the same as a call to OCSP_sendreq_new() followed by
  46. OCSP_sendreq_nbio() and then OCSP_REQ_CTX_free() in a single call, with a
  47. response header maximum line length 4k. It waits indefinitely on a response.
  48. It does not support setting a timeout or adding headers and is retained
  49. for compatibility; use OCSP_sendreq_nbio() instead.
  50. OCSP_REQ_CTX_i2d(rctx, it, req) is equivalent to the following:
  51. OSSL_HTTP_REQ_CTX_i2d(rctx, "application/ocsp-request", it, req)
  52. OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following:
  53. OSSL_HTTP_REQ_CTX_i2d(rctx, "application/ocsp-request",
  54. ASN1_ITEM_rptr(OCSP_REQUEST), (ASN1_VALUE *)req)
  55. The other deprecated type and functions have been superseded by the
  56. following equivalents:
  57. B<OCSP_REQ_CTX> by L<OSSL_HTTP_REQ_CTX(3)>,
  58. OCSP_REQ_CTX_add1_header() by L<OSSL_HTTP_REQ_CTX_add1_header(3)>,
  59. OCSP_REQ_CTX_free() by L<OSSL_HTTP_REQ_CTX_free(3)>, and
  60. OCSP_set_max_response_length() by
  61. L<OSSL_HTTP_REQ_CTX_set_max_response_length(3)>.
  62. =head1 RETURN VALUES
  63. OCSP_sendreq_new() returns a valid B<OSSL_HTTP_REQ_CTX> structure or NULL
  64. if an error occurred.
  65. OCSP_sendreq_nbio(), OCSP_REQ_CTX_i2d(), and OCSP_REQ_CTX_set1_req()
  66. return 1 for success and 0 for failure.
  67. OCSP_sendreq_bio() returns the B<OCSP_RESPONSE> structure sent by the
  68. responder or NULL if an error occurred.
  69. =head1 SEE ALSO
  70. L<OSSL_HTTP_REQ_CTX(3)>
  71. L<OCSP_cert_to_id(3)>,
  72. L<OCSP_request_add1_nonce(3)>,
  73. L<OCSP_REQUEST_new(3)>,
  74. L<OCSP_resp_find_status(3)>,
  75. L<OCSP_response_status(3)>
  76. =head1 HISTORY
  77. B<OCSP_REQ_CTX>,
  78. OCSP_REQ_CTX_i2d(),
  79. OCSP_REQ_CTX_add1_header(),
  80. OCSP_REQ_CTX_free(),
  81. OCSP_set_max_response_length(),
  82. and OCSP_REQ_CTX_set1_req()
  83. were deprecated in OpenSSL 3.0.
  84. =head1 COPYRIGHT
  85. Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
  86. Licensed under the Apache License 2.0 (the "License"). You may not use
  87. this file except in compliance with the License. You can obtain a copy
  88. in the file LICENSE in the source distribution or at
  89. L<https://www.openssl.org/source/license.html>.
  90. =cut