1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos OCSP_response_status, OCSP_response_get1_basic, OCSP_response_create, 6 1.1 christos OCSP_RESPONSE_free, OCSP_RESPID_set_by_name, 7 1.1.1.3 christos OCSP_RESPID_set_by_key_ex, OCSP_RESPID_set_by_key, OCSP_RESPID_match_ex, 8 1.1.1.3 christos OCSP_RESPID_match, OCSP_basic_sign, OCSP_basic_sign_ctx 9 1.1.1.3 christos - OCSP response functions 10 1.1 christos 11 1.1 christos =head1 SYNOPSIS 12 1.1 christos 13 1.1 christos #include <openssl/ocsp.h> 14 1.1 christos 15 1.1 christos int OCSP_response_status(OCSP_RESPONSE *resp); 16 1.1 christos OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); 17 1.1 christos OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); 18 1.1 christos void OCSP_RESPONSE_free(OCSP_RESPONSE *resp); 19 1.1 christos 20 1.1 christos int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert); 21 1.1.1.3 christos int OCSP_RESPID_set_by_key_ex(OCSP_RESPID *respid, X509 *cert, 22 1.1.1.3 christos OSSL_LIB_CTX *libctx, const char *propq); 23 1.1 christos int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert); 24 1.1.1.3 christos int OCSP_RESPID_match_ex(OCSP_RESPID *respid, X509 *cert, OSSL_LIB_CTX *libctx, 25 1.1.1.3 christos const char *propq); 26 1.1 christos int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert); 27 1.1 christos 28 1.1 christos int OCSP_basic_sign(OCSP_BASICRESP *brsp, X509 *signer, EVP_PKEY *key, 29 1.1 christos const EVP_MD *dgst, STACK_OF(X509) *certs, 30 1.1 christos unsigned long flags); 31 1.1 christos int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, X509 *signer, EVP_MD_CTX *ctx, 32 1.1 christos STACK_OF(X509) *certs, unsigned long flags); 33 1.1 christos 34 1.1 christos =head1 DESCRIPTION 35 1.1 christos 36 1.1.1.3 christos OCSP_response_status() returns the OCSP response status of I<resp>. It returns 37 1.1.1.3 christos one of the values: I<OCSP_RESPONSE_STATUS_SUCCESSFUL>, 38 1.1.1.3 christos I<OCSP_RESPONSE_STATUS_MALFORMEDREQUEST>, 39 1.1.1.3 christos I<OCSP_RESPONSE_STATUS_INTERNALERROR>, I<OCSP_RESPONSE_STATUS_TRYLATER> 40 1.1.1.3 christos I<OCSP_RESPONSE_STATUS_SIGREQUIRED>, or I<OCSP_RESPONSE_STATUS_UNAUTHORIZED>. 41 1.1 christos 42 1.1.1.3 christos OCSP_response_get1_basic() decodes and returns the I<OCSP_BASICRESP> structure 43 1.1.1.3 christos contained in I<resp>. 44 1.1 christos 45 1.1.1.3 christos OCSP_response_create() creates and returns an I<OCSP_RESPONSE> structure for 46 1.1.1.3 christos I<status> and optionally including basic response I<bs>. 47 1.1 christos 48 1.1.1.3 christos OCSP_RESPONSE_free() frees up OCSP response I<resp>. 49 1.1.1.4 christos If the argument is NULL, nothing is done. 50 1.1 christos 51 1.1 christos OCSP_RESPID_set_by_name() sets the name of the OCSP_RESPID to be the same as the 52 1.1.1.3 christos subject name in the supplied X509 certificate I<cert> for the OCSP responder. 53 1.1 christos 54 1.1.1.3 christos OCSP_RESPID_set_by_key_ex() sets the key of the OCSP_RESPID to be the same as the 55 1.1.1.3 christos key in the supplied X509 certificate I<cert> for the OCSP responder. The key is 56 1.1.1.3 christos stored as a SHA1 hash. To calculate the hash the SHA1 algorithm is fetched using 57 1.1.1.3 christos the library ctx I<libctx> and the property query string I<propq> (see 58 1.1.1.3 christos L<crypto(7)/ALGORITHM FETCHING> for further information). 59 1.1.1.3 christos 60 1.1.1.3 christos OCSP_RESPID_set_by_key() does the same as OCSP_RESPID_set_by_key_ex() except 61 1.1.1.3 christos that the default library context is used with an empty property query string. 62 1.1 christos 63 1.1 christos Note that an OCSP_RESPID can only have one of the name, or the key set. Calling 64 1.1 christos OCSP_RESPID_set_by_name() or OCSP_RESPID_set_by_key() will clear any existing 65 1.1 christos setting. 66 1.1 christos 67 1.1.1.3 christos OCSP_RESPID_match_ex() tests whether the OCSP_RESPID given in I<respid> matches 68 1.1.1.3 christos with the X509 certificate I<cert> based on the SHA1 hash. To calculate the hash 69 1.1.1.3 christos the SHA1 algorithm is fetched using the library ctx I<libctx> and the property 70 1.1.1.3 christos query string I<propq> (see L<crypto(7)/ALGORITHM FETCHING> for further 71 1.1.1.3 christos information). 72 1.1.1.3 christos 73 1.1.1.3 christos OCSP_RESPID_match() does the same as OCSP_RESPID_match_ex() except that the 74 1.1.1.3 christos default library context is used with an empty property query string. 75 1.1.1.3 christos 76 1.1.1.3 christos OCSP_basic_sign() signs OCSP response I<brsp> using certificate I<signer>, private key 77 1.1.1.3 christos I<key>, digest I<dgst> and additional certificates I<certs>. If the I<flags> option 78 1.1.1.3 christos I<OCSP_NOCERTS> is set then no certificates will be included in the response. If the 79 1.1.1.3 christos I<flags> option I<OCSP_RESPID_KEY> is set then the responder is identified by key ID 80 1.1.1.3 christos rather than by name. OCSP_basic_sign_ctx() also signs OCSP response I<brsp> but 81 1.1.1.3 christos uses the parameters contained in digest context I<ctx>. 82 1.1 christos 83 1.1 christos =head1 RETURN VALUES 84 1.1 christos 85 1.1 christos OCSP_RESPONSE_status() returns a status value. 86 1.1 christos 87 1.1.1.3 christos OCSP_response_get1_basic() returns an I<OCSP_BASICRESP> structure pointer or 88 1.1.1.3 christos I<NULL> if an error occurred. 89 1.1 christos 90 1.1.1.3 christos OCSP_response_create() returns an I<OCSP_RESPONSE> structure pointer or I<NULL> 91 1.1 christos if an error occurred. 92 1.1 christos 93 1.1 christos OCSP_RESPONSE_free() does not return a value. 94 1.1 christos 95 1.1 christos OCSP_RESPID_set_by_name(), OCSP_RESPID_set_by_key(), OCSP_basic_sign(), and 96 1.1 christos OCSP_basic_sign_ctx() return 1 on success or 0 97 1.1 christos on failure. 98 1.1 christos 99 1.1 christos OCSP_RESPID_match() returns 1 if the OCSP_RESPID and the X509 certificate match 100 1.1 christos or 0 otherwise. 101 1.1 christos 102 1.1 christos =head1 NOTES 103 1.1 christos 104 1.1 christos OCSP_response_get1_basic() is only called if the status of a response is 105 1.1.1.3 christos I<OCSP_RESPONSE_STATUS_SUCCESSFUL>. 106 1.1 christos 107 1.1 christos =head1 SEE ALSO 108 1.1 christos 109 1.1 christos L<crypto(7)> 110 1.1 christos L<OCSP_cert_to_id(3)> 111 1.1 christos L<OCSP_request_add1_nonce(3)> 112 1.1 christos L<OCSP_REQUEST_new(3)> 113 1.1 christos L<OCSP_resp_find_status(3)> 114 1.1 christos L<OCSP_sendreq_new(3)> 115 1.1 christos L<OCSP_RESPID_new(3)> 116 1.1 christos L<OCSP_RESPID_free(3)> 117 1.1 christos 118 1.1 christos =head1 HISTORY 119 1.1 christos 120 1.1 christos The OCSP_RESPID_set_by_name(), OCSP_RESPID_set_by_key() and OCSP_RESPID_match() 121 1.1 christos functions were added in OpenSSL 1.1.0a. 122 1.1 christos 123 1.1 christos The OCSP_basic_sign_ctx() function was added in OpenSSL 1.1.1. 124 1.1 christos 125 1.1 christos =head1 COPYRIGHT 126 1.1 christos 127 1.1.1.4 christos Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. 128 1.1 christos 129 1.1.1.3 christos Licensed under the Apache License 2.0 (the "License"). You may not use 130 1.1 christos this file except in compliance with the License. You can obtain a copy 131 1.1 christos in the file LICENSE in the source distribution or at 132 1.1 christos L<https://www.openssl.org/source/license.html>. 133 1.1 christos 134 1.1 christos =cut 135