Blame nss/lib/libpkix/include/pkix_certstore.h

Packit 40b132
/* This Source Code Form is subject to the terms of the Mozilla Public
Packit 40b132
 * License, v. 2.0. If a copy of the MPL was not distributed with this
Packit 40b132
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Packit 40b132
/*
Packit 40b132
 * This file defines functions associated with the PKIX_CertStore type.
Packit 40b132
 *
Packit 40b132
 */
Packit 40b132
Packit 40b132
#ifndef _PKIX_CERTSTORE_H
Packit 40b132
#define _PKIX_CERTSTORE_H
Packit 40b132
Packit 40b132
#include "pkixt.h"
Packit 40b132
Packit 40b132
#ifdef __cplusplus
Packit 40b132
extern "C" {
Packit 40b132
#endif
Packit 40b132
Packit 40b132
/* General
Packit 40b132
 *
Packit 40b132
 * Please refer to the libpkix Programmer's Guide for detailed information
Packit 40b132
 * about how to use the libpkix library. Certain key warnings and notices from
Packit 40b132
 * that document are repeated here for emphasis.
Packit 40b132
 *
Packit 40b132
 * All identifiers in this file (and all public identifiers defined in
Packit 40b132
 * libpkix) begin with "PKIX_". Private identifiers only intended for use
Packit 40b132
 * within the library begin with "pkix_".
Packit 40b132
 *
Packit 40b132
 * A function returns NULL upon success, and a PKIX_Error pointer upon failure.
Packit 40b132
 *
Packit 40b132
 * Unless otherwise noted, for all accessor (gettor) functions that return a
Packit 40b132
 * PKIX_PL_Object pointer, callers should assume that this pointer refers to a
Packit 40b132
 * shared object. Therefore, the caller should treat this shared object as
Packit 40b132
 * read-only and should not modify this shared object. When done using the
Packit 40b132
 * shared object, the caller should release the reference to the object by
Packit 40b132
 * using the PKIX_PL_Object_DecRef function.
Packit 40b132
 *
Packit 40b132
 * While a function is executing, if its arguments (or anything referred to by
Packit 40b132
 * its arguments) are modified, free'd, or destroyed, the function's behavior
Packit 40b132
 * is undefined.
Packit 40b132
 *
Packit 40b132
 */
Packit 40b132
Packit 40b132
/* PKIX_CertStore
Packit 40b132
 *
Packit 40b132
 * A PKIX_CertStore provides a standard way for the caller to retrieve
Packit 40b132
 * certificates and CRLs from a particular repository (or "store") of
Packit 40b132
 * certificates and CRLs, including LDAP directories, flat files, local
Packit 40b132
 * databases, etc. The CertCallback allows custom certificate retrieval logic
Packit 40b132
 * to be used while the CRLCallback allows custom CRL retrieval logic to be
Packit 40b132
 * used. Additionally, a CertStore can be initialized with a certStoreContext,
Packit 40b132
 * which is where the caller can specify configuration data such as the host
Packit 40b132
 * name of an LDAP server. Note that this certStoreContext must be an
Packit 40b132
 * Object (although any object type), allowing it to be reference-counted and
Packit 40b132
 * allowing it to provide the standard Object functions (Equals, Hashcode,
Packit 40b132
 * ToString, Compare, Duplicate). Please note that each certStoreContext must
Packit 40b132
 * provide Equals and Hashcode functions in order for the caching (on Cert and
Packit 40b132
 * CertChain) to work correctly. When providing those two functions, it is not
Packit 40b132
 * required that all the components of the object be hashed or checked for 
Packit 40b132
 * equality, but merely that the functions distinguish between unique
Packit 40b132
 * instances of the certStoreContext.
Packit 40b132
 *
Packit 40b132
 * Once the caller has created the CertStore object, the caller then specifies
Packit 40b132
 * these CertStore objects in a ProcessingParams object and passes that object
Packit 40b132
 * to PKIX_ValidateChain or PKIX_BuildChain, which uses the objects to call the
Packit 40b132
 * user's callback functions as needed during the validation or building
Packit 40b132
 * process.
Packit 40b132
 *
Packit 40b132
 * The order of CertStores stored (as a list) at ProcessingParams determines
Packit 40b132
 * the order in which certificates are retrieved. Trusted CertStores should
Packit 40b132
 * precede non-trusted ones on the list of CertStores so their certificates
Packit 40b132
 * are evaluated ahead of other certificates selected on the basis of the same
Packit 40b132
 * selector criteria.
Packit 40b132
 *
Packit 40b132
 * The CheckTrustCallback function is used when the CertStore object
Packit 40b132
 * supports trust status, which means a Cert's trust status can be altered
Packit 40b132
 * dynamically. When a CertStore object is created, if the
Packit 40b132
 * CheckTrustCallback is initialized to be non-NULL, this CertStore is
Packit 40b132
 * defaulted as supporting trust. Then whenever a Cert needs to (re)check its
Packit 40b132
 * trust status, this callback can be invoked. When a Cert is retrieved by
Packit 40b132
 * a CertStore supports trust, at its GetCertCallback, the CertStore
Packit 40b132
 * information should be updated in Cert's data structure so the link between
Packit 40b132
 * the Cert and CertStore exists.
Packit 40b132
 *
Packit 40b132
 */
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_CertCallback
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  This callback function retrieves from the CertStore pointed to by "store"
Packit 40b132
 *  all the certificates that match the CertSelector pointed to by "selector".
Packit 40b132
 *  It places these certificates in a List and stores a pointer to the List at
Packit 40b132
 *  "pCerts". If no certificates are found which match the CertSelector's
Packit 40b132
 *  criteria, this function stores an empty List at "pCerts". In either case, if
Packit 40b132
 *  the operation is completed, NULL is stored at "pNBIOContext".
Packit 40b132
 *
Packit 40b132
 *  A CertStore which uses non-blocking I/O may store platform-dependent
Packit 40b132
 *  information at "pNBIOContext" and NULL at "pCerts" to indicate that I/O is
Packit 40b132
 *  pending. A subsequent call to PKIX_CertStore_CertContinue is required to
Packit 40b132
 *  finish the operation and to obtain the List of Certs.
Packit 40b132
 *
Packit 40b132
 *  Note that the List returned by this function is immutable.
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      Address of CertStore from which Certs are to be retrieved.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "selector"
Packit 40b132
 *      Address of CertSelector whose criteria must be satisfied.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "verifyNode"
Packit 40b132
 *      Parent log node for tracking of filtered out certs.
Packit 40b132
 *  "pNBIOContext"
Packit 40b132
 *      Address at which platform-dependent information is stored if the
Packit 40b132
 *      operation is suspended for non-blocking I/O. Must be non-NULL.
Packit 40b132
 *  "pCerts"
Packit 40b132
 *      Address where object pointer will be stored. Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe
Packit 40b132
 *
Packit 40b132
 *  Multiple threads must be able to safely call this function without
Packit 40b132
 *  worrying about conflicts, even if they're operating on the same object.
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a CertStore Error if the function fails in a non-fatal way.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
typedef PKIX_Error *
Packit 40b132
(*PKIX_CertStore_CertCallback)(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CertSelector *selector,
Packit 40b132
        PKIX_VerifyNode *verifyNode,
Packit 40b132
        void **pNBIOContext,
Packit 40b132
        PKIX_List **pCerts,  /* list of PKIX_PL_Cert */
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_CertContinue
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  This function continues the non-blocking operation initiated by an earlier
Packit 40b132
 *  call to the CertCallback function, for the CertStore pointed to by "store". 
Packit 40b132
 *  If an earlier call did not terminate with the WOULDBLOCK indication (non-NULL
Packit 40b132
 *  value returned in "pNBIOContext") calling this function will return a fatal
Packit 40b132
 *  error. If the operation is completed the certificates found are placed in a
Packit 40b132
 *  List, a pointer to which is stored at "pCerts". If no certificates are found
Packit 40b132
 *  which match the CertSelector's criteria, this function stores an empty List
Packit 40b132
 *  at "pCerts". In either case, if the operation is completed, NULL is stored
Packit 40b132
 *  at "pNBIOContext".
Packit 40b132
 *
Packit 40b132
 *  If non-blocking I/O is still pending this function stores platform-dependent
Packit 40b132
 *  information at "pNBIOContext" and NULL at "pCerts". A subsequent call to
Packit 40b132
 *  PKIX_CertStore_CertContinue is required to finish the operation and to
Packit 40b132
 *  obtain the List of Certs.
Packit 40b132
 *
Packit 40b132
 *  Note that the List returned by this function is immutable.
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      Address of CertStore from which Certs are to be retrieved.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "selector"
Packit 40b132
 *      Address of CertSelector whose criteria must be satisfied.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "verifyNode"
Packit 40b132
 *      Parent log node for tracking of filtered out certs.
Packit 40b132
 *  "pNBIOContext"
Packit 40b132
 *      Address at which platform-dependent information is stored if the
Packit 40b132
 *      operation is suspended for non-blocking I/O. Must be non-NULL.
Packit 40b132
 *  "pCerts"
Packit 40b132
 *      Address where object pointer will be stored. Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe
Packit 40b132
 *
Packit 40b132
 *  Multiple threads must be able to safely call this function without
Packit 40b132
 *  worrying about conflicts, even if they're operating on the same object.
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a CertStore Error if the function fails in a non-fatal way.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_CertContinue(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CertSelector *selector,
Packit 40b132
        PKIX_VerifyNode *verifyNode,
Packit 40b132
        void **pNBIOContext,
Packit 40b132
        PKIX_List **pCerts,  /* list of PKIX_PL_Cert */
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
typedef PKIX_Error *
Packit 40b132
(*PKIX_CertStore_CertContinueFunction)(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CertSelector *selector,
Packit 40b132
        PKIX_VerifyNode *verifyNode,
Packit 40b132
        void **pNBIOContext,
Packit 40b132
        PKIX_List **pCerts,  /* list of PKIX_PL_Cert */
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_CRLCallback
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  This callback function retrieves from the CertStore pointed to by "store"
Packit 40b132
 *  all the CRLs that match the CRLSelector pointed to by "selector". It
Packit 40b132
 *  places these CRLs in a List and stores a pointer to the List at "pCRLs".
Packit 40b132
 *  If no CRLs are found which match the CRLSelector's criteria, this function
Packit 40b132
 *  stores an empty List at "pCRLs". In either case, if the operation is
Packit 40b132
 *  completed, NULL is stored at "pNBIOContext".
Packit 40b132
 *
Packit 40b132
 *  A CertStore which uses non-blocking I/O may store platform-dependent
Packit 40b132
 *  information at "pNBIOContext" and NULL at "pCrls" to indicate that I/O is
Packit 40b132
 *  pending. A subsequent call to PKIX_CertStore_CRLContinue is required to
Packit 40b132
 *  finish the operation and to obtain the List of Crls.
Packit 40b132
 *
Packit 40b132
 *  Note that the List returned by this function is immutable.
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      Address of CertStore from which CRLs are to be retrieved.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "selector"
Packit 40b132
 *      Address of CRLSelector whose criteria must be satisfied.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "pCrls"
Packit 40b132
 *      Address where object pointer will be stored. Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe
Packit 40b132
 *
Packit 40b132
 *  Multiple threads must be able to safely call this function without
Packit 40b132
 *  worrying about conflicts, even if they're operating on the same object.
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a CertStore Error if the function fails in a non-fatal way.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
typedef PKIX_Error *
Packit 40b132
(*PKIX_CertStore_CRLCallback)(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CRLSelector *selector,
Packit 40b132
        void **pNBIOContext,
Packit 40b132
        PKIX_List **pCrls,  /* list of PKIX_PL_CRL */
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_ImportCrlCallback
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 * The function imports crl list into a cert store. Stores that
Packit 40b132
 * have local cache may only have that function defined.
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      Address of CertStore from which CRLs are to be retrieved.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "issuerName"
Packit 40b132
 *      Name of the issuer that will be used to track bad der crls.
Packit 40b132
 *  "crlList"
Packit 40b132
 *      Address on the importing crl list.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe
Packit 40b132
 *
Packit 40b132
 *  Multiple threads must be able to safely call this function without
Packit 40b132
 *  worrying about conflicts, even if they're operating on the same object.
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a CertStore Error if the function fails in a non-fatal way.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
typedef PKIX_Error *
Packit 40b132
(*PKIX_CertStore_ImportCrlCallback)(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_PL_X500Name *issuerName,
Packit 40b132
        PKIX_List *crlList,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_CheckRevokationByCrlCallback
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 * The function checks revocation status of a cert with specified
Packit 40b132
 * issuer, date. It returns revocation status of a cert and
Packit 40b132
 * a reason code(if any) if a cert was revoked.
Packit 40b132
 * 
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      Address of CertStore from which CRLs are to be retrieved.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "cert"
Packit 40b132
 *      Certificate which revocation status will be checked.
Packit 40b132
 *  "issuer"
Packit 40b132
 *      Issuer certificate of the "crl".
Packit 40b132
 *  "date"
Packit 40b132
 *      Date of the revocation check.
Packit 40b132
 *  "crlDownloadDone"
Packit 40b132
 *      Indicates, that all needed crl downloads are done by the time of
Packit 40b132
 *      the revocation check.
Packit 40b132
 *  "reasonCode"
Packit 40b132
 *      If cert is revoked, returned reason code for  which a cert was revoked.
Packit 40b132
 *  "revStatus"
Packit 40b132
 *      Returned revocation status of the cert. See PKIX_RevocationStatus
Packit 40b132
 *      for more details
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe
Packit 40b132
 *
Packit 40b132
 *  Multiple threads must be able to safely call this function without
Packit 40b132
 *  worrying about conflicts, even if they're operating on the same object.
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a CertStore Error if the function fails in a non-fatal way.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
typedef PKIX_Error *
Packit 40b132
(*PKIX_CertStore_CheckRevokationByCrlCallback)(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_PL_Cert *cert,
Packit 40b132
        PKIX_PL_Cert *issuer,
Packit 40b132
        PKIX_PL_Date *date,
Packit 40b132
        PKIX_Boolean  crlDownloadDone,
Packit 40b132
        PKIX_UInt32 *reasonCode,
Packit 40b132
        PKIX_RevocationStatus *revStatus,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_CrlContinue
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  This function continues the non-blocking operation initiated by an earlier
Packit 40b132
 *  call to the CRLCallback function, for the CertStore pointed to by "store". 
Packit 40b132
 *  If an earlier call did not terminate with the WOULDBLOCK indication (non-NULL
Packit 40b132
 *  value returned in "pNBIOContext") calling this function will return a fatal
Packit 40b132
 *  error. If the operation is completed the crls found are placed in a List, a
Packit 40b132
 *  pointer to which is stored at "pCrls". If no crls are found which match the
Packit 40b132
 *  CRLSelector's criteria, this function stores an empty List at "pCrls". In
Packit 40b132
 *  either case, if the operation is completed, NULL is stored at "pNBIOContext".
Packit 40b132
 *
Packit 40b132
 *  If non-blocking I/O is still pending this function stores platform-dependent
Packit 40b132
 *  information at "pNBIOContext" and NULL at "pCrls". A subsequent call to
Packit 40b132
 *  PKIX_CertStore_CrlContinue is required to finish the operation and to
Packit 40b132
 *  obtain the List of Crls.
Packit 40b132
 *
Packit 40b132
 *  Note that the List returned by this function is immutable.
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      Address of CertStore from which Crls are to be retrieved.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "selector"
Packit 40b132
 *      Address of CRLSelector whose criteria must be satisfied.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "pNBIOContext"
Packit 40b132
 *      Address at which platform-dependent information is stored if the
Packit 40b132
 *      operation is suspended for non-blocking I/O. Must be non-NULL.
Packit 40b132
 *  "pCrls"
Packit 40b132
 *      Address where object pointer will be stored. Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe
Packit 40b132
 *
Packit 40b132
 *  Multiple threads must be able to safely call this function without
Packit 40b132
 *  worrying about conflicts, even if they're operating on the same object.
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a CertStore Error if the function fails in a non-fatal way.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_CrlContinue(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CRLSelector *selector,
Packit 40b132
        void **pNBIOContext,
Packit 40b132
        PKIX_List **pCrls,  /* list of PKIX_PL_CRL */
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
typedef PKIX_Error *
Packit 40b132
(*PKIX_CertStore_CrlContinueFunction)(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CRLSelector *selector,
Packit 40b132
        void **pNBIOContext,
Packit 40b132
        PKIX_List **pCrls,  /* list of PKIX_PL_CRL */
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_CheckTrustCallback
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  This callback function rechecks "cert's" trust status from the CertStore
Packit 40b132
 *  pointed to by "store".
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      Address of CertStore from which Certs are to be checked.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "cert"
Packit 40b132
 *      Address of Cert whose trust status needs to be rechecked.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "pTrusted"
Packit 40b132
 *      Address of PKIX_Boolean where the trust status is returned.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe
Packit 40b132
 *
Packit 40b132
 *  Multiple threads must be able to safely call this function without
Packit 40b132
 *  worrying about conflicts, even if they're operating on the same object.
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a CertStore Error if the function fails in a non-fatal way.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
typedef PKIX_Error *
Packit 40b132
(*PKIX_CertStore_CheckTrustCallback)(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_PL_Cert *cert,
Packit 40b132
        PKIX_Boolean *pTrusted,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_Create
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  Creates a new CertStore and stores it at "pStore". The new CertStore uses
Packit 40b132
 *  the CertCallback pointed to by "certCallback" and the CRLCallback pointed
Packit 40b132
 *  to by "crlCallback" as its callback functions and uses the Object pointed
Packit 40b132
 *  to by "certStoreContext" as its context . Note that this certStoreContext
Packit 40b132
 *  must be an Object (although any object type), allowing it to be
Packit 40b132
 *  reference-counted and allowing it to provide the standard Object functions
Packit 40b132
 *  (Equals, Hashcode, ToString, Compare, Duplicate). Once created, a
Packit 40b132
 *  CertStore object is immutable, although the underlying repository can
Packit 40b132
 *  change. For example, a CertStore will often be a front-end for a database
Packit 40b132
 *  or directory. The contents of that directory can change after the
Packit 40b132
 *  CertStore object is created, but the CertStore object remains immutable.
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "certCallback"
Packit 40b132
 *      The CertCallback function to be used. Must be non-NULL.
Packit 40b132
 *  "crlCallback"
Packit 40b132
 *      The CRLCallback function to be used. Must be non-NULL.
Packit 40b132
 *  "certContinue"
Packit 40b132
 *      The function to be used to resume a certCallback that returned with a
Packit 40b132
 *      WOULDBLOCK condition. Must be non-NULL if certStore supports non-blocking
Packit 40b132
 *      I/O.
Packit 40b132
 *  "crlContinue"
Packit 40b132
 *      The function to be used to resume a crlCallback that returned with a
Packit 40b132
 *      WOULDBLOCK condition. Must be non-NULL if certStore supports non-blocking
Packit 40b132
 *      I/O.
Packit 40b132
 *  "trustCallback"
Packit 40b132
 *      Address of PKIX_CertStore_CheckTrustCallback which is called to
Packit 40b132
 *      verify the trust status of Certs in this CertStore.
Packit 40b132
 *  "certStoreContext"
Packit 40b132
 *      Address of Object representing the CertStore's context (if any).
Packit 40b132
 *  "cachedFlag"
Packit 40b132
 *      If TRUE indicates data retrieved from CertStore should be cached.
Packit 40b132
 *  "localFlag"
Packit 40b132
 *      Boolean value indicating whether this CertStore is local.
Packit 40b132
 *  "pStore"
Packit 40b132
 *      Address where object pointer will be stored. Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a CertStore Error if the function fails in a non-fatal way.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_Create(
Packit 40b132
        PKIX_CertStore_CertCallback certCallback,
Packit 40b132
        PKIX_CertStore_CRLCallback crlCallback,
Packit 40b132
        PKIX_CertStore_CertContinueFunction certContinue,
Packit 40b132
        PKIX_CertStore_CrlContinueFunction crlContinue,
Packit 40b132
        PKIX_CertStore_CheckTrustCallback trustCallback,
Packit 40b132
        PKIX_CertStore_ImportCrlCallback importCrlCallback,
Packit 40b132
        PKIX_CertStore_CheckRevokationByCrlCallback checkRevByCrlCallback,
Packit 40b132
        PKIX_PL_Object *certStoreContext,
Packit 40b132
        PKIX_Boolean cachedFlag,
Packit 40b132
        PKIX_Boolean localFlag,
Packit 40b132
        PKIX_CertStore **pStore,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_GetCertCallback
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  Retrieves a pointer to "store's" Cert callback function and put it in
Packit 40b132
 *  "pCallback".
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      The CertStore whose Cert callback is desired. Must be non-NULL.
Packit 40b132
 *  "pCallback"
Packit 40b132
 *      Address where Cert callback function pointer will be stored.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_GetCertCallback(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CertStore_CertCallback *pCallback,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_GetCRLCallback
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  Retrieves a pointer to "store's" CRL callback function and put it in
Packit 40b132
 *  "pCallback".
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      The CertStore whose CRL callback is desired. Must be non-NULL.
Packit 40b132
 *  "pCallback"
Packit 40b132
 *      Address where CRL callback function pointer will be stored.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_GetCRLCallback(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CertStore_CRLCallback *pCallback,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_GetImportCrlCallback
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  Retrieves a pointer to "store's" Import CRL callback function and put it in
Packit 40b132
 *  "pCallback".
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      The CertStore whose CRL callback is desired. Must be non-NULL.
Packit 40b132
 *  "pCallback"
Packit 40b132
 *      Address where CRL callback function pointer will be stored.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_GetImportCrlCallback(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CertStore_ImportCrlCallback *pCallback,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_GetCheckRevByCrl
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  Retrieves a pointer to "store's" CRL revocation checker callback function
Packit 40b132
 *  and put it in "pCallback".
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      The CertStore whose CRL callback is desired. Must be non-NULL.
Packit 40b132
 *  "pCallback"
Packit 40b132
 *      Address where CRL callback function pointer will be stored.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_GetCrlCheckerFn(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CertStore_CheckRevokationByCrlCallback *pCallback,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_GetTrustCallback
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  Retrieves the function pointer to the CheckTrust callback function of the
Packit 40b132
 *  CertStore pointed to by "store" and stores it at "pCallback".
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      The CertStore whose CheckTrust callback is desired. Must be non-NULL.
Packit 40b132
 *  "pCallback"
Packit 40b132
 *      Address where CheckTrust callback function pointer will be stored.
Packit 40b132
 *      Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_GetTrustCallback(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_CertStore_CheckTrustCallback *pCallback,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_GetCertStoreContext
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  Retrieves a pointer to the Object representing the context (if any)
Packit 40b132
 *  of the CertStore pointed to by "store" and stores it at
Packit 40b132
 *  "pCertStoreContext".
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      Address of CertStore whose context is to be stored. Must be non-NULL.
Packit 40b132
 *  "pCertStoreContext"
Packit 40b132
 *      Address where object pointer will be stored. Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_GetCertStoreContext(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_PL_Object **pCertStoreContext,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_GetCertStoreCacheFlag
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  Retrieves the Boolean cache flag of the CertStore pointed to by "store" and
Packit 40b132
 *  stores it at "pCachedFlag".
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      Address of CertStore whose cache flag is to be stored. Must be non-NULL.
Packit 40b132
 *  "pCacheFlag"
Packit 40b132
 *      Address where the result will be stored. Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_GetCertStoreCacheFlag(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_Boolean *pCacheFlag,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
/*
Packit 40b132
 * FUNCTION: PKIX_CertStore_GetLocalFlag
Packit 40b132
 * DESCRIPTION:
Packit 40b132
 *
Packit 40b132
 *  Retrieves the Boolean localFlag for the CertStore pointed to by "store" and
Packit 40b132
 *  stores it at "pLocalFlag". The localFlag is TRUE if the CertStore can
Packit 40b132
 *  fulfill a request without performing network I/O.
Packit 40b132
 *
Packit 40b132
 * PARAMETERS:
Packit 40b132
 *  "store"
Packit 40b132
 *      The CertStore whose Local flag is desired. Must be non-NULL.
Packit 40b132
 *  "pCallback"
Packit 40b132
 *      Address where the Boolean LocalFlag will be stored. Must be non-NULL.
Packit 40b132
 *  "plContext"
Packit 40b132
 *      Platform-specific context pointer.
Packit 40b132
 * THREAD SAFETY:
Packit 40b132
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
Packit 40b132
 * RETURNS:
Packit 40b132
 *  Returns NULL if the function succeeds.
Packit 40b132
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
Packit 40b132
 */
Packit 40b132
PKIX_Error *
Packit 40b132
PKIX_CertStore_GetLocalFlag(
Packit 40b132
        PKIX_CertStore *store,
Packit 40b132
        PKIX_Boolean *pLocalFlag,
Packit 40b132
        void *plContext);
Packit 40b132
Packit 40b132
#ifdef __cplusplus
Packit 40b132
}
Packit 40b132
#endif
Packit 40b132
Packit 40b132
#endif /* _PKIX_CERTSTORE_H */