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