OCSP_REQUEST_new.3ossl 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "OCSP_REQUEST_NEW 3ossl"
  58. .TH OCSP_REQUEST_NEW 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. OCSP_REQUEST_new, OCSP_REQUEST_free, OCSP_request_add0_id, OCSP_request_sign,
  65. OCSP_request_add1_cert, OCSP_request_onereq_count,
  66. OCSP_request_onereq_get0 \- OCSP request functions
  67. .SH SYNOPSIS
  68. .IX Header "SYNOPSIS"
  69. .Vb 1
  70. \& #include <openssl/ocsp.h>
  71. \&
  72. \& OCSP_REQUEST *OCSP_REQUEST_new(void);
  73. \& void OCSP_REQUEST_free(OCSP_REQUEST *req);
  74. \&
  75. \& OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);
  76. \&
  77. \& int OCSP_request_sign(OCSP_REQUEST *req,
  78. \& X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
  79. \& STACK_OF(X509) *certs, unsigned long flags);
  80. \&
  81. \& int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);
  82. \&
  83. \& int OCSP_request_onereq_count(OCSP_REQUEST *req);
  84. \& OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);
  85. .Ve
  86. .SH DESCRIPTION
  87. .IX Header "DESCRIPTION"
  88. \&\fBOCSP_REQUEST_new()\fR allocates and returns an empty \fBOCSP_REQUEST\fR structure.
  89. .PP
  90. \&\fBOCSP_REQUEST_free()\fR frees up the request structure \fBreq\fR.
  91. If the argument is NULL, nothing is done.
  92. .PP
  93. \&\fBOCSP_request_add0_id()\fR adds certificate ID \fBcid\fR to \fBreq\fR. It returns
  94. the \fBOCSP_ONEREQ\fR structure added so an application can add additional
  95. extensions to the request. The \fBid\fR parameter \fBMUST NOT\fR be freed up after
  96. the operation.
  97. .PP
  98. \&\fBOCSP_request_sign()\fR signs OCSP request \fBreq\fR using certificate
  99. \&\fBsigner\fR, private key \fBkey\fR, digest \fBdgst\fR and additional certificates
  100. \&\fBcerts\fR. If the \fBflags\fR option \fBOCSP_NOCERTS\fR is set then no certificates
  101. will be included in the request.
  102. .PP
  103. \&\fBOCSP_request_add1_cert()\fR adds certificate \fBcert\fR to request \fBreq\fR. The
  104. application is responsible for freeing up \fBcert\fR after use.
  105. .PP
  106. \&\fBOCSP_request_onereq_count()\fR returns the total number of \fBOCSP_ONEREQ\fR
  107. structures in \fBreq\fR.
  108. .PP
  109. \&\fBOCSP_request_onereq_get0()\fR returns an internal pointer to the \fBOCSP_ONEREQ\fR
  110. contained in \fBreq\fR of index \fBi\fR. The index value \fBi\fR runs from 0 to
  111. OCSP_request_onereq_count(req) \- 1.
  112. .SH "RETURN VALUES"
  113. .IX Header "RETURN VALUES"
  114. \&\fBOCSP_REQUEST_new()\fR returns an empty \fBOCSP_REQUEST\fR structure or \fBNULL\fR if
  115. an error occurred.
  116. .PP
  117. \&\fBOCSP_request_add0_id()\fR returns the \fBOCSP_ONEREQ\fR structure containing \fBcid\fR
  118. or \fBNULL\fR if an error occurred.
  119. .PP
  120. \&\fBOCSP_request_sign()\fR and \fBOCSP_request_add1_cert()\fR return 1 for success and 0
  121. for failure.
  122. .PP
  123. \&\fBOCSP_request_onereq_count()\fR returns the total number of \fBOCSP_ONEREQ\fR
  124. structures in \fBreq\fR and \-1 on error.
  125. .PP
  126. \&\fBOCSP_request_onereq_get0()\fR returns a pointer to an \fBOCSP_ONEREQ\fR structure
  127. or \fBNULL\fR if the index value is out or range.
  128. .SH NOTES
  129. .IX Header "NOTES"
  130. An OCSP request structure contains one or more \fBOCSP_ONEREQ\fR structures
  131. corresponding to each certificate.
  132. .PP
  133. \&\fBOCSP_request_onereq_count()\fR and \fBOCSP_request_onereq_get0()\fR are mainly used by
  134. OCSP responders.
  135. .SH EXAMPLES
  136. .IX Header "EXAMPLES"
  137. Create an \fBOCSP_REQUEST\fR structure for certificate \fBcert\fR with issuer
  138. \&\fBissuer\fR:
  139. .PP
  140. .Vb 2
  141. \& OCSP_REQUEST *req;
  142. \& OCSP_ID *cid;
  143. \&
  144. \& req = OCSP_REQUEST_new();
  145. \& if (req == NULL)
  146. \& /* error */
  147. \& cid = OCSP_cert_to_id(EVP_sha1(), cert, issuer);
  148. \& if (cid == NULL)
  149. \& /* error */
  150. \&
  151. \& if (OCSP_REQUEST_add0_id(req, cid) == NULL)
  152. \& /* error */
  153. \&
  154. \& /* Do something with req, e.g. query responder */
  155. \&
  156. \& OCSP_REQUEST_free(req);
  157. .Ve
  158. .SH "SEE ALSO"
  159. .IX Header "SEE ALSO"
  160. \&\fBcrypto\fR\|(7),
  161. \&\fBOCSP_cert_to_id\fR\|(3),
  162. \&\fBOCSP_request_add1_nonce\fR\|(3),
  163. \&\fBOCSP_resp_find_status\fR\|(3),
  164. \&\fBOCSP_response_status\fR\|(3),
  165. \&\fBOCSP_sendreq_new\fR\|(3)
  166. .SH COPYRIGHT
  167. .IX Header "COPYRIGHT"
  168. Copyright 2015\-2024 The OpenSSL Project Authors. All Rights Reserved.
  169. .PP
  170. Licensed under the Apache License 2.0 (the "License"). You may not use
  171. this file except in compliance with the License. You can obtain a copy
  172. in the file LICENSE in the source distribution or at
  173. <https://www.openssl.org/source/license.html>.