Debian Codegraph @

upstream/debian-unstable/man3/OCSP_request_add1_nonce.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "OCSP_REQUEST_ADD1_NONCE 3SSL"
58 .TH OCSP_REQUEST_ADD1_NONCE 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 OCSP_request_add1_nonce, OCSP_basic_add1_nonce, OCSP_check_nonce, OCSP_copy_nonce \- OCSP nonce functions
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 1
68 \& #include <openssl/ocsp.h>
69 \&
70 \& int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);
71 \& int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len);
72 \& int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);
73 \& int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *resp);
74 .Ve
75 .SH DESCRIPTION
76 .IX Header "DESCRIPTION"
77 \&\fBOCSP_request_add1_nonce()\fR adds a nonce of value \fBval\fR and length \fBlen\fR to
78 OCSP request \fBreq\fR. If \fBval\fR is \fBNULL\fR a random nonce is used. If \fBlen\fR
79 is zero or negative a default length will be used (currently 16 bytes).
80 .PP
81 \&\fBOCSP_basic_add1_nonce()\fR is identical to \fBOCSP_request_add1_nonce()\fR except
82 it adds a nonce to OCSP basic response \fBresp\fR.
83 .PP
84 \&\fBOCSP_check_nonce()\fR compares the nonce value in \fBreq\fR and \fBresp\fR.
85 .PP
86 \&\fBOCSP_copy_nonce()\fR copies any nonce value present in \fBreq\fR to \fBresp\fR.
87 .SH "RETURN VALUES"
88 .IX Header "RETURN VALUES"
89 \&\fBOCSP_request_add1_nonce()\fR and \fBOCSP_basic_add1_nonce()\fR return 1 for success
90 and 0 for failure.
91 .PP
92 \&\fBOCSP_copy_nonce()\fR returns 1 if a nonce was successfully copied, 2 if no nonce
93 was present in \fBreq\fR and 0 if an error occurred.
94 .PP
95 \&\fBOCSP_check_nonce()\fR returns the result of the nonce comparison between \fBreq\fR
96 and \fBresp\fR. The return value indicates the result of the comparison. If
97 nonces are present and equal 1 is returned. If the nonces are absent 2 is
98 returned. If a nonce is present in the response only 3 is returned. If nonces
99 are present and unequal 0 is returned. If the nonce is present in the request
100 only then \-1 is returned.
101 .SH NOTES
102 .IX Header "NOTES"
103 For most purposes the nonce value in a request is set to a random value so
104 the \fBval\fR parameter in \fBOCSP_request_add1_nonce()\fR is usually NULL.
105 .PP
106 An OCSP nonce is typically added to an OCSP request to thwart replay attacks
107 by checking the same nonce value appears in the response.
108 .PP
109 Some responders may include a nonce in all responses even if one is not
110 supplied.
111 .PP
112 Some responders cache OCSP responses and do not sign each response for
113 performance reasons. As a result they do not support nonces.
114 .PP
115 The return values of \fBOCSP_check_nonce()\fR can be checked to cover each case. A
116 positive return value effectively indicates success: nonces are both present
117 and match, both absent or present in the response only. A nonzero return
118 additionally covers the case where the nonce is present in the request only:
119 this will happen if the responder doesn't support nonces. A zero return value
120 indicates present and mismatched nonces: this should be treated as an error
121 condition.
122 .SH "SEE ALSO"
123 .IX Header "SEE ALSO"
124 \&\fBcrypto\fR\|(7),
125 \&\fBOCSP_cert_to_id\fR\|(3),
126 \&\fBOCSP_REQUEST_new\fR\|(3),
127 \&\fBOCSP_resp_find_status\fR\|(3),
128 \&\fBOCSP_response_status\fR\|(3),
129 \&\fBOCSP_sendreq_new\fR\|(3)
130 .SH COPYRIGHT
131 .IX Header "COPYRIGHT"
132 Copyright 2015\-2020 The OpenSSL Project Authors. All Rights Reserved.
133 .PP
134 Licensed under the Apache License 2.0 (the "License"). You may not use
135 this file except in compliance with the License. You can obtain a copy
136 in the file LICENSE in the source distribution or at
137 <https://www.openssl.org/source/license.html>.