source: azure_iot_hub_f767zi/trunk/wolfssl-4.4.0/wolfssl/ocsp.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 5.1 KB
Line 
1/* ocsp.h
2 *
3 * Copyright (C) 2006-2020 wolfSSL Inc.
4 *
5 * This file is part of wolfSSL.
6 *
7 * wolfSSL is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * wolfSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20 */
21
22
23
24/* wolfSSL OCSP API */
25
26#ifndef WOLFSSL_OCSP_H
27#define WOLFSSL_OCSP_H
28
29#ifdef HAVE_OCSP
30
31#include <wolfssl/ssl.h>
32#include <wolfssl/wolfcrypt/asn.h>
33
34#ifdef __cplusplus
35 extern "C" {
36#endif
37
38typedef struct WOLFSSL_OCSP WOLFSSL_OCSP;
39
40#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(WOLFSSL_NGINX) ||\
41 defined(WOLFSSL_HAPROXY)
42typedef struct OcspResponse WOLFSSL_OCSP_BASICRESP;
43
44typedef struct OcspRequest WOLFSSL_OCSP_CERTID;
45
46typedef struct OcspRequest WOLFSSL_OCSP_ONEREQ;
47
48typedef struct OcspRequest WOLFSSL_OCSP_REQUEST;
49#endif
50
51WOLFSSL_LOCAL int InitOCSP(WOLFSSL_OCSP*, WOLFSSL_CERT_MANAGER*);
52WOLFSSL_LOCAL void FreeOCSP(WOLFSSL_OCSP*, int dynamic);
53
54WOLFSSL_LOCAL int CheckCertOCSP(WOLFSSL_OCSP*, DecodedCert*,
55 WOLFSSL_BUFFER_INFO* responseBuffer);
56WOLFSSL_LOCAL int CheckCertOCSP_ex(WOLFSSL_OCSP*, DecodedCert*,
57 WOLFSSL_BUFFER_INFO* responseBuffer, WOLFSSL* ssl);
58WOLFSSL_LOCAL int CheckOcspRequest(WOLFSSL_OCSP* ocsp,
59 OcspRequest* ocspRequest, WOLFSSL_BUFFER_INFO* responseBuffer);
60WOLFSSL_LOCAL int CheckOcspResponse(WOLFSSL_OCSP *ocsp, byte *response, int responseSz,
61 WOLFSSL_BUFFER_INFO *responseBuffer, CertStatus *status,
62 OcspEntry *entry, OcspRequest *ocspRequest);
63
64#if defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \
65 defined(WOLFSSL_APACHE_HTTPD)
66
67 WOLFSSL_API int wolfSSL_OCSP_resp_find_status(WOLFSSL_OCSP_BASICRESP *bs,
68 WOLFSSL_OCSP_CERTID *id, int *status, int *reason,
69 WOLFSSL_ASN1_TIME **revtime, WOLFSSL_ASN1_TIME **thisupd,
70 WOLFSSL_ASN1_TIME **nextupd);
71WOLFSSL_API const char *wolfSSL_OCSP_cert_status_str(long s);
72WOLFSSL_API int wolfSSL_OCSP_check_validity(WOLFSSL_ASN1_TIME* thisupd,
73 WOLFSSL_ASN1_TIME* nextupd, long sec, long maxsec);
74
75WOLFSSL_API void wolfSSL_OCSP_CERTID_free(WOLFSSL_OCSP_CERTID* certId);
76WOLFSSL_API WOLFSSL_OCSP_CERTID* wolfSSL_OCSP_cert_to_id(
77 const WOLFSSL_EVP_MD *dgst, const WOLFSSL_X509 *subject,
78 const WOLFSSL_X509 *issuer);
79
80WOLFSSL_API void wolfSSL_OCSP_BASICRESP_free(WOLFSSL_OCSP_BASICRESP* basicResponse);
81WOLFSSL_API int wolfSSL_OCSP_basic_verify(WOLFSSL_OCSP_BASICRESP *bs,
82 WOLF_STACK_OF(WOLFSSL_X509) *certs, WOLFSSL_X509_STORE *st, unsigned long flags);
83
84WOLFSSL_API void wolfSSL_OCSP_RESPONSE_free(OcspResponse* response);
85WOLFSSL_API OcspResponse* wolfSSL_d2i_OCSP_RESPONSE_bio(WOLFSSL_BIO* bio,
86 OcspResponse** response);
87WOLFSSL_API OcspResponse* wolfSSL_d2i_OCSP_RESPONSE(OcspResponse** response,
88 const unsigned char** data, int len);
89WOLFSSL_API int wolfSSL_i2d_OCSP_RESPONSE(OcspResponse* response,
90 unsigned char** data);
91WOLFSSL_API int wolfSSL_OCSP_response_status(OcspResponse *response);
92WOLFSSL_API const char *wolfSSL_OCSP_response_status_str(long s);
93WOLFSSL_API WOLFSSL_OCSP_BASICRESP* wolfSSL_OCSP_response_get1_basic(
94 OcspResponse* response);
95
96WOLFSSL_API OcspRequest* wolfSSL_OCSP_REQUEST_new(void);
97WOLFSSL_API void wolfSSL_OCSP_REQUEST_free(OcspRequest* request);
98WOLFSSL_API int wolfSSL_i2d_OCSP_REQUEST(OcspRequest* request,
99 unsigned char** data);
100WOLFSSL_API WOLFSSL_OCSP_ONEREQ* wolfSSL_OCSP_request_add0_id(OcspRequest *req,
101 WOLFSSL_OCSP_CERTID *cid);
102WOLFSSL_API WOLFSSL_OCSP_CERTID* wolfSSL_OCSP_CERTID_dup(WOLFSSL_OCSP_CERTID*);
103WOLFSSL_API int wolfSSL_i2d_OCSP_REQUEST_bio(WOLFSSL_BIO* out,
104 WOLFSSL_OCSP_REQUEST *req);
105
106#endif
107#ifdef OPENSSL_EXTRA
108WOLFSSL_API int wolfSSL_OCSP_REQUEST_add_ext(OcspRequest* req,
109 WOLFSSL_X509_EXTENSION* ext, int idx);
110WOLFSSL_API OcspResponse* wolfSSL_OCSP_response_create(int status,
111 WOLFSSL_OCSP_BASICRESP* bs);
112WOLFSSL_API const char* wolfSSL_OCSP_crl_reason_str(long s);
113
114WOLFSSL_API int wolfSSL_OCSP_id_get0_info(WOLFSSL_ASN1_STRING**,
115 WOLFSSL_ASN1_OBJECT**, WOLFSSL_ASN1_STRING**,
116 WOLFSSL_ASN1_INTEGER**, WOLFSSL_OCSP_CERTID*);
117
118WOLFSSL_API int wolfSSL_OCSP_request_add1_nonce(OcspRequest* req,
119 unsigned char* val, int sz);
120WOLFSSL_API int wolfSSL_OCSP_check_nonce(OcspRequest* req,
121 WOLFSSL_OCSP_BASICRESP* bs);
122#endif
123
124
125#ifdef __cplusplus
126 } /* extern "C" */
127#endif
128
129
130#endif /* HAVE_OCSP */
131#endif /* WOLFSSL_OCSP_H */
132
133
Note: See TracBrowser for help on using the repository browser.