Back to index

lightning-sunbird  0.9+nobinonly
pkitm.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Netscape security libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 #ifndef PKITM_H
00038 #define PKITM_H
00039 
00040 #ifdef DEBUG
00041 static const char PKITM_CVS_ID[] = "@(#) $RCSfile: pkitm.h,v $ $Revision: 1.14 $ $Date: 2005/06/28 17:55:29 $";
00042 #endif /* DEBUG */
00043 
00044 /*
00045  * pkitm.h
00046  *
00047  * This file contains PKI-module specific types.
00048  */
00049 
00050 #ifndef BASET_H
00051 #include "baset.h"
00052 #endif /* BASET_H */
00053 
00054 #ifndef PKIT_H
00055 #include "pkit.h"
00056 #endif /* PKIT_H */
00057 
00058 PR_BEGIN_EXTERN_C
00059 
00060 typedef enum nssCertIDMatchEnum {
00061   nssCertIDMatch_Yes = 0,
00062   nssCertIDMatch_No = 1,
00063   nssCertIDMatch_Unknown = 2
00064 } nssCertIDMatch;
00065 
00066 /*
00067  * nssDecodedCert
00068  *
00069  * This is an interface to allow the PKI module access to certificate
00070  * information that can only be found by decoding.  The interface is
00071  * generic, allowing each certificate type its own way of providing
00072  * the information
00073  */
00074 struct nssDecodedCertStr {
00075     NSSCertificateType type;
00076     void *data;
00077     /* returns the unique identifier for the cert */
00078     NSSItem *  (*getIdentifier)(nssDecodedCert *dc);
00079     /* returns the unique identifier for this cert's issuer */
00080     void *     (*getIssuerIdentifier)(nssDecodedCert *dc);
00081     /* is id the identifier for this cert? */
00082     nssCertIDMatch (*matchIdentifier)(nssDecodedCert *dc, void *id);
00083     /* is this cert a valid CA cert? */
00084     PRBool     (*isValidIssuer)(nssDecodedCert *dc);
00085     /* returns the cert usage */
00086     NSSUsage * (*getUsage)(nssDecodedCert *dc);
00087     /* is time within the validity period of the cert? */
00088     PRBool     (*isValidAtTime)(nssDecodedCert *dc, NSSTime *time);
00089     /* is the validity period of this cert newer than cmpdc? */
00090     PRBool     (*isNewerThan)(nssDecodedCert *dc, nssDecodedCert *cmpdc);
00091     /* does the usage for this cert match the requested usage? */
00092     PRBool     (*matchUsage)(nssDecodedCert *dc, const NSSUsage *usage);
00093     /* extract the email address */
00094     NSSASCII7 *(*getEmailAddress)(nssDecodedCert *dc);
00095     /* extract the DER-encoded serial number */
00096     PRStatus   (*getDERSerialNumber)(nssDecodedCert *dc,
00097                                      NSSDER *derSerial, NSSArena *arena);
00098 };
00099 
00100 struct NSSUsageStr {
00101     PRBool anyUsage;
00102 #ifdef NSS_3_4_CODE
00103     SECCertUsage nss3usage;
00104     PRBool nss3lookingForCA;
00105 #endif
00106 };
00107 
00108 typedef struct nssPKIObjectCollectionStr nssPKIObjectCollection;
00109 
00110 typedef struct
00111 {
00112   union {
00113     PRStatus (*  cert)(NSSCertificate *c, void *arg);
00114     PRStatus (*   crl)(NSSCRL       *crl, void *arg);
00115     PRStatus (* pvkey)(NSSPrivateKey *vk, void *arg);
00116     PRStatus (* pbkey)(NSSPublicKey *bk, void *arg);
00117   } func;
00118   void *arg;
00119 } nssPKIObjectCallback;
00120 
00121 PR_END_EXTERN_C
00122 
00123 #endif /* PKITM_H */