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