Fix L<> content in manpages
[openssl.git] / doc / crypto / OCSP_response_find_status.pod
1 =pod
2
3 OCSP_resp_find_status, OCSP_resp_count, OCSP_resp_get0, OCSP_resp_find, OCSP_single_get0_status, OCSP_check_validity - OCSP reponse utility functions.
4
5 =head1 SYNOPSIS
6
7  #include <openssl/ocsp.h>
8
9  int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
10                            int *reason,
11                            ASN1_GENERALIZEDTIME **revtime,
12                            ASN1_GENERALIZEDTIME **thisupd,
13                            ASN1_GENERALIZEDTIME **nextupd);
14
15  int OCSP_resp_count(OCSP_BASICRESP *bs);
16  OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
17  int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);
18  int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,
19                              ASN1_GENERALIZEDTIME **revtime,
20                              ASN1_GENERALIZEDTIME **thisupd,
21                              ASN1_GENERALIZEDTIME **nextupd);
22
23  int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,
24                          ASN1_GENERALIZEDTIME *nextupd,
25                          long sec, long maxsec);
26
27 =head1 DESCRIPTION
28
29 OCSP_resp_find_status() searches B<bs> for an OCSP response for B<id>. If it is
30 successful the fields of the response are returned in B<*status>, B<*reason>,
31 B<*revtime>, B<*thisupd> and B<*nextupd>.  The B<*status> value will be one of
32 B<V_OCSP_CERTSTATUS_GOOD>, B<V_OCSP_CERTSTATUS_REVOKED> or
33 B<V_OCSP_CERTSTATUS_UNKNOWN>. The B<*reason> and B<*revtime> fields are only
34 set if the status is B<V_OCSP_CERTSTATUS_REVOKED>. If set the B<*reason> field
35 will be set to the revocation reason which will be one of
36 B<OCSP_REVOKED_STATUS_NOSTATUS>, B<OCSP_REVOKED_STATUS_UNSPECIFIED>,
37 B<OCSP_REVOKED_STATUS_KEYCOMPROMISE>, B<OCSP_REVOKED_STATUS_CACOMPROMISE>,
38 B<OCSP_REVOKED_STATUS_AFFILIATIONCHANGED>, B<OCSP_REVOKED_STATUS_SUPERSEDED>,
39 B<OCSP_REVOKED_STATUS_CESSATIONOFOPERATION>,
40 B<OCSP_REVOKED_STATUS_CERTIFICATEHOLD> or B<OCSP_REVOKED_STATUS_REMOVEFROMCRL>.
41
42 OCSP_resp_count() returns the number of B<OCSP_SINGLERESP> structures in B<bs>.
43
44 OCSP_resp_get0() returns the B<OCSP_SINGLERESP> structure in B<bs>
45 corresponding to index B<idx>. Where B<idx> runs from 0 to
46 OCSP_resp_count(bs) - 1.
47
48 OCSP_resp_find() searches B<bs> for B<id> and returns the index of the first
49 matching entry after B<last> or starting from the beginning if B<last> is -1.
50
51 OCSP_single_get0_status() extracts the fields of B<single> in B<*reason>,
52 B<*revtime>, B<*thisupd> and B<*nextupd>.
53
54 OCSP_check_validity() checks the validity of B<thisupd> and B<nextupd> values
55 which will be typically obtained from OCSP_resp_find_status() or
56 OCSP_single_get0_status(). If B<sec> is non-zero it indicates how many seconds
57 leeway should be allowed in the check. If B<maxsec> is positive it indicates
58 the maximum age of B<thisupd> in seconds.
59
60 =head1 RETURN VALUES
61
62 OCSP_resp_find_status() returns 1 if B<id> is found in B<bs> and 0 otherwise.
63
64 OCSP_resp_count() returns the total number of B<OCSP_SINGLERESP> fields in
65 B<bs>.
66
67 OCSP_resp_get0() returns a pointer to an B<OCSP_SINGLERESP> structure or
68 B<NULL> if B<idx> is out of range.
69
70 OCSP_resp_find() returns the index of B<id> in B<bs> (which may be 0) or -1 if
71 B<id> was not found.
72
73 OCSP_single_get0_status() returns the status of B<single> or -1 if an error
74 occurred.
75
76 =head1 NOTES
77
78 Applications will typically call OCSP_resp_find_status() using the certificate
79 ID of interest and then check its validity using OCSP_check_validity(). They
80 can then take appropriate action based on the status of the certificate.
81
82 An OCSP response for a certificate contains B<thisUpdate> and B<nextUpdate>
83 fields. Normally the current time should be between these two values. To
84 account for clock skew the B<maxsec> field can be set to non-zero in
85 OCSP_check_validity(). Some responders do not set the B<nextUpdate> field, this
86 would otherwise mean an ancient response would be considered valid: the
87 B<maxsec> parameter to OCSP_check_validity() can be used to limit the permitted
88 age of responses.
89
90 The values written to B<*revtime>, B<*thisupd> and B<*nextupd> by
91 OCSP_resp_find_status() and OCSP_single_get0_status() are internal pointers
92 which B<MUST NOT> be freed up by the calling application. Any or all of these
93 parameters can be set to NULL if their value is not required.
94
95 =head1 SEE ALSO
96
97 L<crypto(3)>,
98 L<OCSP_cert_to_id(3)>,
99 L<OCSP_request_add1_nonce(3)>,
100 L<OCSP_REQUEST_new(3)>,
101 L<OCSP_response_status(3)>,
102 L<OCSP_sendreq_new(3)>
103
104 =cut