2 /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
6 This file was transfered to Richard Levitte from CertCo by Kathy
7 Weinhold in mid-spring 2000 to be included in OpenSSL or released
10 /* ====================================================================
11 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in
22 * the documentation and/or other materials provided with the
25 * 3. All advertising materials mentioning features or use of this
26 * software must display the following acknowledgment:
27 * "This product includes software developed by the OpenSSL Project
28 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
30 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
31 * endorse or promote products derived from this software without
32 * prior written permission. For written permission, please contact
33 * openssl-core@openssl.org.
35 * 5. Products derived from this software may not be called "OpenSSL"
36 * nor may "OpenSSL" appear in their names without prior written
37 * permission of the OpenSSL Project.
39 * 6. Redistributions of any form whatsoever must retain the following
41 * "This product includes software developed by the OpenSSL Project
42 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
44 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
45 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
47 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
48 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
55 * OF THE POSSIBILITY OF SUCH DAMAGE.
56 * ====================================================================
58 * This product includes cryptographic software written by Eric Young
59 * (eay@cryptsoft.com). This product includes software written by Tim
60 * Hudson (tjh@cryptsoft.com).
67 #include <openssl/x509.h>
68 #include <openssl/x509v3.h>
69 #include <openssl/safestack.h>
75 /* CertID ::= SEQUENCE {
76 * hashAlgorithm AlgorithmIdentifier,
77 * issuerNameHash OCTET STRING, -- Hash of Issuer's DN
78 * issuerKeyHash OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields)
79 * serialNumber CertificateSerialNumber }
81 typedef struct ocsp_cert_id_st
83 X509_ALGOR *hashAlgorithm;
84 ASN1_OCTET_STRING *issuerNameHash;
85 ASN1_OCTET_STRING *issuerKeyHash;
86 ASN1_INTEGER *serialNumber;
89 /* Request ::= SEQUENCE {
91 * singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
93 typedef struct ocsp_one_request_st
96 STACK_OF(X509_EXTENSION) *singleRequestExtensions;
99 DECLARE_STACK_OF(OCSP_ONEREQ)
100 DECLARE_ASN1_SET_OF(OCSP_ONEREQ)
103 /* TBSRequest ::= SEQUENCE {
104 * version [0] EXPLICIT Version DEFAULT v1,
105 * requestorName [1] EXPLICIT GeneralName OPTIONAL,
106 * requestList SEQUENCE OF Request,
107 * requestExtensions [2] EXPLICIT Extensions OPTIONAL }
109 typedef struct ocsp_req_info_st
111 ASN1_INTEGER *version;
112 GENERAL_NAME *requestorName;
113 STACK_OF(OCSP_ONEREQ) *requestList;
114 STACK_OF(X509_EXTENSION) *requestExtensions;
117 /* Signature ::= SEQUENCE {
118 * signatureAlgorithm AlgorithmIdentifier,
119 * signature BIT STRING,
120 * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
122 typedef struct ocsp_signature_st
124 X509_ALGOR *signatureAlgorithm;
125 ASN1_BIT_STRING *signature;
126 STACK_OF(X509) *certs;
129 /* OCSPRequest ::= SEQUENCE {
130 * tbsRequest TBSRequest,
131 * optionalSignature [0] EXPLICIT Signature OPTIONAL }
133 typedef struct ocsp_request_st
135 OCSP_REQINFO *tbsRequest;
136 OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */
139 /* OCSPResponseStatus ::= ENUMERATED {
140 * successful (0), --Response has valid confirmations
141 * malformedRequest (1), --Illegal confirmation request
142 * internalError (2), --Internal error in issuer
143 * tryLater (3), --Try again later
145 * sigRequired (5), --Must sign the request
146 * unauthorized (6) --Request unauthorized
149 #define OCSP_RESPONSE_STATUS_SUCCESSFULL 0
150 #define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1
151 #define OCSP_RESPONSE_STATUS_INTERNALERROR 2
152 #define OCSP_RESPONSE_STATUS_TRYLATER 3
153 #define OCSP_RESPONSE_STATUS_SIGREQUIRED 5
154 #define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6
156 /* ResponseBytes ::= SEQUENCE {
157 * responseType OBJECT IDENTIFIER,
158 * response OCTET STRING }
160 typedef struct ocsp_resp_bytes_st
162 ASN1_OBJECT *responseType;
163 ASN1_OCTET_STRING *response;
166 /* OCSPResponse ::= SEQUENCE {
167 * responseStatus OCSPResponseStatus,
168 * responseBytes [0] EXPLICIT ResponseBytes OPTIONAL }
170 typedef struct ocsp_response_st
172 ASN1_ENUMERATED *responseStatus;
173 OCSP_RESPBYTES *responseBytes;
176 /* ResponderID ::= CHOICE {
178 * byKey [2] KeyHash }
180 #define V_OCSP_RESPID_NAME 1
181 #define V_OCSP_RESPID_KEY 2
182 typedef struct ocsp_responder_id_st
187 ASN1_OCTET_STRING *byKey;
190 /* KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key
191 * --(excluding the tag and length fields)
194 /* RevokedInfo ::= SEQUENCE {
195 * revocationTime GeneralizedTime,
196 * revocationReason [0] EXPLICIT CRLReason OPTIONAL }
198 typedef struct ocsp_revoked_info_st
200 ASN1_GENERALIZEDTIME *revocationTime;
201 ASN1_ENUMERATED *revocationReason;
204 /* CertStatus ::= CHOICE {
205 * good [0] IMPLICIT NULL,
206 * revoked [1] IMPLICIT RevokedInfo,
207 * unknown [2] IMPLICIT UnknownInfo }
209 #define V_OCSP_CERTSTATUS_GOOD 0
210 #define V_OCSP_CERTSTATUS_REVOKED 1
211 #define V_OCSP_CERTSTATUS_UNKNOWN 2
212 typedef struct ocsp_cert_status_st
215 /* good [0] IMPLICIT NULL */
216 OCSP_REVOKEDINFO *revoked;
217 /* unknown [2] OCSP_UNKNOWNINFO *unknown, which is NULL */
220 /* SingleResponse ::= SEQUENCE {
222 * certStatus CertStatus,
223 * thisUpdate GeneralizedTime,
224 * nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL,
225 * singleExtensions [1] EXPLICIT Extensions OPTIONAL }
227 typedef struct ocsp_single_response_st
230 OCSP_CERTSTATUS *certStatus;
231 ASN1_GENERALIZEDTIME *thisUpdate;
232 ASN1_GENERALIZEDTIME *nextUpdate;
233 STACK_OF(X509_EXTENSION) *singleExtensions;
236 DECLARE_STACK_OF(OCSP_SINGLERESP)
237 DECLARE_ASN1_SET_OF(OCSP_SINGLERESP)
239 /* ResponseData ::= SEQUENCE {
240 * version [0] EXPLICIT Version DEFAULT v1,
241 * responderID ResponderID,
242 * producedAt GeneralizedTime,
243 * responses SEQUENCE OF SingleResponse,
244 * responseExtensions [1] EXPLICIT Extensions OPTIONAL }
246 typedef struct ocsp_response_data_st
248 ASN1_INTEGER *version;
249 OCSP_RESPID *responderId;
250 ASN1_GENERALIZEDTIME *producedAt;
251 STACK_OF(OCSP_SINGLERESP) *responses;
252 STACK_OF(X509_EXTENSION) *responseExtensions;
255 /* BasicOCSPResponse ::= SEQUENCE {
256 * tbsResponseData ResponseData,
257 * signatureAlgorithm AlgorithmIdentifier,
258 * signature BIT STRING,
259 * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
262 The value for "signature" is specified in the OCSP rfc2560 as follows:
263 "The value for the signature SHALL be computed on the hash of the DER
264 encoding ResponseData." This means that you must hash the DER-encoded
265 tbsResponseData, and then run it through a crypto-signing function, which
266 will (at least w/RSA) do a hash-'n'-private-encrypt operation. This seems
267 a bit odd, but that's the spec. Also note that the data structures do not
268 leave anywhere to independently specify the algorithm used for the initial
269 hash. So, we look at the signature-specification algorithm, and try to do
270 something intelligent. -- Kathy Weinhold, CertCo */
272 It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open
273 for interpretation. I've done tests against another responder, and found
274 that it doesn't do the double hashing that the RFC seems to say one
275 should. Therefore, all relevant functions take a flag saying which
276 variant should be used. -- Richard Levitte, OpenSSL team and CeloCom */
277 typedef struct ocsp_basic_response_st
279 OCSP_RESPDATA *tbsResponseData;
280 X509_ALGOR *signatureAlgorithm;
281 ASN1_BIT_STRING *signature;
282 STACK_OF(X509) *certs;
286 * CRLReason ::= ENUMERATED {
290 * affiliationChanged (3),
292 * cessationOfOperation (5),
293 * certificateHold (6),
294 * removeFromCRL (8) }
296 #define OCSP_REVOKED_STATUS_NOSTATUS -1
297 #define OCSP_REVOKED_STATUS_UNSPECIFIED 0
298 #define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1
299 #define OCSP_REVOKED_STATUS_CACOMPROMISE 2
300 #define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3
301 #define OCSP_REVOKED_STATUS_SUPERSEDED 4
302 #define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5
303 #define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6
304 #define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8
306 /* CrlID ::= SEQUENCE {
307 * crlUrl [0] EXPLICIT IA5String OPTIONAL,
308 * crlNum [1] EXPLICIT INTEGER OPTIONAL,
309 * crlTime [2] EXPLICIT GeneralizedTime OPTIONAL }
311 typedef struct ocsp_crl_id_st
313 ASN1_IA5STRING *crlUrl;
314 ASN1_INTEGER *crlNum;
315 ASN1_GENERALIZEDTIME *crlTime;
318 /* ServiceLocator ::= SEQUENCE {
320 * locator AuthorityInfoAccessSyntax OPTIONAL }
322 typedef struct ocsp_service_locator_st
325 STACK_OF(ACCESS_DESCRIPTION) *locator;
328 #define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
329 #define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
331 #define d2i_OCSP_REQUEST_bio(bp,p) (OCSP_REQUEST*)ASN1_d2i_bio((char*(*)()) \
332 OCSP_REQUEST_new,(char *(*)())d2i_OCSP_REQUEST, (bp),\
333 (unsigned char **)(p))
335 #define d2i_OCSP_RESPONSE_bio(bp,p) (OCSP_RESPONSE*)ASN1_d2i_bio((char*(*)())\
336 OCSP_REQUEST_new,(char *(*)())d2i_OCSP_RESPONSE, (bp),\
337 (unsigned char **)(p))
339 #define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
340 (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
342 #define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\
343 (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)
345 #define PEM_write_bio_OCSP_REQUEST(bp,o) \
346 PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\
347 bp,(char *)o, NULL,NULL,0,NULL,NULL)
349 #define PEM_write_bio_OCSP_RESPONSE(bp,o) \
350 PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
351 bp,(char *)o, NULL,NULL,0,NULL,NULL)
353 #define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_RESPONSE,bp,\
356 #define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_REQUEST,bp,\
359 #define OCSP_REQUEST_sign(o,pkey,md) \
360 ASN1_sign((int(*)())i2d_OCSP_REQINFO,\
361 o->optionalSignature->signatureAlgorithm,NULL,\
362 o->optionalSignature->signature,(char *)o->tbsRequest,pkey,md)
364 #define OCSP_BASICRESP_sign(o,pkey,md,d) \
365 ASN1_sign((int(*)())i2d_OCSP_RESPDATA,o->signatureAlgorithm,NULL,\
366 o->signature,(char *)o->tbsResponseData,pkey,md)
368 #define OCSP_REQUEST_verify(a,r) ASN1_verify((int (*)())i2d_OCSP_REQINFO,\
369 a->optionalSignature->signatureAlgorithm,\
370 a->optionalSignature->signature,(char *)a->tbsRequest,r)
372 #define OCSP_BASICRESP_verify(a,r,d) ASN1_verify((int (*)())i2d_OCSP_RESPDATA,\
373 a->signatureAlgorithm,a->signature,(char *)a->tbsResponseData,r)
375 #define ASN1_BIT_STRING_digest(data,type,md,len) \
376 ASN1_digest((int (*)())i2d_ASN1_BIT_STRING,type,(char *)data,md,len)
378 #define OCSP_CERTID_dup(cid) (OCSP_CERTID*)ASN1_dup((int(*)())i2d_OCSP_CERTID,\
379 (char *(*)())d2i_OCSP_CERTID,(char *)(cid))
381 #define OCSP_CERTSTATUS_dup(cs)\
382 (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
383 (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
385 OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,
386 X509_NAME *issuerName,
387 ASN1_BIT_STRING* issuerKey,
388 ASN1_INTEGER *serialNumber);
390 OCSP_CERTSTATUS *OCSP_cert_status_new(int status, int reason, char *tim);
392 OCSP_REQUEST *OCSP_request_new(X509_NAME* name,
393 STACK_OF(X509_EXTENSION) *extensions);
395 int OCSP_request_add(OCSP_REQUEST *req,
397 STACK_OF(X509_EXTENSION) *extensions);
399 int OCSP_request_sign(OCSP_REQUEST *req,
402 STACK_OF(X509) *certs);
404 int OCSP_request_verify(OCSP_REQUEST *req, EVP_PKEY *pkey);
406 OCSP_BASICRESP *OCSP_basic_response_new(int tag,
408 STACK_OF(X509_EXTENSION) *extensions);
410 int OCSP_basic_response_add(OCSP_BASICRESP *rsp,
412 OCSP_CERTSTATUS *cst,
415 STACK_OF(X509_EXTENSION) *extensions);
417 int OCSP_basic_response_sign(OCSP_BASICRESP *brsp,
420 STACK_OF(X509) *certs);
422 int OCSP_response_verify(OCSP_RESPONSE *rsp, EVP_PKEY *pkey);
424 int OCSP_basic_response_verify(OCSP_BASICRESP *rsp, EVP_PKEY *pkey);
427 OCSP_RESPONSE *OCSP_response_new(int status,
432 ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(),
433 char *data, STACK_OF(ASN1_OBJECT) *sk);
435 X509_EXTENSION *OCSP_nonce_new(void *p, unsigned int len);
437 X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
439 X509_EXTENSION *OCSP_accept_responses_new(char **oids);
441 X509_EXTENSION *OCSP_archive_cutoff_new(char* tim);
443 X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls);
445 OCSP_SINGLERESP *OCSP_SINGLERESP_new(void);
446 void OCSP_SINGLERESP_free(OCSP_SINGLERESP *a);
447 int i2d_OCSP_SINGLERESP(OCSP_SINGLERESP *a, unsigned char **pp);
448 OCSP_SINGLERESP *d2i_OCSP_SINGLERESP(OCSP_SINGLERESP **a, unsigned char **pp, long length);
449 int i2a_OCSP_SINGLERESP(BIO *bp, OCSP_SINGLERESP* a);
451 OCSP_CERTSTATUS *OCSP_CERTSTATUS_new(void);
452 void OCSP_CERTSTATUS_free(OCSP_CERTSTATUS *a);
453 int i2d_OCSP_CERTSTATUS(OCSP_CERTSTATUS *a, unsigned char **pp);
454 OCSP_CERTSTATUS *d2i_OCSP_CERTSTATUS(OCSP_CERTSTATUS **a, unsigned char **pp, long length);
455 int i2a_OCSP_CERTSTATUS(BIO *bp, OCSP_CERTSTATUS* a);
457 OCSP_REVOKEDINFO *OCSP_REVOKEDINFO_new(void);
458 void OCSP_REVOKEDINFO_free(OCSP_REVOKEDINFO *a);
459 int i2d_OCSP_REVOKEDINFO(OCSP_REVOKEDINFO *a, unsigned char **pp);
460 OCSP_REVOKEDINFO *d2i_OCSP_REVOKEDINFO(OCSP_REVOKEDINFO **a, unsigned char **pp, long length);
461 int i2a_OCSP_REVOKEDINFO(BIO *bp, OCSP_REVOKEDINFO* a);
463 OCSP_BASICRESP *OCSP_BASICRESP_new(void);
464 void OCSP_BASICRESP_free(OCSP_BASICRESP *a);
465 int i2d_OCSP_BASICRESP(OCSP_BASICRESP *a, unsigned char **pp);
466 OCSP_BASICRESP *d2i_OCSP_BASICRESP(OCSP_BASICRESP **a, unsigned char **pp, long length);
467 int i2a_OCSP_BASICRESP(BIO *bp, OCSP_BASICRESP* a);
469 OCSP_RESPDATA *OCSP_RESPDATA_new(void);
470 void OCSP_RESPDATA_free(OCSP_RESPDATA *a);
471 int i2d_OCSP_RESPDATA(OCSP_RESPDATA *a, unsigned char **pp);
472 OCSP_RESPDATA *d2i_OCSP_RESPDATA(OCSP_RESPDATA **a, unsigned char **pp, long length);
473 int i2a_OCSP_RESPDATA(BIO *bp, OCSP_RESPDATA* a);
475 OCSP_RESPID *OCSP_RESPID_new(void);
476 void OCSP_RESPID_free(OCSP_RESPID *a);
477 int i2d_OCSP_RESPID(OCSP_RESPID *a, unsigned char **pp);
478 OCSP_RESPID *d2i_OCSP_RESPID(OCSP_RESPID **a, unsigned char **pp, long length);
479 int i2a_OCSP_RESPID(BIO *bp, OCSP_RESPID* a);
481 OCSP_RESPONSE *OCSP_RESPONSE_new(void);
482 void OCSP_RESPONSE_free(OCSP_RESPONSE *a);
483 int i2d_OCSP_RESPONSE(OCSP_RESPONSE *a, unsigned char **pp);
484 OCSP_RESPONSE *d2i_OCSP_RESPONSE(OCSP_RESPONSE **a, unsigned char **pp, long length);
485 int i2a_OCSP_RESPONSE(BIO *bp, OCSP_RESPONSE* a);
486 int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* a);
488 OCSP_RESPBYTES *OCSP_RESPBYTES_new(void);
489 void OCSP_RESPBYTES_free(OCSP_RESPBYTES *a);
490 int i2d_OCSP_RESPBYTES(OCSP_RESPBYTES *a, unsigned char **pp);
491 OCSP_RESPBYTES *d2i_OCSP_RESPBYTES(OCSP_RESPBYTES **a, unsigned char **pp, long length);
492 int i2a_OCSP_RESPBYTES(BIO *bp, OCSP_RESPBYTES* a);
494 OCSP_ONEREQ *OCSP_ONEREQ_new(void);
495 void OCSP_ONEREQ_free(OCSP_ONEREQ *a);
496 int i2d_OCSP_ONEREQ(OCSP_ONEREQ *a, unsigned char **pp);
497 OCSP_ONEREQ *d2i_OCSP_ONEREQ(OCSP_ONEREQ **a, unsigned char **pp, long length);
498 int i2a_OCSP_ONEREQ(BIO *bp, OCSP_ONEREQ* a);
500 OCSP_CERTID *OCSP_CERTID_new(void);
501 void OCSP_CERTID_free(OCSP_CERTID *a);
502 int i2d_OCSP_CERTID(OCSP_CERTID *a, unsigned char **pp);
503 OCSP_CERTID *d2i_OCSP_CERTID(OCSP_CERTID **a, unsigned char **pp, long length);
504 int i2a_OCSP_CERTID(BIO *bp, OCSP_CERTID* a);
506 OCSP_REQUEST *OCSP_REQUEST_new(void);
507 void OCSP_REQUEST_free(OCSP_REQUEST *a);
508 int i2d_OCSP_REQUEST(OCSP_REQUEST *a, unsigned char **pp);
509 OCSP_REQUEST *d2i_OCSP_REQUEST(OCSP_REQUEST **a, unsigned char **pp, long length);
510 int i2a_OCSP_REQUEST(BIO *bp, OCSP_REQUEST* a);
511 int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a);
513 OCSP_SIGNATURE *OCSP_SIGNATURE_new(void);
514 void OCSP_SIGNATURE_free(OCSP_SIGNATURE *a);
515 int i2d_OCSP_SIGNATURE(OCSP_SIGNATURE *a, unsigned char **pp);
516 OCSP_SIGNATURE *d2i_OCSP_SIGNATURE(OCSP_SIGNATURE **a, unsigned char **pp, long length);
517 int i2a_OCSP_SIGNATURE(BIO *bp, OCSP_SIGNATURE* a);
519 OCSP_REQINFO *OCSP_REQINFO_new(void);
520 void OCSP_REQINFO_free(OCSP_REQINFO *a);
521 int i2d_OCSP_REQINFO(OCSP_REQINFO *a, unsigned char **pp);
522 OCSP_REQINFO *d2i_OCSP_REQINFO(OCSP_REQINFO **a, unsigned char **pp, long length);
523 int i2a_OCSP_REQINFO(BIO *bp, OCSP_REQINFO* a);
525 OCSP_CRLID *OCSP_CRLID_new(void);
526 void OCSP_CRLID_free(OCSP_CRLID *a);
527 int i2d_OCSP_CRLID(OCSP_CRLID *a, unsigned char **pp);
528 OCSP_CRLID *d2i_OCSP_CRLID(OCSP_CRLID **a, unsigned char **pp, long length);
529 int i2a_OCSP_CRLID(BIO *bp, OCSP_CRLID* a);
530 int OCSP_CRLID_print(BIO *bp, OCSP_CRLID *a, int ind);
532 OCSP_SERVICELOC *OCSP_SERVICELOC_new(void);
533 void OCSP_SERVICELOC_free(OCSP_SERVICELOC *a);
534 int i2d_OCSP_SERVICELOC(OCSP_SERVICELOC *a, unsigned char **pp);
535 OCSP_SERVICELOC *d2i_OCSP_SERVICELOC(OCSP_SERVICELOC **a, unsigned char **pp, long length);
536 int i2a_OCSP_SERVICELOC(BIO *bp, OCSP_SERVICELOC* a);
537 int OCSP_SERVICELOC_print(BIO *bp, OCSP_SERVICELOC* a, int ind);
539 int OCSP_extensions_print(BIO *bp, STACK_OF(X509_EXTENSION) *sk, char *title);
540 int OCSP_extension_print(BIO *bp, X509_EXTENSION *x, int ind);
542 void ERR_load_OCSP_strings(void);
544 #if 0 /* Not yet implemented */
545 X509_EXTENSION *OCSP_nochain_new(void);
548 char* ocspResponseStatus2string(long s);
549 char* ocspCertStatus2string(long s);
550 char * cRLReason2string(long s);
552 #if 0 /* Not yet implemented */
553 void OCSP_add_standard_extension(void);
556 /* BEGIN ERROR CODES */
557 /* The following lines are auto generated by the script mkerr.pl. Any changes
558 * made after this point may be overwritten when the script is next run.
561 /* Error codes for the OCSP functions. */
563 /* Function codes. */
564 #define OCSP_F_ASN1_STRING_ENCODE 106
565 #define OCSP_F_BASIC_RESPONSE_NEW 100
566 #define OCSP_F_BASIC_RESPONSE_VERIFY 101
567 #define OCSP_F_CERT_ID_NEW 102
568 #define OCSP_F_CERT_STATUS_NEW 103
569 #define OCSP_F_REQUEST_VERIFY 104
570 #define OCSP_F_RESPONSE_VERIFY 105
571 #define OCSP_F_S2I_OCSP_NONCE 107
572 #define OCSP_F_V2I_OCSP_CRLID 108
575 #define OCSP_R_BAD_DATA 108
576 #define OCSP_R_BAD_TAG 100
577 #define OCSP_R_DIGEST_ERR 101
578 #define OCSP_R_FAILED_TO_OPEN 109
579 #define OCSP_R_FAILED_TO_READ 110
580 #define OCSP_R_FAILED_TO_STAT 111
581 #define OCSP_R_MISSING_VALUE 112
582 #define OCSP_R_NO_CERTIFICATE 102
583 #define OCSP_R_NO_PUBLIC_KEY 103
584 #define OCSP_R_NO_RESPONSE_DATA 104
585 #define OCSP_R_NO_SIGNATURE 105
586 #define OCSP_R_REVOKED_NO_TIME 106
587 #define OCSP_R_UNKNOWN_NID 107
588 #define OCSP_R_UNSUPPORTED_OPTION 113
589 #define OCSP_R_VALUE_ALREADY 114