Back to index

lightning-sunbird  0.9+nobinonly
pki3hack.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 PKINSS3HACK_H
00038 #define PKINSS3HACK_H
00039 
00040 #ifdef DEBUG
00041 static const char PKINSS3HACK_CVS_ID[] = "@(#) $RCSfile: pki3hack.h,v $ $Revision: 1.19 $ $Date: 2005/01/20 02:25:49 $";
00042 #endif /* DEBUG */
00043 
00044 #ifndef NSSDEVT_H
00045 #include "nssdevt.h"
00046 #endif /* NSSDEVT_H */
00047 
00048 #ifndef DEVT_H
00049 #include "devt.h"
00050 #endif /* DEVT_H */
00051 
00052 #ifndef NSSPKIT_H
00053 #include "nsspkit.h"
00054 #endif /* NSSPKIT_H */
00055 
00056 #include "base.h"
00057 
00058 #include "cert.h"
00059 
00060 PR_BEGIN_EXTERN_C
00061 
00062 #define NSSITEM_FROM_SECITEM(nssit, secit)  \
00063     (nssit)->data = (void *)(secit)->data;  \
00064     (nssit)->size = (PRUint32)(secit)->len;
00065 
00066 #define SECITEM_FROM_NSSITEM(secit, nssit)          \
00067     (secit)->data = (unsigned char *)(nssit)->data; \
00068     (secit)->len  = (unsigned int)(nssit)->size;
00069 
00070 NSS_EXTERN NSSTrustDomain *
00071 STAN_GetDefaultTrustDomain();
00072 
00073 NSS_EXTERN NSSCryptoContext *
00074 STAN_GetDefaultCryptoContext();
00075 
00076 NSS_EXTERN PRStatus
00077 STAN_InitTokenForSlotInfo(NSSTrustDomain *td, PK11SlotInfo *slot);
00078 
00079 NSS_EXTERN PRStatus
00080 STAN_ResetTokenInterator(NSSTrustDomain *td);
00081 
00082 NSS_EXTERN PRStatus
00083 STAN_LoadDefaultNSS3TrustDomain(void);
00084 
00085 NSS_EXTERN PRStatus
00086 STAN_Shutdown();
00087 
00088 NSS_EXTERN SECStatus
00089 STAN_AddModuleToDefaultTrustDomain(SECMODModule *module);
00090 
00091 NSS_EXTERN SECStatus
00092 STAN_RemoveModuleFromDefaultTrustDomain(SECMODModule *module);
00093 
00094 NSS_EXTERN CERTCertificate *
00095 STAN_ForceCERTCertificateUpdate(NSSCertificate *c);
00096 
00097 NSS_EXTERN CERTCertificate *
00098 STAN_GetCERTCertificate(NSSCertificate *c);
00099 
00100 NSS_EXTERN CERTCertificate *
00101 STAN_GetCERTCertificateOrRelease(NSSCertificate *c);
00102 
00103 NSS_EXTERN NSSCertificate *
00104 STAN_GetNSSCertificate(CERTCertificate *c);
00105 
00106 NSS_EXTERN CERTCertTrust * 
00107 nssTrust_GetCERTCertTrustForCert(NSSCertificate *c, CERTCertificate *cc);
00108 
00109 NSS_EXTERN PRStatus
00110 STAN_ChangeCertTrust(CERTCertificate *cc, CERTCertTrust *trust);
00111 
00112 NSS_EXTERN PRStatus
00113 nssPKIX509_GetIssuerAndSerialFromDER(NSSDER *der, NSSArena *arena, 
00114                                      NSSDER *issuer, NSSDER *serial);
00115 
00116 NSS_EXTERN char *
00117 STAN_GetCERTCertificateName(PLArenaPool *arenaOpt, NSSCertificate *c);
00118 
00119 NSS_EXTERN char *
00120 STAN_GetCERTCertificateNameForInstance(PLArenaPool *arenaOpt,
00121                                        NSSCertificate *c,
00122                                        nssCryptokiInstance *instance);
00123 
00124 /* exposing this */
00125 NSS_EXTERN NSSCertificate *
00126 NSSCertificate_Create
00127 (
00128   NSSArena *arenaOpt
00129 );
00130 
00131 /* This function is being put here because it is a hack for 
00132  * PK11_FindCertFromNickname.
00133  */
00134 NSS_EXTERN NSSCertificate *
00135 nssTrustDomain_FindBestCertificateByNicknameForToken
00136 (
00137   NSSTrustDomain *td,
00138   NSSToken *token,
00139   NSSUTF8 *name,
00140   NSSTime *timeOpt, /* NULL for "now" */
00141   NSSUsage *usage,
00142   NSSPolicies *policiesOpt /* NULL for none */
00143 );
00144 
00145 /* This function is being put here because it is a hack for 
00146  * PK11_FindCertsFromNickname.
00147  */
00148 NSS_EXTERN NSSCertificate **
00149 nssTrustDomain_FindCertificatesByNicknameForToken
00150 (
00151   NSSTrustDomain *td,
00152   NSSToken *token,
00153   NSSUTF8 *name,
00154   NSSCertificate *rvOpt[],
00155   PRUint32 maximumOpt, /* 0 for no max */
00156   NSSArena *arenaOpt
00157 );
00158 
00159 /* CERT_TraversePermCertsForSubject */
00160 NSS_EXTERN PRStatus
00161 nssTrustDomain_TraverseCertificatesBySubject
00162 (
00163   NSSTrustDomain *td,
00164   NSSDER *subject,
00165   PRStatus (*callback)(NSSCertificate *c, void *arg),
00166   void *arg
00167 );
00168 
00169 /* CERT_TraversePermCertsForNickname */
00170 NSS_EXTERN PRStatus
00171 nssTrustDomain_TraverseCertificatesByNickname
00172 (
00173   NSSTrustDomain *td,
00174   NSSUTF8 *nickname,
00175   PRStatus (*callback)(NSSCertificate *c, void *arg),
00176   void *arg
00177 );
00178 
00179 /* SEC_TraversePermCerts */
00180 NSS_EXTERN PRStatus
00181 nssTrustDomain_TraverseCertificates
00182 (
00183   NSSTrustDomain *td,
00184   PRStatus (*callback)(NSSCertificate *c, void *arg),
00185   void *arg
00186 );
00187 
00188 /* CERT_AddTempCertToPerm */
00189 NSS_EXTERN PRStatus
00190 nssTrustDomain_AddTempCertToPerm
00191 (
00192   NSSCertificate *c
00193 );
00194 
00195 PR_END_EXTERN_C
00196 
00197 #endif /* PKINSS3HACK_H */