e81b8665d49c6f2e90ee9cd65e30f22aa4b8a4d2
[openssl.git] / doc / man3 / OCSP_response_status.pod
1 =pod
2
3 =head1 NAME
4
5 OCSP_response_status, OCSP_response_get1_basic, OCSP_response_create,
6 OCSP_RESPONSE_free, OCSP_RESPID_set_by_name,
7 OCSP_RESPID_set_by_key, OCSP_RESPID_match - OCSP response functions
8
9 =head1 SYNOPSIS
10
11  #include <openssl/ocsp.h>
12
13  int OCSP_response_status(OCSP_RESPONSE *resp);
14  OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);
15  OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);
16  void OCSP_RESPONSE_free(OCSP_RESPONSE *resp);
17
18  int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert);
19  int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert);
20  int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert);
21
22 =head1 DESCRIPTION
23
24 OCSP_response_status() returns the OCSP response status of B<resp>. It returns
25 one of the values: B<OCSP_RESPONSE_STATUS_SUCCESSFUL>,
26 B<OCSP_RESPONSE_STATUS_MALFORMEDREQUEST>,
27 B<OCSP_RESPONSE_STATUS_INTERNALERROR>, B<OCSP_RESPONSE_STATUS_TRYLATER>
28 B<OCSP_RESPONSE_STATUS_SIGREQUIRED>, or B<OCSP_RESPONSE_STATUS_UNAUTHORIZED>.
29
30 OCSP_response_get1_basic() decodes and returns the B<OCSP_BASICRESP> structure
31 contained in B<resp>.
32
33 OCSP_response_create() creates and returns an B<OCSP_RESPONSE> structure for
34 B<status> and optionally including basic response B<bs>.
35
36 OCSP_RESPONSE_free() frees up OCSP response B<resp>.
37
38 OCSP_RESPID_set_by_name() sets the name of the OCSP_RESPID to be the same as the
39 subject name in the supplied X509 certificate B<cert> for the OCSP responder.
40
41 OCSP_RESPID_set_by_key() sets the key of the OCSP_RESPID to be the same as the
42 key in the supplied X509 certificate B<cert> for the OCSP responder. The key is
43 stored as a SHA1 hash.
44
45 Note that an OCSP_RESPID can only have one of the name, or the key set. Calling
46 OCSP_RESPID_set_by_name() or OCSP_RESPID_set_by_key() will clear any existing
47 setting.
48
49 OCSP_RESPID_match() tests whether the OCSP_RESPID given in B<respid> matches
50 with the X509 certificate B<cert>.
51
52 =head1 RETURN VALUES
53
54 OCSP_RESPONSE_status() returns a status value.
55
56 OCSP_response_get1_basic() returns an B<OCSP_BASICRESP> structure pointer or
57 B<NULL> if an error occurred.
58
59 OCSP_response_create() returns an B<OCSP_RESPONSE> structure pointer or B<NULL>
60 if an error occurred.
61
62 OCSP_RESPONSE_free() does not return a value.
63
64 OCSP_RESPID_set_by_name() and OCSP_RESPID_set_by_key() return 1 on success or 0
65 on failure.
66
67 OCSP_RESPID_match() returns 1 if the OCSP_RESPID and the X509 certificate match
68 or 0 otherwise.
69
70 =head1 NOTES
71
72 OCSP_response_get1_basic() is only called if the status of a response is
73 B<OCSP_RESPONSE_STATUS_SUCCESSFUL>.
74
75 =head1 SEE ALSO
76
77 L<crypto(7)>
78 L<OCSP_cert_to_id(3)>
79 L<OCSP_request_add1_nonce(3)>
80 L<OCSP_REQUEST_new(3)>
81 L<OCSP_resp_find_status(3)>
82 L<OCSP_sendreq_new(3)>
83 L<OCSP_RESPID_new(3)>
84 L<OCSP_RESPID_free(3)>
85
86 =head1 HISTORY
87
88 The OCSP_RESPID_set_by_name(), OCSP_RESPID_set_by_key() and OCSP_RESPID_match()
89 functions were added in OpenSSL 1.1.0a.
90
91 =head1 COPYRIGHT
92
93 Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
94
95 Licensed under the OpenSSL license (the "License").  You may not use
96 this file except in compliance with the License.  You can obtain a copy
97 in the file LICENSE in the source distribution or at
98 L<https://www.openssl.org/source/license.html>.
99
100 =cut