1OCSP_REQUEST_ADD1_NONCE(3)          OpenSSL         OCSP_REQUEST_ADD1_NONCE(3)
2
3
4

NAME

6       OCSP_request_add1_nonce, OCSP_basic_add1_nonce, OCSP_check_nonce,
7       OCSP_copy_nonce - OCSP nonce functions
8

SYNOPSIS

10        #include <openssl/ocsp.h>
11
12        int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);
13        int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len);
14        int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);
15        int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *resp);
16

DESCRIPTION

18       OCSP_request_add1_nonce() adds a nonce of value val and length len to
19       OCSP request req. If val is NULL a random nonce is used. If len is zero
20       or negative a default length will be used (currently 16 bytes).
21
22       OCSP_basic_add1_nonce() is identical to OCSP_request_add1_nonce()
23       except it adds a nonce to OCSP basic response resp.
24
25       OCSP_check_nonce() compares the nonce value in req and resp.
26
27       OCSP_copy_nonce() copies any nonce value present in req to resp.
28

RETURN VALUES

30       OCSP_request_add1_nonce() and OCSP_basic_add1_nonce() return 1 for
31       success and 0 for failure.
32
33       OCSP_copy_nonce() returns 1 if a nonce was successfully copied, 2 if no
34       nonce was present in req and 0 if an error occurred.
35
36       OCSP_check_nonce() returns the result of the nonce comparison between
37       req and resp. The return value indicates the result of the comparison.
38       If nonces are present and equal 1 is returned. If the nonces are absent
39       2 is returned. If a nonce is present in the response only 3 is
40       returned. If nonces are present and unequal 0 is returned. If the nonce
41       is present in the request only then -1 is returned.
42

NOTES

44       For most purposes the nonce value in a request is set to a random value
45       so the val parameter in OCSP_request_add1_nonce() is usually NULL.
46
47       An OCSP nonce is typically added to an OCSP request to thwart replay
48       attacks by checking the same nonce value appears in the response.
49
50       Some responders may include a nonce in all responses even if one is not
51       supplied.
52
53       Some responders cache OCSP responses and do not sign each response for
54       performance reasons. As a result they do not support nonces.
55
56       The return values of OCSP_check_nonce() can be checked to cover each
57       case.  A positive return value effectively indicates success: nonces
58       are both present and match, both absent or present in the response
59       only. A nonzero return additionally covers the case where the nonce is
60       present in the request only: this will happen if the responder doesn't
61       support nonces. A zero return value indicates present and mismatched
62       nonces: this should be treated as an error condition.
63

SEE ALSO

65       crypto(7), OCSP_cert_to_id(3), OCSP_REQUEST_new(3),
66       OCSP_resp_find_status(3), OCSP_response_status(3), OCSP_sendreq_new(3)
67
69       Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
70
71       Licensed under the OpenSSL license (the "License").  You may not use
72       this file except in compliance with the License.  You can obtain a copy
73       in the file LICENSE in the source distribution or at
74       <https://www.openssl.org/source/license.html>.
75
76
77
781.1.1q                            2023-02-06        OCSP_REQUEST_ADD1_NONCE(3)
Impressum