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