ocspti.h
来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C头文件 代码 · 共 399 行 · 第 1/2 页
H
399 行
* The corresponding ASN.1 definition is: * * 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 * } */typedef enum { ocspResponse_successful = 0, ocspResponse_malformedRequest = 1, ocspResponse_internalError = 2, ocspResponse_tryLater = 3, ocspResponse_unused = 4, ocspResponse_sigRequired = 5, ocspResponse_unauthorized = 6, ocspResponse_other /* unknown/unrecognized value */} ocspResponseStatus;/* * An OCSPResponse is what is sent (encoded) by an OCSP responder. * * The field "responseStatus" is the ASN.1 encoded value; the field * "statusValue" is simply that same value translated into our local * type ocspResponseStatus. */struct CERTOCSPResponseStr { PRArenaPool *arena; /* local; not part of encoding */ SECItem responseStatus; /* an ENUMERATED, see above */ ocspResponseStatus statusValue; /* local; not part of encoding */ ocspResponseBytes *responseBytes; /* only when status is successful */};/* * A ResponseBytes (despite appearances) is what contains the meat * of a successful response -- but still in encoded form. The type * given as "responseType" tells you how to decode the string. * * We look at the OID and translate it into our local OID representation * "responseTypeTag", and use that value to tell us how to decode the * actual response itself. For now the only kind of OCSP response we * know about is a BasicOCSPResponse. However, the intention in the * OCSP specification is to allow for other response types, so we are * building in that flexibility from the start and thus put a pointer * to that data structure inside of a union. Whenever OCSP adds more * response types, just add them to the union. */struct ocspResponseBytesStr { SECItem responseType; /* an OBJECT IDENTIFIER */ SECOidTag responseTypeTag; /* local; not part of encoding */ SECItem response; /* an OCTET STRING */ union { ocspBasicOCSPResponse *basic; /* when type is id-pkix-ocsp-basic */ } decodedResponse; /* local; not part of encoding */};/* * A BasicOCSPResponse -- when the responseType in a ResponseBytes is * id-pkix-ocsp-basic, the "response" OCTET STRING above is the DER * encoding of one of these. * * Note that in the OCSP specification, the signature fields are not * part of a separate sub-structure. But since they are the same fields * as we define for the signature in a request, it made sense to share * the C data structure here and in some shared code to operate on them. */struct ocspBasicOCSPResponseStr { ocspResponseData *tbsResponseData; /* "tbs" == To Be Signed */ ocspSignature responseSignature;};/* * A ResponseData is the part of a BasicOCSPResponse that is signed * (after it is DER encoded). It contains the real details of the response * (a per-certificate status). */struct ocspResponseDataStr { SECItem version; /* an INTEGER */ SECItem derResponderID; ocspResponderID *responderID; /* local; not part of encoding */ SECItem producedAt; /* a GeneralizedTime */ CERTOCSPSingleResponse **responses; CERTCertExtension **responseExtensions;};/* * A ResponderID identifies the responder -- or more correctly, the * signer of the response. The ASN.1 definition of a ResponderID is: * * ResponderID ::= CHOICE { * byName [1] EXPLICIT Name, * byKey [2] EXPLICIT KeyHash } * * Because it is CHOICE, the type of identification used and the * identification itself are actually encoded together. To represent * this same information internally, we explicitly define a type and * save it, along with the value, into a data structure. */typedef enum { ocspResponderID_byName, ocspResponderID_byKey, ocspResponderID_other /* unknown kind of responderID */} ocspResponderIDType;struct ocspResponderIDStr { ocspResponderIDType responderIDType;/* local; not part of encoding */ union { CERTName name; /* when ocspResponderID_byName */ SECItem keyHash; /* when ocspResponderID_byKey */ SECItem other; /* when ocspResponderID_other */ } responderIDValue;};/* * The ResponseData in a BasicOCSPResponse contains a SEQUENCE OF * SingleResponse -- one for each certificate whose status is being supplied. * * XXX figure out how to get rid of that arena -- there must be a way */struct CERTOCSPSingleResponseStr { PRArenaPool *arena; /* just a copy of the response arena, * needed here for extension handling * routines, on creation only */ CERTOCSPCertID *certID; SECItem derCertStatus; ocspCertStatus *certStatus; /* local; not part of encoding */ SECItem thisUpdate; /* a GeneralizedTime */ SECItem *nextUpdate; /* a GeneralizedTime */ CERTCertExtension **singleExtensions;};/* * A CertStatus is the actual per-certificate status. Its ASN.1 definition: * * CertStatus ::= CHOICE { * good [0] IMPLICIT NULL, * revoked [1] IMPLICIT RevokedInfo, * unknown [2] IMPLICIT UnknownInfo } * * (where for now UnknownInfo is defined to be NULL but in the * future may be replaced with an enumeration). * * Because it is CHOICE, the status value and its associated information * (if any) are actually encoded together. To represent this same * information internally, we explicitly define a type and save it, * along with the value, into a data structure. */typedef enum { ocspCertStatus_good, /* cert is not revoked */ ocspCertStatus_revoked, /* cert is revoked */ ocspCertStatus_unknown, /* cert was unknown to the responder */ ocspCertStatus_other /* status was not an expected value */} ocspCertStatusType;/* * This is the actual per-certificate status. * * The "goodInfo" and "unknownInfo" items are only place-holders for a NULL. * (Though someday OCSP may replace UnknownInfo with an enumeration that * gives more detailed information.) */struct ocspCertStatusStr { ocspCertStatusType certStatusType; /* local; not part of encoding */ union { SECItem *goodInfo; /* when ocspCertStatus_good */ ocspRevokedInfo *revokedInfo; /* when ocspCertStatus_revoked */ SECItem *unknownInfo; /* when ocspCertStatus_unknown */ SECItem *otherInfo; /* when ocspCertStatus_other */ } certStatusInfo; };/* * A RevokedInfo gives information about a revoked certificate -- when it * was revoked and why. */struct ocspRevokedInfoStr { SECItem revocationTime; /* a GeneralizedTime */ SECItem *revocationReason; /* a CRLReason; ignored for now */};/* * ServiceLocator can be included as one of the singleRequestExtensions. * When added, it specifies the (name of the) issuer of the cert being * checked, and optionally the value of the AuthorityInfoAccess extension * if the cert has one. */struct ocspServiceLocatorStr { CERTName *issuer; SECItem locator; /* DER encoded authInfoAccess extension from cert */};#endif /* _OCSPTI_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?