LTKCPP-- LLRP Toolkit C Plus Plus Library
|
00001 /* ocsp.h */ 00002 /* 00003 * Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL 00004 * project. 00005 */ 00006 00007 /* 00008 * History: This file was transfered to Richard Levitte from CertCo by Kathy 00009 * Weinhold in mid-spring 2000 to be included in OpenSSL or released as a 00010 * patch kit. 00011 */ 00012 00013 /* ==================================================================== 00014 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. 00015 * 00016 * Redistribution and use in source and binary forms, with or without 00017 * modification, are permitted provided that the following conditions 00018 * are met: 00019 * 00020 * 1. Redistributions of source code must retain the above copyright 00021 * notice, this list of conditions and the following disclaimer. 00022 * 00023 * 2. Redistributions in binary form must reproduce the above copyright 00024 * notice, this list of conditions and the following disclaimer in 00025 * the documentation and/or other materials provided with the 00026 * distribution. 00027 * 00028 * 3. All advertising materials mentioning features or use of this 00029 * software must display the following acknowledgment: 00030 * "This product includes software developed by the OpenSSL Project 00031 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 00032 * 00033 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 00034 * endorse or promote products derived from this software without 00035 * prior written permission. For written permission, please contact 00036 * openssl-core@openssl.org. 00037 * 00038 * 5. Products derived from this software may not be called "OpenSSL" 00039 * nor may "OpenSSL" appear in their names without prior written 00040 * permission of the OpenSSL Project. 00041 * 00042 * 6. Redistributions of any form whatsoever must retain the following 00043 * acknowledgment: 00044 * "This product includes software developed by the OpenSSL Project 00045 * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 00046 * 00047 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 00048 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00049 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00050 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 00051 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00052 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00053 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00054 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00055 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00056 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00057 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 00058 * OF THE POSSIBILITY OF SUCH DAMAGE. 00059 * ==================================================================== 00060 * 00061 * This product includes cryptographic software written by Eric Young 00062 * (eay@cryptsoft.com). This product includes software written by Tim 00063 * Hudson (tjh@cryptsoft.com). 00064 * 00065 */ 00066 00067 #ifndef HEADER_OCSP_H 00068 # define HEADER_OCSP_H 00069 00070 # include <openssl/ossl_typ.h> 00071 # include <openssl/x509.h> 00072 # include <openssl/x509v3.h> 00073 # include <openssl/safestack.h> 00074 00075 #ifdef __cplusplus 00076 extern "C" { 00077 #endif 00078 00079 /* Various flags and values */ 00080 00081 # define OCSP_DEFAULT_NONCE_LENGTH 16 00082 00083 # define OCSP_NOCERTS 0x1 00084 # define OCSP_NOINTERN 0x2 00085 # define OCSP_NOSIGS 0x4 00086 # define OCSP_NOCHAIN 0x8 00087 # define OCSP_NOVERIFY 0x10 00088 # define OCSP_NOEXPLICIT 0x20 00089 # define OCSP_NOCASIGN 0x40 00090 # define OCSP_NODELEGATED 0x80 00091 # define OCSP_NOCHECKS 0x100 00092 # define OCSP_TRUSTOTHER 0x200 00093 # define OCSP_RESPID_KEY 0x400 00094 # define OCSP_NOTIME 0x800 00095 00096 /*- CertID ::= SEQUENCE { 00097 * hashAlgorithm AlgorithmIdentifier, 00098 * issuerNameHash OCTET STRING, -- Hash of Issuer's DN 00099 * issuerKeyHash OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields) 00100 * serialNumber CertificateSerialNumber } 00101 */ 00102 typedef struct ocsp_cert_id_st { 00103 X509_ALGOR *hashAlgorithm; 00104 ASN1_OCTET_STRING *issuerNameHash; 00105 ASN1_OCTET_STRING *issuerKeyHash; 00106 ASN1_INTEGER *serialNumber; 00107 } OCSP_CERTID; 00108 00109 DECLARE_STACK_OF(OCSP_CERTID) 00110 00111 /*- Request ::= SEQUENCE { 00112 * reqCert CertID, 00113 * singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL } 00114 */ 00115 typedef struct ocsp_one_request_st { 00116 OCSP_CERTID *reqCert; 00117 STACK_OF(X509_EXTENSION) *singleRequestExtensions; 00118 } OCSP_ONEREQ; 00119 00120 DECLARE_STACK_OF(OCSP_ONEREQ) 00121 DECLARE_ASN1_SET_OF(OCSP_ONEREQ) 00122 00123 /*- TBSRequest ::= SEQUENCE { 00124 * version [0] EXPLICIT Version DEFAULT v1, 00125 * requestorName [1] EXPLICIT GeneralName OPTIONAL, 00126 * requestList SEQUENCE OF Request, 00127 * requestExtensions [2] EXPLICIT Extensions OPTIONAL } 00128 */ 00129 typedef struct ocsp_req_info_st { 00130 ASN1_INTEGER *version; 00131 GENERAL_NAME *requestorName; 00132 STACK_OF(OCSP_ONEREQ) *requestList; 00133 STACK_OF(X509_EXTENSION) *requestExtensions; 00134 } OCSP_REQINFO; 00135 00136 /*- Signature ::= SEQUENCE { 00137 * signatureAlgorithm AlgorithmIdentifier, 00138 * signature BIT STRING, 00139 * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } 00140 */ 00141 typedef struct ocsp_signature_st { 00142 X509_ALGOR *signatureAlgorithm; 00143 ASN1_BIT_STRING *signature; 00144 STACK_OF(X509) *certs; 00145 } OCSP_SIGNATURE; 00146 00147 /*- OCSPRequest ::= SEQUENCE { 00148 * tbsRequest TBSRequest, 00149 * optionalSignature [0] EXPLICIT Signature OPTIONAL } 00150 */ 00151 typedef struct ocsp_request_st { 00152 OCSP_REQINFO *tbsRequest; 00153 OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */ 00154 } OCSP_REQUEST; 00155 00156 /*- OCSPResponseStatus ::= ENUMERATED { 00157 * successful (0), --Response has valid confirmations 00158 * malformedRequest (1), --Illegal confirmation request 00159 * internalError (2), --Internal error in issuer 00160 * tryLater (3), --Try again later 00161 * --(4) is not used 00162 * sigRequired (5), --Must sign the request 00163 * unauthorized (6) --Request unauthorized 00164 * } 00165 */ 00166 # define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 00167 # define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 00168 # define OCSP_RESPONSE_STATUS_INTERNALERROR 2 00169 # define OCSP_RESPONSE_STATUS_TRYLATER 3 00170 # define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 00171 # define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 00172 00173 /*- ResponseBytes ::= SEQUENCE { 00174 * responseType OBJECT IDENTIFIER, 00175 * response OCTET STRING } 00176 */ 00177 typedef struct ocsp_resp_bytes_st { 00178 ASN1_OBJECT *responseType; 00179 ASN1_OCTET_STRING *response; 00180 } OCSP_RESPBYTES; 00181 00182 /*- OCSPResponse ::= SEQUENCE { 00183 * responseStatus OCSPResponseStatus, 00184 * responseBytes [0] EXPLICIT ResponseBytes OPTIONAL } 00185 */ 00186 struct ocsp_response_st { 00187 ASN1_ENUMERATED *responseStatus; 00188 OCSP_RESPBYTES *responseBytes; 00189 }; 00190 00191 /*- ResponderID ::= CHOICE { 00192 * byName [1] Name, 00193 * byKey [2] KeyHash } 00194 */ 00195 # define V_OCSP_RESPID_NAME 0 00196 # define V_OCSP_RESPID_KEY 1 00197 struct ocsp_responder_id_st { 00198 int type; 00199 union { 00200 X509_NAME *byName; 00201 ASN1_OCTET_STRING *byKey; 00202 } value; 00203 }; 00204 00205 DECLARE_STACK_OF(OCSP_RESPID) 00206 DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) 00207 00208 /*- KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key 00209 * --(excluding the tag and length fields) 00210 */ 00211 00212 /*- RevokedInfo ::= SEQUENCE { 00213 * revocationTime GeneralizedTime, 00214 * revocationReason [0] EXPLICIT CRLReason OPTIONAL } 00215 */ 00216 typedef struct ocsp_revoked_info_st { 00217 ASN1_GENERALIZEDTIME *revocationTime; 00218 ASN1_ENUMERATED *revocationReason; 00219 } OCSP_REVOKEDINFO; 00220 00221 /*- CertStatus ::= CHOICE { 00222 * good [0] IMPLICIT NULL, 00223 * revoked [1] IMPLICIT RevokedInfo, 00224 * unknown [2] IMPLICIT UnknownInfo } 00225 */ 00226 # define V_OCSP_CERTSTATUS_GOOD 0 00227 # define V_OCSP_CERTSTATUS_REVOKED 1 00228 # define V_OCSP_CERTSTATUS_UNKNOWN 2 00229 typedef struct ocsp_cert_status_st { 00230 int type; 00231 union { 00232 ASN1_NULL *good; 00233 OCSP_REVOKEDINFO *revoked; 00234 ASN1_NULL *unknown; 00235 } value; 00236 } OCSP_CERTSTATUS; 00237 00238 /*- SingleResponse ::= SEQUENCE { 00239 * certID CertID, 00240 * certStatus CertStatus, 00241 * thisUpdate GeneralizedTime, 00242 * nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL, 00243 * singleExtensions [1] EXPLICIT Extensions OPTIONAL } 00244 */ 00245 typedef struct ocsp_single_response_st { 00246 OCSP_CERTID *certId; 00247 OCSP_CERTSTATUS *certStatus; 00248 ASN1_GENERALIZEDTIME *thisUpdate; 00249 ASN1_GENERALIZEDTIME *nextUpdate; 00250 STACK_OF(X509_EXTENSION) *singleExtensions; 00251 } OCSP_SINGLERESP; 00252 00253 DECLARE_STACK_OF(OCSP_SINGLERESP) 00254 DECLARE_ASN1_SET_OF(OCSP_SINGLERESP) 00255 00256 /*- ResponseData ::= SEQUENCE { 00257 * version [0] EXPLICIT Version DEFAULT v1, 00258 * responderID ResponderID, 00259 * producedAt GeneralizedTime, 00260 * responses SEQUENCE OF SingleResponse, 00261 * responseExtensions [1] EXPLICIT Extensions OPTIONAL } 00262 */ 00263 typedef struct ocsp_response_data_st { 00264 ASN1_INTEGER *version; 00265 OCSP_RESPID *responderId; 00266 ASN1_GENERALIZEDTIME *producedAt; 00267 STACK_OF(OCSP_SINGLERESP) *responses; 00268 STACK_OF(X509_EXTENSION) *responseExtensions; 00269 } OCSP_RESPDATA; 00270 00271 /*- BasicOCSPResponse ::= SEQUENCE { 00272 * tbsResponseData ResponseData, 00273 * signatureAlgorithm AlgorithmIdentifier, 00274 * signature BIT STRING, 00275 * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } 00276 */ 00277 /* 00278 * Note 1: The value for "signature" is specified in the OCSP rfc2560 as 00279 * follows: "The value for the signature SHALL be computed on the hash of 00280 * the DER encoding ResponseData." This means that you must hash the 00281 * DER-encoded tbsResponseData, and then run it through a crypto-signing 00282 * function, which will (at least w/RSA) do a hash-'n'-private-encrypt 00283 * operation. This seems a bit odd, but that's the spec. Also note that 00284 * the data structures do not leave anywhere to independently specify the 00285 * algorithm used for the initial hash. So, we look at the 00286 * signature-specification algorithm, and try to do something intelligent. 00287 * -- Kathy Weinhold, CertCo 00288 */ 00289 /* 00290 * Note 2: It seems that the mentioned passage from RFC 2560 (section 00291 * 4.2.1) is open for interpretation. I've done tests against another 00292 * responder, and found that it doesn't do the double hashing that the RFC 00293 * seems to say one should. Therefore, all relevant functions take a flag 00294 * saying which variant should be used. -- Richard Levitte, OpenSSL team 00295 * and CeloCom 00296 */ 00297 typedef struct ocsp_basic_response_st { 00298 OCSP_RESPDATA *tbsResponseData; 00299 X509_ALGOR *signatureAlgorithm; 00300 ASN1_BIT_STRING *signature; 00301 STACK_OF(X509) *certs; 00302 } OCSP_BASICRESP; 00303 00304 /*- 00305 * CRLReason ::= ENUMERATED { 00306 * unspecified (0), 00307 * keyCompromise (1), 00308 * cACompromise (2), 00309 * affiliationChanged (3), 00310 * superseded (4), 00311 * cessationOfOperation (5), 00312 * certificateHold (6), 00313 * removeFromCRL (8) } 00314 */ 00315 # define OCSP_REVOKED_STATUS_NOSTATUS -1 00316 # define OCSP_REVOKED_STATUS_UNSPECIFIED 0 00317 # define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 00318 # define OCSP_REVOKED_STATUS_CACOMPROMISE 2 00319 # define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 00320 # define OCSP_REVOKED_STATUS_SUPERSEDED 4 00321 # define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 00322 # define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 00323 # define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 00324 00325 /*- 00326 * CrlID ::= SEQUENCE { 00327 * crlUrl [0] EXPLICIT IA5String OPTIONAL, 00328 * crlNum [1] EXPLICIT INTEGER OPTIONAL, 00329 * crlTime [2] EXPLICIT GeneralizedTime OPTIONAL } 00330 */ 00331 typedef struct ocsp_crl_id_st { 00332 ASN1_IA5STRING *crlUrl; 00333 ASN1_INTEGER *crlNum; 00334 ASN1_GENERALIZEDTIME *crlTime; 00335 } OCSP_CRLID; 00336 00337 /*- 00338 * ServiceLocator ::= SEQUENCE { 00339 * issuer Name, 00340 * locator AuthorityInfoAccessSyntax OPTIONAL } 00341 */ 00342 typedef struct ocsp_service_locator_st { 00343 X509_NAME *issuer; 00344 STACK_OF(ACCESS_DESCRIPTION) *locator; 00345 } OCSP_SERVICELOC; 00346 00347 # define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" 00348 # define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" 00349 00350 # define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) 00351 00352 # define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) 00353 00354 # define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ 00355 (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL) 00356 00357 # define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\ 00358 (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL) 00359 00360 # define PEM_write_bio_OCSP_REQUEST(bp,o) \ 00361 PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ 00362 bp,(char *)o, NULL,NULL,0,NULL,NULL) 00363 00364 # define PEM_write_bio_OCSP_RESPONSE(bp,o) \ 00365 PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ 00366 bp,(char *)o, NULL,NULL,0,NULL,NULL) 00367 00368 # define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) 00369 00370 # define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) 00371 00372 # define OCSP_REQUEST_sign(o,pkey,md) \ 00373 ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\ 00374 o->optionalSignature->signatureAlgorithm,NULL,\ 00375 o->optionalSignature->signature,o->tbsRequest,pkey,md) 00376 00377 # define OCSP_BASICRESP_sign(o,pkey,md,d) \ 00378 ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\ 00379 o->signature,o->tbsResponseData,pkey,md) 00380 00381 # define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\ 00382 a->optionalSignature->signatureAlgorithm,\ 00383 a->optionalSignature->signature,a->tbsRequest,r) 00384 00385 # define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\ 00386 a->signatureAlgorithm,a->signature,a->tbsResponseData,r) 00387 00388 # define ASN1_BIT_STRING_digest(data,type,md,len) \ 00389 ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) 00390 00391 # define OCSP_CERTSTATUS_dup(cs)\ 00392 (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ 00393 (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) 00394 00395 OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); 00396 00397 OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); 00398 OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, 00399 int maxline); 00400 int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx); 00401 int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); 00402 OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline); 00403 void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); 00404 void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); 00405 int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, 00406 ASN1_VALUE *val); 00407 int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval, 00408 const ASN1_ITEM *it); 00409 BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx); 00410 int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, 00411 ASN1_VALUE *val); 00412 int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path); 00413 int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); 00414 int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, 00415 const char *name, const char *value); 00416 00417 OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer); 00418 00419 OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, 00420 X509_NAME *issuerName, 00421 ASN1_BIT_STRING *issuerKey, 00422 ASN1_INTEGER *serialNumber); 00423 00424 OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); 00425 00426 int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); 00427 int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); 00428 int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); 00429 int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); 00430 00431 int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); 00432 int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); 00433 00434 int OCSP_request_sign(OCSP_REQUEST *req, 00435 X509 *signer, 00436 EVP_PKEY *key, 00437 const EVP_MD *dgst, 00438 STACK_OF(X509) *certs, unsigned long flags); 00439 00440 int OCSP_response_status(OCSP_RESPONSE *resp); 00441 OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); 00442 00443 int OCSP_resp_count(OCSP_BASICRESP *bs); 00444 OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); 00445 int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); 00446 int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, 00447 ASN1_GENERALIZEDTIME **revtime, 00448 ASN1_GENERALIZEDTIME **thisupd, 00449 ASN1_GENERALIZEDTIME **nextupd); 00450 int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, 00451 int *reason, 00452 ASN1_GENERALIZEDTIME **revtime, 00453 ASN1_GENERALIZEDTIME **thisupd, 00454 ASN1_GENERALIZEDTIME **nextupd); 00455 int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, 00456 ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); 00457 00458 int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, 00459 X509_STORE *store, unsigned long flags); 00460 00461 int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, 00462 int *pssl); 00463 00464 int OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b); 00465 int OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b); 00466 00467 int OCSP_request_onereq_count(OCSP_REQUEST *req); 00468 OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); 00469 OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); 00470 int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, 00471 ASN1_OCTET_STRING **pikeyHash, 00472 ASN1_INTEGER **pserial, OCSP_CERTID *cid); 00473 int OCSP_request_is_signed(OCSP_REQUEST *req); 00474 OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); 00475 OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, 00476 OCSP_CERTID *cid, 00477 int status, int reason, 00478 ASN1_TIME *revtime, 00479 ASN1_TIME *thisupd, 00480 ASN1_TIME *nextupd); 00481 int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); 00482 int OCSP_basic_sign(OCSP_BASICRESP *brsp, 00483 X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, 00484 STACK_OF(X509) *certs, unsigned long flags); 00485 00486 X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim); 00487 00488 X509_EXTENSION *OCSP_accept_responses_new(char **oids); 00489 00490 X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); 00491 00492 X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, char **urls); 00493 00494 int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); 00495 int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); 00496 int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj, 00497 int lastpos); 00498 int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); 00499 X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); 00500 X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); 00501 void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, 00502 int *idx); 00503 int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, 00504 unsigned long flags); 00505 int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); 00506 00507 int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); 00508 int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); 00509 int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos); 00510 int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); 00511 X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); 00512 X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); 00513 void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); 00514 int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, 00515 unsigned long flags); 00516 int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); 00517 00518 int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); 00519 int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); 00520 int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj, 00521 int lastpos); 00522 int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, 00523 int lastpos); 00524 X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); 00525 X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); 00526 void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, 00527 int *idx); 00528 int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, 00529 int crit, unsigned long flags); 00530 int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); 00531 00532 int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); 00533 int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); 00534 int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj, 00535 int lastpos); 00536 int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, 00537 int lastpos); 00538 X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); 00539 X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); 00540 void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, 00541 int *idx); 00542 int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, 00543 int crit, unsigned long flags); 00544 int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); 00545 00546 DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) 00547 DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) 00548 DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) 00549 DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) 00550 DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) 00551 DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) 00552 DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) 00553 DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) 00554 DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) 00555 DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) 00556 DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) 00557 DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) 00558 DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) 00559 DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) 00560 DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) 00561 00562 const char *OCSP_response_status_str(long s); 00563 const char *OCSP_cert_status_str(long s); 00564 const char *OCSP_crl_reason_str(long s); 00565 00566 int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); 00567 int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); 00568 00569 int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, 00570 X509_STORE *st, unsigned long flags); 00571 00572 /* BEGIN ERROR CODES */ 00573 /* 00574 * The following lines are auto generated by the script mkerr.pl. Any changes 00575 * made after this point may be overwritten when the script is next run. 00576 */ 00577 void ERR_load_OCSP_strings(void); 00578 00579 /* Error codes for the OCSP functions. */ 00580 00581 /* Function codes. */ 00582 # define OCSP_F_ASN1_STRING_ENCODE 100 00583 # define OCSP_F_D2I_OCSP_NONCE 102 00584 # define OCSP_F_OCSP_BASIC_ADD1_STATUS 103 00585 # define OCSP_F_OCSP_BASIC_SIGN 104 00586 # define OCSP_F_OCSP_BASIC_VERIFY 105 00587 # define OCSP_F_OCSP_CERT_ID_NEW 101 00588 # define OCSP_F_OCSP_CHECK_DELEGATED 106 00589 # define OCSP_F_OCSP_CHECK_IDS 107 00590 # define OCSP_F_OCSP_CHECK_ISSUER 108 00591 # define OCSP_F_OCSP_CHECK_VALIDITY 115 00592 # define OCSP_F_OCSP_MATCH_ISSUERID 109 00593 # define OCSP_F_OCSP_PARSE_URL 114 00594 # define OCSP_F_OCSP_REQUEST_SIGN 110 00595 # define OCSP_F_OCSP_REQUEST_VERIFY 116 00596 # define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 00597 # define OCSP_F_OCSP_SENDREQ_BIO 112 00598 # define OCSP_F_OCSP_SENDREQ_NBIO 117 00599 # define OCSP_F_PARSE_HTTP_LINE1 118 00600 # define OCSP_F_REQUEST_VERIFY 113 00601 00602 /* Reason codes. */ 00603 # define OCSP_R_BAD_DATA 100 00604 # define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 00605 # define OCSP_R_DIGEST_ERR 102 00606 # define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 00607 # define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 00608 # define OCSP_R_ERROR_PARSING_URL 121 00609 # define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 00610 # define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 00611 # define OCSP_R_NOT_BASIC_RESPONSE 104 00612 # define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 00613 # define OCSP_R_NO_CONTENT 106 00614 # define OCSP_R_NO_PUBLIC_KEY 107 00615 # define OCSP_R_NO_RESPONSE_DATA 108 00616 # define OCSP_R_NO_REVOKED_TIME 109 00617 # define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 00618 # define OCSP_R_REQUEST_NOT_SIGNED 128 00619 # define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 00620 # define OCSP_R_ROOT_CA_NOT_TRUSTED 112 00621 # define OCSP_R_SERVER_READ_ERROR 113 00622 # define OCSP_R_SERVER_RESPONSE_ERROR 114 00623 # define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115 00624 # define OCSP_R_SERVER_WRITE_ERROR 116 00625 # define OCSP_R_SIGNATURE_FAILURE 117 00626 # define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 00627 # define OCSP_R_STATUS_EXPIRED 125 00628 # define OCSP_R_STATUS_NOT_YET_VALID 126 00629 # define OCSP_R_STATUS_TOO_OLD 127 00630 # define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 00631 # define OCSP_R_UNKNOWN_NID 120 00632 # define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 00633 00634 #ifdef __cplusplus 00635 } 00636 #endif 00637 #endif