2000-10-27 19:05:35 +08:00
|
|
|
/* ocsp.h */
|
|
|
|
/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
|
|
|
|
* project. */
|
|
|
|
|
|
|
|
/* History:
|
|
|
|
This file was transfered to Richard Levitte from CertCo by Kathy
|
|
|
|
Weinhold in mid-spring 2000 to be included in OpenSSL or released
|
|
|
|
as a patch kit. */
|
|
|
|
|
|
|
|
/* ====================================================================
|
|
|
|
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* 3. All advertising materials mentioning features or use of this
|
|
|
|
* software must display the following acknowledgment:
|
|
|
|
* "This product includes software developed by the OpenSSL Project
|
|
|
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
|
|
|
*
|
|
|
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
|
|
|
* endorse or promote products derived from this software without
|
|
|
|
* prior written permission. For written permission, please contact
|
|
|
|
* openssl-core@openssl.org.
|
|
|
|
*
|
|
|
|
* 5. Products derived from this software may not be called "OpenSSL"
|
|
|
|
* nor may "OpenSSL" appear in their names without prior written
|
|
|
|
* permission of the OpenSSL Project.
|
|
|
|
*
|
|
|
|
* 6. Redistributions of any form whatsoever must retain the following
|
|
|
|
* acknowledgment:
|
|
|
|
* "This product includes software developed by the OpenSSL Project
|
|
|
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
|
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
|
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
* ====================================================================
|
|
|
|
*
|
|
|
|
* This product includes cryptographic software written by Eric Young
|
|
|
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
|
|
|
* Hudson (tjh@cryptsoft.com).
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HEADER_OCSP_H
|
|
|
|
#define HEADER_OCSP_H
|
|
|
|
|
|
|
|
#include <openssl/x509.h>
|
|
|
|
#include <openssl/x509v3.h>
|
|
|
|
#include <openssl/safestack.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2001-01-08 09:21:55 +08:00
|
|
|
/* Various flags and values */
|
|
|
|
|
|
|
|
#define OCSP_DEFAULT_NONCE_LENGTH 16
|
|
|
|
|
|
|
|
#define OCSP_NOCERTS 0x1
|
2001-01-11 08:52:50 +08:00
|
|
|
#define OCSP_NOINTERN 0x2
|
|
|
|
#define OCSP_NOSIGS 0x4
|
2001-01-17 09:31:34 +08:00
|
|
|
#define OCSP_NOCHAIN 0x8
|
|
|
|
#define OCSP_NOVERIFY 0x10
|
|
|
|
#define OCSP_NOEXPLICIT 0x20
|
|
|
|
#define OCSP_NOCASIGN 0x40
|
|
|
|
#define OCSP_NODELEGATED 0x80
|
|
|
|
#define OCSP_NOCHECKS 0x100
|
2001-01-26 09:55:52 +08:00
|
|
|
#define OCSP_TRUSTOTHER 0x200
|
2001-01-08 09:21:55 +08:00
|
|
|
|
2000-10-27 19:05:35 +08:00
|
|
|
/* CertID ::= SEQUENCE {
|
|
|
|
* hashAlgorithm AlgorithmIdentifier,
|
|
|
|
* issuerNameHash OCTET STRING, -- Hash of Issuer's DN
|
|
|
|
* issuerKeyHash OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields)
|
|
|
|
* serialNumber CertificateSerialNumber }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_cert_id_st
|
|
|
|
{
|
|
|
|
X509_ALGOR *hashAlgorithm;
|
|
|
|
ASN1_OCTET_STRING *issuerNameHash;
|
|
|
|
ASN1_OCTET_STRING *issuerKeyHash;
|
|
|
|
ASN1_INTEGER *serialNumber;
|
|
|
|
} OCSP_CERTID;
|
|
|
|
|
2001-01-19 09:32:23 +08:00
|
|
|
DECLARE_STACK_OF(OCSP_CERTID)
|
|
|
|
|
2000-10-27 19:05:35 +08:00
|
|
|
/* Request ::= SEQUENCE {
|
|
|
|
* reqCert CertID,
|
|
|
|
* singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_one_request_st
|
|
|
|
{
|
|
|
|
OCSP_CERTID *reqCert;
|
|
|
|
STACK_OF(X509_EXTENSION) *singleRequestExtensions;
|
|
|
|
} OCSP_ONEREQ;
|
|
|
|
|
|
|
|
DECLARE_STACK_OF(OCSP_ONEREQ)
|
|
|
|
DECLARE_ASN1_SET_OF(OCSP_ONEREQ)
|
|
|
|
|
|
|
|
|
|
|
|
/* TBSRequest ::= SEQUENCE {
|
|
|
|
* version [0] EXPLICIT Version DEFAULT v1,
|
|
|
|
* requestorName [1] EXPLICIT GeneralName OPTIONAL,
|
|
|
|
* requestList SEQUENCE OF Request,
|
|
|
|
* requestExtensions [2] EXPLICIT Extensions OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_req_info_st
|
|
|
|
{
|
|
|
|
ASN1_INTEGER *version;
|
|
|
|
GENERAL_NAME *requestorName;
|
|
|
|
STACK_OF(OCSP_ONEREQ) *requestList;
|
|
|
|
STACK_OF(X509_EXTENSION) *requestExtensions;
|
|
|
|
} OCSP_REQINFO;
|
|
|
|
|
|
|
|
/* Signature ::= SEQUENCE {
|
|
|
|
* signatureAlgorithm AlgorithmIdentifier,
|
|
|
|
* signature BIT STRING,
|
|
|
|
* certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_signature_st
|
|
|
|
{
|
|
|
|
X509_ALGOR *signatureAlgorithm;
|
|
|
|
ASN1_BIT_STRING *signature;
|
|
|
|
STACK_OF(X509) *certs;
|
|
|
|
} OCSP_SIGNATURE;
|
|
|
|
|
|
|
|
/* OCSPRequest ::= SEQUENCE {
|
|
|
|
* tbsRequest TBSRequest,
|
|
|
|
* optionalSignature [0] EXPLICIT Signature OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_request_st
|
|
|
|
{
|
|
|
|
OCSP_REQINFO *tbsRequest;
|
|
|
|
OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */
|
|
|
|
} OCSP_REQUEST;
|
|
|
|
|
|
|
|
/* OCSPResponseStatus ::= ENUMERATED {
|
|
|
|
* successful (0), --Response has valid confirmations
|
|
|
|
* malformedRequest (1), --Illegal confirmation request
|
|
|
|
* internalError (2), --Internal error in issuer
|
|
|
|
* tryLater (3), --Try again later
|
|
|
|
* --(4) is not used
|
|
|
|
* sigRequired (5), --Must sign the request
|
|
|
|
* unauthorized (6) --Request unauthorized
|
|
|
|
* }
|
|
|
|
*/
|
2001-01-08 09:21:55 +08:00
|
|
|
#define OCSP_RESPONSE_STATUS_SUCCESSFUL 0
|
2000-10-27 19:05:35 +08:00
|
|
|
#define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1
|
|
|
|
#define OCSP_RESPONSE_STATUS_INTERNALERROR 2
|
|
|
|
#define OCSP_RESPONSE_STATUS_TRYLATER 3
|
|
|
|
#define OCSP_RESPONSE_STATUS_SIGREQUIRED 5
|
|
|
|
#define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6
|
|
|
|
|
|
|
|
/* ResponseBytes ::= SEQUENCE {
|
|
|
|
* responseType OBJECT IDENTIFIER,
|
|
|
|
* response OCTET STRING }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_resp_bytes_st
|
|
|
|
{
|
|
|
|
ASN1_OBJECT *responseType;
|
|
|
|
ASN1_OCTET_STRING *response;
|
|
|
|
} OCSP_RESPBYTES;
|
|
|
|
|
|
|
|
/* OCSPResponse ::= SEQUENCE {
|
|
|
|
* responseStatus OCSPResponseStatus,
|
|
|
|
* responseBytes [0] EXPLICIT ResponseBytes OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_response_st
|
|
|
|
{
|
|
|
|
ASN1_ENUMERATED *responseStatus;
|
|
|
|
OCSP_RESPBYTES *responseBytes;
|
|
|
|
} OCSP_RESPONSE;
|
|
|
|
|
|
|
|
/* ResponderID ::= CHOICE {
|
|
|
|
* byName [1] Name,
|
|
|
|
* byKey [2] KeyHash }
|
|
|
|
*/
|
2000-12-14 02:21:51 +08:00
|
|
|
#define V_OCSP_RESPID_NAME 0
|
|
|
|
#define V_OCSP_RESPID_KEY 1
|
2000-10-27 19:05:35 +08:00
|
|
|
typedef struct ocsp_responder_id_st
|
|
|
|
{
|
2000-12-14 02:21:51 +08:00
|
|
|
int type;
|
2000-10-27 19:05:35 +08:00
|
|
|
union {
|
|
|
|
X509_NAME* byName;
|
|
|
|
ASN1_OCTET_STRING *byKey;
|
|
|
|
} value;
|
|
|
|
} OCSP_RESPID;
|
|
|
|
/* KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key
|
|
|
|
* --(excluding the tag and length fields)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* RevokedInfo ::= SEQUENCE {
|
|
|
|
* revocationTime GeneralizedTime,
|
|
|
|
* revocationReason [0] EXPLICIT CRLReason OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_revoked_info_st
|
|
|
|
{
|
|
|
|
ASN1_GENERALIZEDTIME *revocationTime;
|
|
|
|
ASN1_ENUMERATED *revocationReason;
|
|
|
|
} OCSP_REVOKEDINFO;
|
|
|
|
|
|
|
|
/* CertStatus ::= CHOICE {
|
|
|
|
* good [0] IMPLICIT NULL,
|
|
|
|
* revoked [1] IMPLICIT RevokedInfo,
|
|
|
|
* unknown [2] IMPLICIT UnknownInfo }
|
|
|
|
*/
|
|
|
|
#define V_OCSP_CERTSTATUS_GOOD 0
|
|
|
|
#define V_OCSP_CERTSTATUS_REVOKED 1
|
|
|
|
#define V_OCSP_CERTSTATUS_UNKNOWN 2
|
|
|
|
typedef struct ocsp_cert_status_st
|
|
|
|
{
|
2000-12-14 02:21:51 +08:00
|
|
|
int type;
|
|
|
|
union {
|
|
|
|
ASN1_NULL *good;
|
|
|
|
OCSP_REVOKEDINFO *revoked;
|
|
|
|
ASN1_NULL *unknown;
|
|
|
|
} value;
|
2000-10-27 19:05:35 +08:00
|
|
|
} OCSP_CERTSTATUS;
|
|
|
|
|
|
|
|
/* SingleResponse ::= SEQUENCE {
|
|
|
|
* certID CertID,
|
|
|
|
* certStatus CertStatus,
|
|
|
|
* thisUpdate GeneralizedTime,
|
|
|
|
* nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL,
|
|
|
|
* singleExtensions [1] EXPLICIT Extensions OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_single_response_st
|
|
|
|
{
|
|
|
|
OCSP_CERTID *certId;
|
|
|
|
OCSP_CERTSTATUS *certStatus;
|
|
|
|
ASN1_GENERALIZEDTIME *thisUpdate;
|
|
|
|
ASN1_GENERALIZEDTIME *nextUpdate;
|
|
|
|
STACK_OF(X509_EXTENSION) *singleExtensions;
|
|
|
|
} OCSP_SINGLERESP;
|
|
|
|
|
|
|
|
DECLARE_STACK_OF(OCSP_SINGLERESP)
|
|
|
|
DECLARE_ASN1_SET_OF(OCSP_SINGLERESP)
|
|
|
|
|
|
|
|
/* ResponseData ::= SEQUENCE {
|
|
|
|
* version [0] EXPLICIT Version DEFAULT v1,
|
|
|
|
* responderID ResponderID,
|
|
|
|
* producedAt GeneralizedTime,
|
|
|
|
* responses SEQUENCE OF SingleResponse,
|
|
|
|
* responseExtensions [1] EXPLICIT Extensions OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_response_data_st
|
|
|
|
{
|
|
|
|
ASN1_INTEGER *version;
|
|
|
|
OCSP_RESPID *responderId;
|
|
|
|
ASN1_GENERALIZEDTIME *producedAt;
|
|
|
|
STACK_OF(OCSP_SINGLERESP) *responses;
|
|
|
|
STACK_OF(X509_EXTENSION) *responseExtensions;
|
|
|
|
} OCSP_RESPDATA;
|
|
|
|
|
|
|
|
/* BasicOCSPResponse ::= SEQUENCE {
|
|
|
|
* tbsResponseData ResponseData,
|
|
|
|
* signatureAlgorithm AlgorithmIdentifier,
|
|
|
|
* signature BIT STRING,
|
|
|
|
* certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
|
|
|
|
*/
|
|
|
|
/* Note 1:
|
|
|
|
The value for "signature" is specified in the OCSP rfc2560 as follows:
|
|
|
|
"The value for the signature SHALL be computed on the hash of the DER
|
|
|
|
encoding ResponseData." This means that you must hash the DER-encoded
|
|
|
|
tbsResponseData, and then run it through a crypto-signing function, which
|
|
|
|
will (at least w/RSA) do a hash-'n'-private-encrypt operation. This seems
|
|
|
|
a bit odd, but that's the spec. Also note that the data structures do not
|
|
|
|
leave anywhere to independently specify the algorithm used for the initial
|
|
|
|
hash. So, we look at the signature-specification algorithm, and try to do
|
|
|
|
something intelligent. -- Kathy Weinhold, CertCo */
|
|
|
|
/* Note 2:
|
|
|
|
It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open
|
|
|
|
for interpretation. I've done tests against another responder, and found
|
|
|
|
that it doesn't do the double hashing that the RFC seems to say one
|
|
|
|
should. Therefore, all relevant functions take a flag saying which
|
|
|
|
variant should be used. -- Richard Levitte, OpenSSL team and CeloCom */
|
|
|
|
typedef struct ocsp_basic_response_st
|
|
|
|
{
|
|
|
|
OCSP_RESPDATA *tbsResponseData;
|
|
|
|
X509_ALGOR *signatureAlgorithm;
|
|
|
|
ASN1_BIT_STRING *signature;
|
|
|
|
STACK_OF(X509) *certs;
|
|
|
|
} OCSP_BASICRESP;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CRLReason ::= ENUMERATED {
|
|
|
|
* unspecified (0),
|
|
|
|
* keyCompromise (1),
|
|
|
|
* cACompromise (2),
|
|
|
|
* affiliationChanged (3),
|
|
|
|
* superseded (4),
|
|
|
|
* cessationOfOperation (5),
|
|
|
|
* certificateHold (6),
|
|
|
|
* removeFromCRL (8) }
|
|
|
|
*/
|
|
|
|
#define OCSP_REVOKED_STATUS_NOSTATUS -1
|
|
|
|
#define OCSP_REVOKED_STATUS_UNSPECIFIED 0
|
|
|
|
#define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1
|
|
|
|
#define OCSP_REVOKED_STATUS_CACOMPROMISE 2
|
|
|
|
#define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3
|
|
|
|
#define OCSP_REVOKED_STATUS_SUPERSEDED 4
|
|
|
|
#define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5
|
|
|
|
#define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6
|
|
|
|
#define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8
|
|
|
|
|
|
|
|
/* CrlID ::= SEQUENCE {
|
|
|
|
* crlUrl [0] EXPLICIT IA5String OPTIONAL,
|
|
|
|
* crlNum [1] EXPLICIT INTEGER OPTIONAL,
|
|
|
|
* crlTime [2] EXPLICIT GeneralizedTime OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_crl_id_st
|
|
|
|
{
|
|
|
|
ASN1_IA5STRING *crlUrl;
|
|
|
|
ASN1_INTEGER *crlNum;
|
|
|
|
ASN1_GENERALIZEDTIME *crlTime;
|
|
|
|
} OCSP_CRLID;
|
|
|
|
|
|
|
|
/* ServiceLocator ::= SEQUENCE {
|
|
|
|
* issuer Name,
|
|
|
|
* locator AuthorityInfoAccessSyntax OPTIONAL }
|
|
|
|
*/
|
|
|
|
typedef struct ocsp_service_locator_st
|
|
|
|
{
|
|
|
|
X509_NAME* issuer;
|
|
|
|
STACK_OF(ACCESS_DESCRIPTION) *locator;
|
|
|
|
} OCSP_SERVICELOC;
|
|
|
|
|
|
|
|
#define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
|
|
|
|
#define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
|
|
|
|
|
|
|
|
#define d2i_OCSP_REQUEST_bio(bp,p) (OCSP_REQUEST*)ASN1_d2i_bio((char*(*)()) \
|
|
|
|
OCSP_REQUEST_new,(char *(*)())d2i_OCSP_REQUEST, (bp),\
|
|
|
|
(unsigned char **)(p))
|
|
|
|
|
|
|
|
#define d2i_OCSP_RESPONSE_bio(bp,p) (OCSP_RESPONSE*)ASN1_d2i_bio((char*(*)())\
|
|
|
|
OCSP_REQUEST_new,(char *(*)())d2i_OCSP_RESPONSE, (bp),\
|
|
|
|
(unsigned char **)(p))
|
|
|
|
|
|
|
|
#define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
|
|
|
|
(char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
|
|
|
|
|
|
|
|
#define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\
|
|
|
|
(char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)
|
|
|
|
|
|
|
|
#define PEM_write_bio_OCSP_REQUEST(bp,o) \
|
|
|
|
PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\
|
|
|
|
bp,(char *)o, NULL,NULL,0,NULL,NULL)
|
|
|
|
|
|
|
|
#define PEM_write_bio_OCSP_RESPONSE(bp,o) \
|
|
|
|
PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
|
|
|
|
bp,(char *)o, NULL,NULL,0,NULL,NULL)
|
|
|
|
|
|
|
|
#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_RESPONSE,bp,\
|
|
|
|
(unsigned char *)o)
|
|
|
|
|
|
|
|
#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_REQUEST,bp,\
|
|
|
|
(unsigned char *)o)
|
|
|
|
|
|
|
|
#define OCSP_REQUEST_sign(o,pkey,md) \
|
2000-12-29 06:24:50 +08:00
|
|
|
ASN1_item_sign(&OCSP_REQINFO_it,\
|
2000-10-27 19:05:35 +08:00
|
|
|
o->optionalSignature->signatureAlgorithm,NULL,\
|
2001-01-08 09:21:55 +08:00
|
|
|
o->optionalSignature->signature,o->tbsRequest,pkey,md)
|
2000-10-27 19:05:35 +08:00
|
|
|
|
|
|
|
#define OCSP_BASICRESP_sign(o,pkey,md,d) \
|
2000-12-29 06:24:50 +08:00
|
|
|
ASN1_item_sign(&OCSP_RESPDATA_it,o->signatureAlgorithm,NULL,\
|
2001-01-08 09:21:55 +08:00
|
|
|
o->signature,o->tbsResponseData,pkey,md)
|
2000-10-27 19:05:35 +08:00
|
|
|
|
2000-12-29 06:24:50 +08:00
|
|
|
#define OCSP_REQUEST_verify(a,r) ASN1_item_verify(&OCSP_REQINFO_it,\
|
2000-10-27 19:05:35 +08:00
|
|
|
a->optionalSignature->signatureAlgorithm,\
|
2001-01-08 09:21:55 +08:00
|
|
|
a->optionalSignature->signature,a->tbsRequest,r)
|
2000-10-27 19:05:35 +08:00
|
|
|
|
2000-12-29 06:24:50 +08:00
|
|
|
#define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(&OCSP_RESPDATA_it,\
|
2001-01-08 09:21:55 +08:00
|
|
|
a->signatureAlgorithm,a->signature,a->tbsResponseData,r)
|
2000-10-27 19:05:35 +08:00
|
|
|
|
|
|
|
#define ASN1_BIT_STRING_digest(data,type,md,len) \
|
2001-01-08 09:21:55 +08:00
|
|
|
ASN1_item_digest(&ASN1_BIT_STRING_it,type,data,md,len)
|
2000-10-27 19:05:35 +08:00
|
|
|
|
|
|
|
#define OCSP_CERTID_dup(cid) (OCSP_CERTID*)ASN1_dup((int(*)())i2d_OCSP_CERTID,\
|
|
|
|
(char *(*)())d2i_OCSP_CERTID,(char *)(cid))
|
|
|
|
|
|
|
|
#define OCSP_CERTSTATUS_dup(cs)\
|
|
|
|
(OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
|
|
|
|
(char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
|
|
|
|
|
2001-01-04 09:46:36 +08:00
|
|
|
OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);
|
|
|
|
|
|
|
|
OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);
|
|
|
|
|
2000-10-27 19:05:35 +08:00
|
|
|
OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,
|
|
|
|
X509_NAME *issuerName,
|
|
|
|
ASN1_BIT_STRING* issuerKey,
|
|
|
|
ASN1_INTEGER *serialNumber);
|
|
|
|
|
|
|
|
OCSP_CERTSTATUS *OCSP_cert_status_new(int status, int reason, char *tim);
|
|
|
|
|
2001-01-08 09:21:55 +08:00
|
|
|
OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);
|
|
|
|
int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);
|
|
|
|
int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs);
|
|
|
|
int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm);
|
|
|
|
int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);
|
2000-10-27 19:05:35 +08:00
|
|
|
|
|
|
|
int OCSP_request_sign(OCSP_REQUEST *req,
|
2001-01-08 09:21:55 +08:00
|
|
|
X509 *signer,
|
2000-10-27 19:05:35 +08:00
|
|
|
EVP_PKEY *key,
|
|
|
|
const EVP_MD *dgst,
|
2001-01-08 09:21:55 +08:00
|
|
|
STACK_OF(X509) *certs,
|
|
|
|
unsigned long flags);
|
|
|
|
|
|
|
|
int OCSP_response_status(OCSP_RESPONSE *resp);
|
|
|
|
OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);
|
2000-10-27 19:05:35 +08:00
|
|
|
|
2001-01-08 21:39:06 +08:00
|
|
|
int OCSP_resp_count(OCSP_BASICRESP *bs);
|
|
|
|
OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
|
|
|
|
int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);
|
|
|
|
int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,
|
|
|
|
ASN1_GENERALIZEDTIME **revtime,
|
|
|
|
ASN1_GENERALIZEDTIME **thisupd,
|
|
|
|
ASN1_GENERALIZEDTIME **nextupd);
|
|
|
|
int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
|
|
|
|
int *reason,
|
|
|
|
ASN1_GENERALIZEDTIME **revtime,
|
|
|
|
ASN1_GENERALIZEDTIME **thisupd,
|
|
|
|
ASN1_GENERALIZEDTIME **nextupd);
|
|
|
|
|
2000-10-27 19:05:35 +08:00
|
|
|
int OCSP_request_verify(OCSP_REQUEST *req, EVP_PKEY *pkey);
|
|
|
|
|
2001-01-17 09:31:34 +08:00
|
|
|
int OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
|
2001-01-08 09:21:55 +08:00
|
|
|
int OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
|
|
|
|
|
2000-10-27 19:05:35 +08:00
|
|
|
OCSP_BASICRESP *OCSP_basic_response_new(int tag,
|
2001-01-04 09:46:36 +08:00
|
|
|
X509* cert);
|
2000-10-27 19:05:35 +08:00
|
|
|
|
|
|
|
int OCSP_basic_response_add(OCSP_BASICRESP *rsp,
|
|
|
|
OCSP_CERTID *cid,
|
|
|
|
OCSP_CERTSTATUS *cst,
|
|
|
|
char *thisUpdate,
|
2001-01-04 09:46:36 +08:00
|
|
|
char *nextUpdate);
|
2000-10-27 19:05:35 +08:00
|
|
|
|
|
|
|
int OCSP_basic_response_sign(OCSP_BASICRESP *brsp,
|
|
|
|
EVP_PKEY *key,
|
|
|
|
const EVP_MD *dgst,
|
|
|
|
STACK_OF(X509) *certs);
|
|
|
|
|
|
|
|
int OCSP_response_verify(OCSP_RESPONSE *rsp, EVP_PKEY *pkey);
|
|
|
|
|
|
|
|
int OCSP_basic_response_verify(OCSP_BASICRESP *rsp, EVP_PKEY *pkey);
|
|
|
|
|
|
|
|
|
|
|
|
OCSP_RESPONSE *OCSP_response_new(int status,
|
|
|
|
int nid,
|
|
|
|
int (*i2d)(),
|
|
|
|
char *data);
|
|
|
|
|
|
|
|
ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(),
|
2000-11-12 10:11:13 +08:00
|
|
|
char *data, STACK_OF(ASN1_OBJECT) *sk);
|
2000-10-27 19:05:35 +08:00
|
|
|
|
|
|
|
X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
|
|
|
|
|
|
|
|
X509_EXTENSION *OCSP_accept_responses_new(char **oids);
|
|
|
|
|
|
|
|
X509_EXTENSION *OCSP_archive_cutoff_new(char* tim);
|
|
|
|
|
|
|
|
X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls);
|
|
|
|
|
2000-12-28 09:05:05 +08:00
|
|
|
int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x);
|
|
|
|
int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos);
|
|
|
|
int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj, int lastpos);
|
|
|
|
int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos);
|
|
|
|
X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc);
|
|
|
|
X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc);
|
|
|
|
void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx);
|
|
|
|
int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit,
|
|
|
|
unsigned long flags);
|
|
|
|
int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc);
|
|
|
|
|
|
|
|
int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x);
|
|
|
|
int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos);
|
|
|
|
int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos);
|
|
|
|
int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos);
|
|
|
|
X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc);
|
|
|
|
X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc);
|
|
|
|
void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx);
|
|
|
|
int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit,
|
|
|
|
unsigned long flags);
|
|
|
|
int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc);
|
|
|
|
|
|
|
|
int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x);
|
|
|
|
int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos);
|
|
|
|
int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj, int lastpos);
|
|
|
|
int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos);
|
|
|
|
X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc);
|
|
|
|
X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc);
|
|
|
|
void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx);
|
|
|
|
int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit,
|
|
|
|
unsigned long flags);
|
|
|
|
int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc);
|
|
|
|
|
|
|
|
int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x);
|
|
|
|
int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos);
|
|
|
|
int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj, int lastpos);
|
|
|
|
int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, int lastpos);
|
|
|
|
X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc);
|
|
|
|
X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc);
|
|
|
|
void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx);
|
|
|
|
int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit,
|
|
|
|
unsigned long flags);
|
|
|
|
int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc);
|
|
|
|
|
2000-12-15 21:42:00 +08:00
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP)
|
2000-12-29 06:24:50 +08:00
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_RESPID)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_CERTID)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE)
|
2000-12-17 22:09:43 +08:00
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO)
|
2000-12-15 21:42:00 +08:00
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_CRLID)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC)
|
2000-10-27 19:05:35 +08:00
|
|
|
|
2001-01-19 09:32:23 +08:00
|
|
|
char *OCSP_response_status_str(long s);
|
|
|
|
char *OCSP_cert_status_str(long s);
|
|
|
|
char *OCSP_crl_reason_str(long s);
|
|
|
|
|
2000-12-29 06:24:50 +08:00
|
|
|
int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);
|
2001-01-13 09:48:38 +08:00
|
|
|
int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);
|
2000-12-29 06:24:50 +08:00
|
|
|
|
2001-01-11 08:52:50 +08:00
|
|
|
int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
|
|
|
|
X509_STORE *st, unsigned long flags);
|
2000-12-29 06:24:50 +08:00
|
|
|
|
2000-10-27 19:05:35 +08:00
|
|
|
void ERR_load_OCSP_strings(void);
|
|
|
|
|
|
|
|
/* BEGIN ERROR CODES */
|
|
|
|
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
|
|
|
* made after this point may be overwritten when the script is next run.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Error codes for the OCSP functions. */
|
|
|
|
|
|
|
|
/* Function codes. */
|
|
|
|
#define OCSP_F_ASN1_STRING_ENCODE 106
|
|
|
|
#define OCSP_F_BASIC_RESPONSE_NEW 100
|
|
|
|
#define OCSP_F_BASIC_RESPONSE_VERIFY 101
|
|
|
|
#define OCSP_F_CERT_ID_NEW 102
|
|
|
|
#define OCSP_F_CERT_STATUS_NEW 103
|
2000-12-15 07:27:20 +08:00
|
|
|
#define OCSP_F_D2I_OCSP_NONCE 109
|
2001-01-11 08:52:50 +08:00
|
|
|
#define OCSP_F_OCSP_BASIC_VERIFY 113
|
2001-01-18 09:35:39 +08:00
|
|
|
#define OCSP_F_OCSP_CHECK_DELEGATED 117
|
|
|
|
#define OCSP_F_OCSP_CHECK_IDS 114
|
|
|
|
#define OCSP_F_OCSP_CHECK_ISSUER 115
|
2001-01-08 09:21:55 +08:00
|
|
|
#define OCSP_F_OCSP_CHECK_NONCE 112
|
2001-01-18 09:35:39 +08:00
|
|
|
#define OCSP_F_OCSP_MATCH_ISSUERID 116
|
2001-01-08 09:21:55 +08:00
|
|
|
#define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111
|
2001-01-04 09:46:36 +08:00
|
|
|
#define OCSP_F_OCSP_SENDREQ_BIO 110
|
2000-10-27 19:05:35 +08:00
|
|
|
#define OCSP_F_REQUEST_VERIFY 104
|
|
|
|
#define OCSP_F_RESPONSE_VERIFY 105
|
|
|
|
#define OCSP_F_S2I_OCSP_NONCE 107
|
|
|
|
#define OCSP_F_V2I_OCSP_CRLID 108
|
|
|
|
|
|
|
|
/* Reason codes. */
|
|
|
|
#define OCSP_R_BAD_DATA 108
|
|
|
|
#define OCSP_R_BAD_TAG 100
|
2001-01-17 09:31:34 +08:00
|
|
|
#define OCSP_R_CERTIFICATE_VERIFY_ERROR 126
|
2000-10-27 19:05:35 +08:00
|
|
|
#define OCSP_R_DIGEST_ERR 101
|
|
|
|
#define OCSP_R_FAILED_TO_OPEN 109
|
|
|
|
#define OCSP_R_FAILED_TO_READ 110
|
|
|
|
#define OCSP_R_FAILED_TO_STAT 111
|
2001-01-18 09:35:39 +08:00
|
|
|
#define OCSP_R_MISSING_OCSPSIGNING_USAGE 131
|
2000-10-27 19:05:35 +08:00
|
|
|
#define OCSP_R_MISSING_VALUE 112
|
2001-01-08 09:21:55 +08:00
|
|
|
#define OCSP_R_NONCE_MISSING_IN_RESPONSE 121
|
|
|
|
#define OCSP_R_NONCE_VALUE_MISMATCH 122
|
|
|
|
#define OCSP_R_NOT_BASIC_RESPONSE 120
|
2000-10-27 19:05:35 +08:00
|
|
|
#define OCSP_R_NO_CERTIFICATE 102
|
2001-01-18 09:35:39 +08:00
|
|
|
#define OCSP_R_NO_CERTIFICATES_IN_CHAIN 128
|
2001-01-04 09:46:36 +08:00
|
|
|
#define OCSP_R_NO_CONTENT 115
|
2000-10-27 19:05:35 +08:00
|
|
|
#define OCSP_R_NO_PUBLIC_KEY 103
|
|
|
|
#define OCSP_R_NO_RESPONSE_DATA 104
|
|
|
|
#define OCSP_R_NO_SIGNATURE 105
|
2001-01-18 09:35:39 +08:00
|
|
|
#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 129
|
2000-10-27 19:05:35 +08:00
|
|
|
#define OCSP_R_REVOKED_NO_TIME 106
|
2001-01-17 09:31:34 +08:00
|
|
|
#define OCSP_R_ROOT_CA_NOT_TRUSTED 127
|
2001-01-04 09:46:36 +08:00
|
|
|
#define OCSP_R_SERVER_READ_ERROR 116
|
|
|
|
#define OCSP_R_SERVER_RESPONSE_ERROR 117
|
|
|
|
#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 118
|
|
|
|
#define OCSP_R_SERVER_WRITE_ERROR 119
|
2001-01-11 08:52:50 +08:00
|
|
|
#define OCSP_R_SIGNATURE_FAILURE 124
|
|
|
|
#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 125
|
2001-01-08 09:21:55 +08:00
|
|
|
#define OCSP_R_UNEXPECTED_NONCE_IN_RESPONSE 123
|
2001-01-18 09:35:39 +08:00
|
|
|
#define OCSP_R_UNKNOWN_MESSAGE_DIGEST 130
|
2000-10-27 19:05:35 +08:00
|
|
|
#define OCSP_R_UNKNOWN_NID 107
|
|
|
|
#define OCSP_R_UNSUPPORTED_OPTION 113
|
|
|
|
#define OCSP_R_VALUE_ALREADY 114
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|