1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimOCSP_REQUEST_new, OCSP_REQUEST_free, OCSP_request_add0_id, OCSP_request_sign, 6e71b7053SJung-uk KimOCSP_request_add1_cert, OCSP_request_onereq_count, 7e71b7053SJung-uk KimOCSP_request_onereq_get0 - OCSP request functions 8e71b7053SJung-uk Kim 9e71b7053SJung-uk Kim=head1 SYNOPSIS 10e71b7053SJung-uk Kim 11e71b7053SJung-uk Kim #include <openssl/ocsp.h> 12e71b7053SJung-uk Kim 13e71b7053SJung-uk Kim OCSP_REQUEST *OCSP_REQUEST_new(void); 14e71b7053SJung-uk Kim void OCSP_REQUEST_free(OCSP_REQUEST *req); 15e71b7053SJung-uk Kim 16e71b7053SJung-uk Kim OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); 17e71b7053SJung-uk Kim 18e71b7053SJung-uk Kim int OCSP_request_sign(OCSP_REQUEST *req, 19e71b7053SJung-uk Kim X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, 20e71b7053SJung-uk Kim STACK_OF(X509) *certs, unsigned long flags); 21e71b7053SJung-uk Kim 22e71b7053SJung-uk Kim int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); 23e71b7053SJung-uk Kim 24e71b7053SJung-uk Kim int OCSP_request_onereq_count(OCSP_REQUEST *req); 25e71b7053SJung-uk Kim OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); 26e71b7053SJung-uk Kim 27e71b7053SJung-uk Kim=head1 DESCRIPTION 28e71b7053SJung-uk Kim 29e71b7053SJung-uk KimOCSP_REQUEST_new() allocates and returns an empty B<OCSP_REQUEST> structure. 30e71b7053SJung-uk Kim 31e71b7053SJung-uk KimOCSP_REQUEST_free() frees up the request structure B<req>. 32*a7148ab3SEnji CooperIf the argument is NULL, nothing is done. 33e71b7053SJung-uk Kim 34e71b7053SJung-uk KimOCSP_request_add0_id() adds certificate ID B<cid> to B<req>. It returns 35e71b7053SJung-uk Kimthe B<OCSP_ONEREQ> structure added so an application can add additional 36e71b7053SJung-uk Kimextensions to the request. The B<id> parameter B<MUST NOT> be freed up after 37e71b7053SJung-uk Kimthe operation. 38e71b7053SJung-uk Kim 39e71b7053SJung-uk KimOCSP_request_sign() signs OCSP request B<req> using certificate 40e71b7053SJung-uk KimB<signer>, private key B<key>, digest B<dgst> and additional certificates 41e71b7053SJung-uk KimB<certs>. If the B<flags> option B<OCSP_NOCERTS> is set then no certificates 42e71b7053SJung-uk Kimwill be included in the request. 43e71b7053SJung-uk Kim 44e71b7053SJung-uk KimOCSP_request_add1_cert() adds certificate B<cert> to request B<req>. The 45e71b7053SJung-uk Kimapplication is responsible for freeing up B<cert> after use. 46e71b7053SJung-uk Kim 47e71b7053SJung-uk KimOCSP_request_onereq_count() returns the total number of B<OCSP_ONEREQ> 48e71b7053SJung-uk Kimstructures in B<req>. 49e71b7053SJung-uk Kim 50e71b7053SJung-uk KimOCSP_request_onereq_get0() returns an internal pointer to the B<OCSP_ONEREQ> 51e71b7053SJung-uk Kimcontained in B<req> of index B<i>. The index value B<i> runs from 0 to 52e71b7053SJung-uk KimOCSP_request_onereq_count(req) - 1. 53e71b7053SJung-uk Kim 54e71b7053SJung-uk Kim=head1 RETURN VALUES 55e71b7053SJung-uk Kim 56e71b7053SJung-uk KimOCSP_REQUEST_new() returns an empty B<OCSP_REQUEST> structure or B<NULL> if 57e71b7053SJung-uk Kiman error occurred. 58e71b7053SJung-uk Kim 59e71b7053SJung-uk KimOCSP_request_add0_id() returns the B<OCSP_ONEREQ> structure containing B<cid> 60e71b7053SJung-uk Kimor B<NULL> if an error occurred. 61e71b7053SJung-uk Kim 62e71b7053SJung-uk KimOCSP_request_sign() and OCSP_request_add1_cert() return 1 for success and 0 63e71b7053SJung-uk Kimfor failure. 64e71b7053SJung-uk Kim 65e71b7053SJung-uk KimOCSP_request_onereq_count() returns the total number of B<OCSP_ONEREQ> 66b077aed3SPierre Proncherystructures in B<req> and -1 on error. 67e71b7053SJung-uk Kim 68e71b7053SJung-uk KimOCSP_request_onereq_get0() returns a pointer to an B<OCSP_ONEREQ> structure 69e71b7053SJung-uk Kimor B<NULL> if the index value is out or range. 70e71b7053SJung-uk Kim 71e71b7053SJung-uk Kim=head1 NOTES 72e71b7053SJung-uk Kim 73e71b7053SJung-uk KimAn OCSP request structure contains one or more B<OCSP_ONEREQ> structures 74e71b7053SJung-uk Kimcorresponding to each certificate. 75e71b7053SJung-uk Kim 76e71b7053SJung-uk KimOCSP_request_onereq_count() and OCSP_request_onereq_get0() are mainly used by 77e71b7053SJung-uk KimOCSP responders. 78e71b7053SJung-uk Kim 79da327cd2SJung-uk Kim=head1 EXAMPLES 80e71b7053SJung-uk Kim 81e71b7053SJung-uk KimCreate an B<OCSP_REQUEST> structure for certificate B<cert> with issuer 82e71b7053SJung-uk KimB<issuer>: 83e71b7053SJung-uk Kim 84e71b7053SJung-uk Kim OCSP_REQUEST *req; 85e71b7053SJung-uk Kim OCSP_ID *cid; 86e71b7053SJung-uk Kim 87e71b7053SJung-uk Kim req = OCSP_REQUEST_new(); 88e71b7053SJung-uk Kim if (req == NULL) 89e71b7053SJung-uk Kim /* error */ 90e71b7053SJung-uk Kim cid = OCSP_cert_to_id(EVP_sha1(), cert, issuer); 91e71b7053SJung-uk Kim if (cid == NULL) 92e71b7053SJung-uk Kim /* error */ 93e71b7053SJung-uk Kim 94e71b7053SJung-uk Kim if (OCSP_REQUEST_add0_id(req, cid) == NULL) 95e71b7053SJung-uk Kim /* error */ 96e71b7053SJung-uk Kim 97e71b7053SJung-uk Kim /* Do something with req, e.g. query responder */ 98e71b7053SJung-uk Kim 99e71b7053SJung-uk Kim OCSP_REQUEST_free(req); 100e71b7053SJung-uk Kim 101e71b7053SJung-uk Kim=head1 SEE ALSO 102e71b7053SJung-uk Kim 103e71b7053SJung-uk KimL<crypto(7)>, 104e71b7053SJung-uk KimL<OCSP_cert_to_id(3)>, 105e71b7053SJung-uk KimL<OCSP_request_add1_nonce(3)>, 106e71b7053SJung-uk KimL<OCSP_resp_find_status(3)>, 107e71b7053SJung-uk KimL<OCSP_response_status(3)>, 108e71b7053SJung-uk KimL<OCSP_sendreq_new(3)> 109e71b7053SJung-uk Kim 110e71b7053SJung-uk Kim=head1 COPYRIGHT 111e71b7053SJung-uk Kim 112*a7148ab3SEnji CooperCopyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. 113e71b7053SJung-uk Kim 114b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 115e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 116e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 117e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 118e71b7053SJung-uk Kim 119e71b7053SJung-uk Kim=cut 120