Back to index

lightning-sunbird  0.9+nobinonly
dev.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 DEV_H
00038 #define DEV_H
00039 
00040 /*
00041  * dev.h
00042  *
00043  * Low-level methods for interaction with cryptoki devices
00044  */
00045 
00046 #ifdef DEBUG
00047 static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.37 $ $Date: 2005/03/07 21:20:38 $";
00048 #endif /* DEBUG */
00049 
00050 #ifndef NSSCKT_H
00051 #include "nssckt.h"
00052 #endif /* NSSCKT_H */
00053 
00054 #ifndef NSSDEV_H
00055 #include "nssdev.h"
00056 #endif /* NSSDEV_H */
00057 
00058 #ifndef DEVT_H
00059 #include "devt.h"
00060 #endif /* DEVT_H */
00061 
00062 PR_BEGIN_EXTERN_C
00063 
00064 /* the global module list
00065  *
00066  * These functions are for managing the global set of modules.  Trust Domains,
00067  * etc., will draw from this set.  These functions are completely internal
00068  * and only invoked when there are changes to the global module state
00069  * (load or unload).
00070  *
00071  * nss_InitializeGlobalModuleList
00072  * nss_DestroyGlobalModuleList
00073  * nss_GetLoadedModules
00074  *
00075  * nssGlobalModuleList_Add
00076  * nssGlobalModuleList_Remove
00077  * nssGlobalModuleList_FindModuleByName
00078  * nssGlobalModuleList_FindSlotByName
00079  * nssGlobalModuleList_FindTokenByName
00080  */
00081 
00082 NSS_EXTERN PRStatus
00083 nss_InitializeGlobalModuleList
00084 (
00085   void
00086 );
00087 
00088 NSS_EXTERN PRStatus
00089 nss_DestroyGlobalModuleList
00090 (
00091   void
00092 );
00093 
00094 NSS_EXTERN NSSModule **
00095 nss_GetLoadedModules
00096 (
00097   void
00098 );
00099 
00100 NSS_EXTERN PRStatus
00101 nssGlobalModuleList_Add
00102 (
00103   NSSModule *module
00104 );
00105 
00106 NSS_EXTERN PRStatus
00107 nssGlobalModuleList_Remove
00108 (
00109   NSSModule *module
00110 );
00111 
00112 NSS_EXTERN NSSModule *
00113 nssGlobalModuleList_FindModuleByName
00114 (
00115   NSSUTF8 *moduleName
00116 );
00117 
00118 NSS_EXTERN NSSSlot *
00119 nssGlobalModuleList_FindSlotByName
00120 (
00121   NSSUTF8 *slotName
00122 );
00123 
00124 NSS_EXTERN NSSToken *
00125 nssGlobalModuleList_FindTokenByName
00126 (
00127   NSSUTF8 *tokenName
00128 );
00129 
00130 NSS_EXTERN NSSToken *
00131 nss_GetDefaultCryptoToken
00132 (
00133   void
00134 );
00135 
00136 NSS_EXTERN NSSToken *
00137 nss_GetDefaultDatabaseToken
00138 (
00139   void
00140 );
00141 
00142 /*
00143  *  |-----------|<---> NSSSlot <--> NSSToken
00144  *  | NSSModule |<---> NSSSlot <--> NSSToken
00145  *  |-----------|<---> NSSSlot <--> NSSToken
00146  */
00147 
00148 /* NSSModule
00149  *
00150  * nssModule_Create
00151  * nssModule_CreateFromSpec
00152  * nssModule_AddRef
00153  * nssModule_GetName
00154  * nssModule_GetSlots
00155  * nssModule_FindSlotByName
00156  * nssModule_FindTokenByName
00157  * nssModule_GetCertOrder
00158  */
00159 
00160 NSS_EXTERN NSSModule *
00161 nssModule_Create
00162 (
00163   NSSUTF8 *moduleOpt,
00164   NSSUTF8 *uriOpt,
00165   NSSUTF8 *opaqueOpt,
00166   void    *reserved
00167 );
00168 
00169 /* This is to use the new loading mechanism. */
00170 NSS_EXTERN NSSModule *
00171 nssModule_CreateFromSpec
00172 (
00173   NSSUTF8 *moduleSpec,
00174   NSSModule *parent,
00175   PRBool loadSubModules
00176 );
00177 
00178 NSS_EXTERN PRStatus
00179 nssModule_Destroy
00180 (
00181   NSSModule *mod
00182 );
00183 
00184 NSS_EXTERN NSSModule *
00185 nssModule_AddRef
00186 (
00187   NSSModule *mod
00188 );
00189 
00190 NSS_EXTERN NSSUTF8 *
00191 nssModule_GetName
00192 (
00193   NSSModule *mod
00194 );
00195 
00196 NSS_EXTERN NSSSlot **
00197 nssModule_GetSlots
00198 (
00199   NSSModule *mod
00200 );
00201 
00202 NSS_EXTERN NSSSlot *
00203 nssModule_FindSlotByName
00204 (
00205   NSSModule *mod,
00206   NSSUTF8 *slotName
00207 );
00208 
00209 NSS_EXTERN NSSToken *
00210 nssModule_FindTokenByName
00211 (
00212   NSSModule *mod,
00213   NSSUTF8 *tokenName
00214 );
00215 
00216 NSS_EXTERN PRInt32
00217 nssModule_GetCertOrder
00218 (
00219   NSSModule *module
00220 );
00221 
00222 /* NSSSlot
00223  *
00224  * nssSlot_Destroy
00225  * nssSlot_AddRef
00226  * nssSlot_GetName
00227  * nssSlot_GetTokenName
00228  * nssSlot_IsTokenPresent
00229  * nssSlot_IsPermanent
00230  * nssSlot_IsFriendly
00231  * nssSlot_IsHardware
00232  * nssSlot_Refresh
00233  * nssSlot_GetModule
00234  * nssSlot_GetToken
00235  * nssSlot_Login
00236  * nssSlot_Logout
00237  * nssSlot_SetPassword
00238  * nssSlot_CreateSession
00239  */
00240 
00241 NSS_EXTERN PRStatus
00242 nssSlot_Destroy
00243 (
00244   NSSSlot *slot
00245 );
00246 
00247 NSS_EXTERN NSSSlot *
00248 nssSlot_AddRef
00249 (
00250   NSSSlot *slot
00251 );
00252 
00253 NSS_EXTERN void
00254 nssSlot_ResetDelay
00255 (
00256   NSSSlot *slot
00257 );
00258 
00259 NSS_EXTERN NSSUTF8 *
00260 nssSlot_GetName
00261 (
00262   NSSSlot *slot
00263 );
00264 
00265 NSS_EXTERN NSSUTF8 *
00266 nssSlot_GetTokenName
00267 (
00268   NSSSlot *slot
00269 );
00270 
00271 NSS_EXTERN NSSModule *
00272 nssSlot_GetModule
00273 (
00274   NSSSlot *slot
00275 );
00276 
00277 NSS_EXTERN NSSToken *
00278 nssSlot_GetToken
00279 (
00280   NSSSlot *slot
00281 );
00282 
00283 NSS_EXTERN PRBool
00284 nssSlot_IsTokenPresent
00285 (
00286   NSSSlot *slot
00287 );
00288 
00289 NSS_EXTERN PRBool
00290 nssSlot_IsPermanent
00291 (
00292   NSSSlot *slot
00293 );
00294 
00295 NSS_EXTERN PRBool
00296 nssSlot_IsFriendly
00297 (
00298   NSSSlot *slot
00299 );
00300 
00301 NSS_EXTERN PRBool
00302 nssSlot_IsHardware
00303 (
00304   NSSSlot *slot
00305 );
00306 
00307 NSS_EXTERN PRBool
00308 nssSlot_IsLoggedIn
00309 (
00310   NSSSlot *slot
00311 );
00312 
00313 NSS_EXTERN PRStatus
00314 nssSlot_Refresh
00315 (
00316   NSSSlot *slot
00317 );
00318 
00319 NSS_EXTERN PRStatus
00320 nssSlot_Login
00321 (
00322   NSSSlot *slot,
00323   NSSCallback *pwcb
00324 );
00325 extern const NSSError NSS_ERROR_INVALID_PASSWORD;
00326 extern const NSSError NSS_ERROR_USER_CANCELED;
00327 
00328 NSS_EXTERN PRStatus
00329 nssSlot_Logout
00330 (
00331   NSSSlot *slot,
00332   nssSession *sessionOpt
00333 );
00334 
00335 NSS_EXTERN void
00336 nssSlot_EnterMonitor
00337 (
00338   NSSSlot *slot
00339 );
00340 
00341 NSS_EXTERN void
00342 nssSlot_ExitMonitor
00343 (
00344   NSSSlot *slot
00345 );
00346 
00347 #define NSSSLOT_ASK_PASSWORD_FIRST_TIME -1
00348 #define NSSSLOT_ASK_PASSWORD_EVERY_TIME  0
00349 NSS_EXTERN void
00350 nssSlot_SetPasswordDefaults
00351 (
00352   NSSSlot *slot,
00353   PRInt32 askPasswordTimeout
00354 );
00355 
00356 NSS_EXTERN PRStatus
00357 nssSlot_SetPassword
00358 (
00359   NSSSlot *slot,
00360   NSSUTF8 *oldPasswordOpt,
00361   NSSUTF8 *newPassword
00362 );
00363 extern const NSSError NSS_ERROR_INVALID_PASSWORD;
00364 extern const NSSError NSS_ERROR_USER_CANCELED;
00365 
00366 /*
00367  * nssSlot_IsLoggedIn
00368  */
00369 
00370 NSS_EXTERN nssSession *
00371 nssSlot_CreateSession
00372 (
00373   NSSSlot *slot,
00374   NSSArena *arenaOpt,
00375   PRBool readWrite /* so far, this is the only flag used */
00376 );
00377 
00378 /* NSSToken
00379  *
00380  * nssToken_Destroy
00381  * nssToken_AddRef
00382  * nssToken_GetName
00383  * nssToken_GetModule
00384  * nssToken_GetSlot
00385  * nssToken_NeedsPINInitialization
00386  * nssToken_ImportCertificate
00387  * nssToken_ImportTrust
00388  * nssToken_ImportCRL
00389  * nssToken_GenerateKeyPair
00390  * nssToken_GenerateSymmetricKey
00391  * nssToken_DeleteStoredObject
00392  * nssToken_FindCertificates
00393  * nssToken_FindCertificatesBySubject
00394  * nssToken_FindCertificatesByNickname
00395  * nssToken_FindCertificatesByEmail
00396  * nssToken_FindCertificateByIssuerAndSerialNumber
00397  * nssToken_FindCertificateByEncodedCertificate
00398  * nssToken_FindTrustObjects
00399  * nssToken_FindTrustForCertificate
00400  * nssToken_FindCRLs
00401  * nssToken_FindCRLsBySubject
00402  * nssToken_FindPrivateKeys
00403  * nssToken_FindPrivateKeyByID
00404  * nssToken_Digest
00405  * nssToken_BeginDigest
00406  * nssToken_ContinueDigest
00407  * nssToken_FinishDigest
00408  */
00409 
00410 NSS_EXTERN PRStatus
00411 nssToken_Destroy
00412 (
00413   NSSToken *tok
00414 );
00415 
00416 NSS_EXTERN NSSToken *
00417 nssToken_AddRef
00418 (
00419   NSSToken *tok
00420 );
00421 
00422 NSS_EXTERN NSSUTF8 *
00423 nssToken_GetName
00424 (
00425   NSSToken *tok
00426 );
00427 
00428 NSS_EXTERN NSSModule *
00429 nssToken_GetModule
00430 (
00431   NSSToken *token
00432 );
00433 
00434 NSS_EXTERN NSSSlot *
00435 nssToken_GetSlot
00436 (
00437   NSSToken *tok
00438 );
00439 
00440 NSS_EXTERN PRBool
00441 nssToken_NeedsPINInitialization
00442 (
00443   NSSToken *token
00444 );
00445 
00446 NSS_EXTERN nssCryptokiObject *
00447 nssToken_ImportCertificate
00448 (
00449   NSSToken *tok,
00450   nssSession *sessionOpt,
00451   NSSCertificateType certType,
00452   NSSItem *id,
00453   NSSUTF8 *nickname,
00454   NSSDER *encoding,
00455   NSSDER *issuer,
00456   NSSDER *subject,
00457   NSSDER *serial,
00458   NSSASCII7 *emailAddr,
00459   PRBool asTokenObject
00460 );
00461 
00462 NSS_EXTERN nssCryptokiObject *
00463 nssToken_ImportTrust
00464 (
00465   NSSToken *tok,
00466   nssSession *sessionOpt,
00467   NSSDER *certEncoding,
00468   NSSDER *certIssuer,
00469   NSSDER *certSerial,
00470   nssTrustLevel serverAuth,
00471   nssTrustLevel clientAuth,
00472   nssTrustLevel codeSigning,
00473   nssTrustLevel emailProtection,
00474   PRBool stepUpApproved,
00475   PRBool asTokenObject
00476 );
00477 
00478 NSS_EXTERN nssCryptokiObject *
00479 nssToken_ImportCRL
00480 (
00481   NSSToken *token,
00482   nssSession *sessionOpt,
00483   NSSDER *subject,
00484   NSSDER *encoding,
00485   PRBool isKRL,
00486   NSSUTF8 *url,
00487   PRBool asTokenObject
00488 );
00489 
00490 /* Permanently remove an object from the token. */
00491 NSS_EXTERN PRStatus
00492 nssToken_DeleteStoredObject
00493 (
00494   nssCryptokiObject *instance
00495 );
00496 
00497 NSS_EXTERN nssCryptokiObject **
00498 nssToken_FindCertificates
00499 (
00500   NSSToken *token,
00501   nssSession *sessionOpt,
00502   nssTokenSearchType searchType,
00503   PRUint32 maximumOpt,
00504   PRStatus *statusOpt
00505 );
00506 
00507 NSS_EXTERN nssCryptokiObject **
00508 nssToken_FindCertificatesBySubject
00509 (
00510   NSSToken *token,
00511   nssSession *sessionOpt,
00512   NSSDER *subject,
00513   nssTokenSearchType searchType,
00514   PRUint32 maximumOpt,
00515   PRStatus *statusOpt
00516 );
00517 
00518 NSS_EXTERN nssCryptokiObject **
00519 nssToken_FindCertificatesByNickname
00520 (
00521   NSSToken *token,
00522   nssSession *sessionOpt,
00523   NSSUTF8 *name,
00524   nssTokenSearchType searchType,
00525   PRUint32 maximumOpt,
00526   PRStatus *statusOpt
00527 );
00528 
00529 NSS_EXTERN nssCryptokiObject **
00530 nssToken_FindCertificatesByEmail
00531 (
00532   NSSToken *token,
00533   nssSession *sessionOpt,
00534   NSSASCII7 *email,
00535   nssTokenSearchType searchType,
00536   PRUint32 maximumOpt,
00537   PRStatus *statusOpt
00538 );
00539 
00540 NSS_EXTERN nssCryptokiObject **
00541 nssToken_FindCertificatesByID
00542 (
00543   NSSToken *token,
00544   nssSession *sessionOpt,
00545   NSSItem *id,
00546   nssTokenSearchType searchType,
00547   PRUint32 maximumOpt,
00548   PRStatus *statusOpt
00549 );
00550 
00551 NSS_EXTERN nssCryptokiObject *
00552 nssToken_FindCertificateByIssuerAndSerialNumber
00553 (
00554   NSSToken *token,
00555   nssSession *sessionOpt,
00556   NSSDER *issuer,
00557   NSSDER *serial,
00558   nssTokenSearchType searchType,
00559   PRStatus *statusOpt
00560 );
00561 
00562 NSS_EXTERN nssCryptokiObject *
00563 nssToken_FindCertificateByEncodedCertificate
00564 (
00565   NSSToken *token,
00566   nssSession *sessionOpt,
00567   NSSBER *encodedCertificate,
00568   nssTokenSearchType searchType,
00569   PRStatus *statusOpt
00570 );
00571 
00572 NSS_EXTERN nssCryptokiObject **
00573 nssToken_FindTrustObjects
00574 (
00575   NSSToken *token,
00576   nssSession *sessionOpt,
00577   nssTokenSearchType searchType,
00578   PRUint32 maximumOpt,
00579   PRStatus *statusOpt
00580 );
00581 
00582 NSS_EXTERN nssCryptokiObject *
00583 nssToken_FindTrustForCertificate
00584 (
00585   NSSToken *token,
00586   nssSession *sessionOpt,
00587   NSSDER *certEncoding,
00588   NSSDER *certIssuer,
00589   NSSDER *certSerial,
00590   nssTokenSearchType searchType
00591 );
00592 
00593 NSS_EXTERN nssCryptokiObject **
00594 nssToken_FindCRLs
00595 (
00596   NSSToken *token,
00597   nssSession *sessionOpt,
00598   nssTokenSearchType searchType,
00599   PRUint32 maximumOpt,
00600   PRStatus *statusOpt
00601 );
00602 
00603 NSS_EXTERN nssCryptokiObject **
00604 nssToken_FindCRLsBySubject
00605 (
00606   NSSToken *token,
00607   nssSession *sessionOpt,
00608   NSSDER *subject,
00609   nssTokenSearchType searchType,
00610   PRUint32 maximumOpt,
00611   PRStatus *statusOpt
00612 );
00613 
00614 NSS_EXTERN nssCryptokiObject **
00615 nssToken_FindPrivateKeys
00616 (
00617   NSSToken *token,
00618   nssSession *sessionOpt,
00619   nssTokenSearchType searchType,
00620   PRUint32 maximumOpt,
00621   PRStatus *statusOpt
00622 );
00623 
00624 NSS_EXTERN nssCryptokiObject *
00625 nssToken_FindPrivateKeyByID
00626 (
00627   NSSToken *token,
00628   nssSession *sessionOpt,
00629   NSSItem *keyID
00630 );
00631 
00632 NSS_EXTERN nssCryptokiObject *
00633 nssToken_FindPublicKeyByID
00634 (
00635   NSSToken *token,
00636   nssSession *sessionOpt,
00637   NSSItem *keyID
00638 );
00639 
00640 NSS_EXTERN NSSItem *
00641 nssToken_Digest
00642 (
00643   NSSToken *tok,
00644   nssSession *sessionOpt,
00645   NSSAlgorithmAndParameters *ap,
00646   NSSItem *data,
00647   NSSItem *rvOpt,
00648   NSSArena *arenaOpt
00649 );
00650 
00651 NSS_EXTERN PRStatus
00652 nssToken_BeginDigest
00653 (
00654   NSSToken *tok,
00655   nssSession *sessionOpt,
00656   NSSAlgorithmAndParameters *ap
00657 );
00658 
00659 NSS_EXTERN PRStatus
00660 nssToken_ContinueDigest
00661 (
00662   NSSToken *tok,
00663   nssSession *sessionOpt,
00664   NSSItem *item
00665 );
00666 
00667 NSS_EXTERN NSSItem *
00668 nssToken_FinishDigest
00669 (
00670   NSSToken *tok,
00671   nssSession *sessionOpt,
00672   NSSItem *rvOpt,
00673   NSSArena *arenaOpt
00674 );
00675 
00676 /* nssSession
00677  *
00678  * nssSession_Destroy
00679  * nssSession_EnterMonitor
00680  * nssSession_ExitMonitor
00681  * nssSession_IsReadWrite
00682  */
00683 
00684 NSS_EXTERN PRStatus
00685 nssSession_Destroy
00686 (
00687   nssSession *s
00688 );
00689 
00690 /* would like to inline */
00691 NSS_EXTERN PRStatus
00692 nssSession_EnterMonitor
00693 (
00694   nssSession *s
00695 );
00696 
00697 /* would like to inline */
00698 NSS_EXTERN PRStatus
00699 nssSession_ExitMonitor
00700 (
00701   nssSession *s
00702 );
00703 
00704 /* would like to inline */
00705 NSS_EXTERN PRBool
00706 nssSession_IsReadWrite
00707 (
00708   nssSession *s
00709 );
00710 
00711 /* nssCryptokiObject
00712  *
00713  * An object living on a cryptoki token.
00714  * Not really proper to mix up the object types just because 
00715  * nssCryptokiObject itself is generic, but doing so anyway.
00716  *
00717  * nssCryptokiObject_Destroy
00718  * nssCryptokiObject_Equal
00719  * nssCryptokiObject_Clone
00720  * nssCryptokiCertificate_GetAttributes
00721  * nssCryptokiPrivateKey_GetAttributes
00722  * nssCryptokiPublicKey_GetAttributes
00723  * nssCryptokiTrust_GetAttributes
00724  * nssCryptokiCRL_GetAttributes
00725  */
00726 
00727 NSS_EXTERN void
00728 nssCryptokiObject_Destroy
00729 (
00730   nssCryptokiObject *object
00731 );
00732 
00733 NSS_EXTERN PRBool
00734 nssCryptokiObject_Equal
00735 (
00736   nssCryptokiObject *object1,
00737   nssCryptokiObject *object2
00738 );
00739 
00740 NSS_EXTERN nssCryptokiObject *
00741 nssCryptokiObject_Clone
00742 (
00743   nssCryptokiObject *object
00744 );
00745 
00746 NSS_EXTERN PRStatus
00747 nssCryptokiCertificate_GetAttributes
00748 (
00749   nssCryptokiObject *object,
00750   nssSession *sessionOpt,
00751   NSSArena *arenaOpt,
00752   NSSCertificateType *certTypeOpt,
00753   NSSItem *idOpt,
00754   NSSDER *encodingOpt,
00755   NSSDER *issuerOpt,
00756   NSSDER *serialOpt,
00757   NSSDER *subjectOpt
00758 );
00759 
00760 NSS_EXTERN PRStatus
00761 nssCryptokiTrust_GetAttributes
00762 (
00763   nssCryptokiObject *trustObject,
00764   nssSession *sessionOpt,
00765   NSSItem *sha1_hash,
00766   nssTrustLevel *serverAuth,
00767   nssTrustLevel *clientAuth,
00768   nssTrustLevel *codeSigning,
00769   nssTrustLevel *emailProtection,
00770   PRBool *stepUpApproved
00771 );
00772 
00773 NSS_EXTERN PRStatus
00774 nssCryptokiCRL_GetAttributes
00775 (
00776   nssCryptokiObject *crlObject,
00777   nssSession *sessionOpt,
00778   NSSArena *arenaOpt,
00779   NSSItem *encodingOpt,
00780   NSSItem * subjectOpt,
00781   CK_ULONG * crl_class,
00782   NSSUTF8 **urlOpt,
00783   PRBool *isKRLOpt
00784 );
00785 
00786 /* I'm including this to handle import of certificates in NSS 3.5.  This
00787  * function will set the cert-related attributes of a key, in order to
00788  * associate it with a cert.  Does it stay like this for 4.0?
00789  */
00790 NSS_EXTERN PRStatus
00791 nssCryptokiPrivateKey_SetCertificate
00792 (
00793   nssCryptokiObject *keyObject,
00794   nssSession *sessionOpt,
00795   NSSUTF8 *nickname,
00796   NSSItem *id,
00797   NSSDER *subject
00798 );
00799 
00800 NSS_EXTERN void
00801 nssModuleArray_Destroy
00802 (
00803   NSSModule **modules
00804 );
00805 
00806 /* nssSlotArray
00807  *
00808  * nssSlotArray_Destroy
00809  */
00810 
00811 NSS_EXTERN void
00812 nssSlotArray_Destroy
00813 (
00814   NSSSlot **slots
00815 );
00816 
00817 /* nssTokenArray
00818  *
00819  * nssTokenArray_Destroy
00820  */
00821 
00822 NSS_EXTERN void
00823 nssTokenArray_Destroy
00824 (
00825   NSSToken **tokens
00826 );
00827 
00828 /* nssCryptokiObjectArray
00829  *
00830  * nssCryptokiObjectArray_Destroy
00831  */
00832 NSS_EXTERN void
00833 nssCryptokiObjectArray_Destroy
00834 (
00835   nssCryptokiObject **object
00836 );
00837 
00838 /* nssSlotList
00839 *
00840  * An ordered list of slots.  The order can be anything, it is set in the
00841  * Add methods.  Perhaps it should be CreateInCertOrder, ...?
00842  *
00843  * nssSlotList_Create
00844  * nssSlotList_Destroy
00845  * nssSlotList_Add
00846  * nssSlotList_AddModuleSlots
00847  * nssSlotList_GetSlots
00848  * nssSlotList_FindSlotByName
00849  * nssSlotList_FindTokenByName
00850  * nssSlotList_GetBestSlot
00851  * nssSlotList_GetBestSlotForAlgorithmAndParameters
00852  * nssSlotList_GetBestSlotForAlgorithmsAndParameters
00853  */
00854 
00855 /* nssSlotList_Create
00856  */
00857 NSS_EXTERN nssSlotList *
00858 nssSlotList_Create
00859 (
00860   NSSArena *arenaOpt
00861 );
00862 
00863 /* nssSlotList_Destroy
00864  */
00865 NSS_EXTERN void
00866 nssSlotList_Destroy
00867 (
00868   nssSlotList *slotList
00869 );
00870 
00871 /* nssSlotList_Add
00872  *
00873  * Add the given slot in the given order.
00874  */
00875 NSS_EXTERN PRStatus
00876 nssSlotList_Add
00877 (
00878   nssSlotList *slotList,
00879   NSSSlot *slot,
00880   PRUint32 order
00881 );
00882 
00883 /* nssSlotList_AddModuleSlots
00884  *
00885  * Add all slots in the module, in the given order (the slots will have
00886  * equal weight).
00887  */
00888 NSS_EXTERN PRStatus
00889 nssSlotList_AddModuleSlots
00890 (
00891   nssSlotList *slotList,
00892   NSSModule *module,
00893   PRUint32 order
00894 );
00895 
00896 /* nssSlotList_GetSlots
00897  */
00898 NSS_EXTERN NSSSlot **
00899 nssSlotList_GetSlots
00900 (
00901   nssSlotList *slotList
00902 );
00903 
00904 /* nssSlotList_FindSlotByName
00905  */
00906 NSS_EXTERN NSSSlot *
00907 nssSlotList_FindSlotByName
00908 (
00909   nssSlotList *slotList,
00910   NSSUTF8 *slotName
00911 );
00912 
00913 /* nssSlotList_FindTokenByName
00914  */
00915 NSS_EXTERN NSSToken *
00916 nssSlotList_FindTokenByName
00917 (
00918   nssSlotList *slotList,
00919   NSSUTF8 *tokenName
00920 );
00921 
00922 /* nssSlotList_GetBestSlot
00923  *
00924  * The best slot is the highest ranking in order, i.e., the first in the
00925  * list.
00926  */
00927 NSS_EXTERN NSSSlot *
00928 nssSlotList_GetBestSlot
00929 (
00930   nssSlotList *slotList
00931 );
00932 
00933 /* nssSlotList_GetBestSlotForAlgorithmAndParameters
00934  *
00935  * Highest-ranking slot than can handle algorithm/parameters.
00936  */
00937 NSS_EXTERN NSSSlot *
00938 nssSlotList_GetBestSlotForAlgorithmAndParameters
00939 (
00940   nssSlotList *slotList,
00941   NSSAlgorithmAndParameters *ap
00942 );
00943 
00944 /* nssSlotList_GetBestSlotForAlgorithmsAndParameters
00945  *
00946  * Highest-ranking slot than can handle all algorithms/parameters.
00947  */
00948 NSS_EXTERN NSSSlot *
00949 nssSlotList_GetBestSlotForAlgorithmsAndParameters
00950 (
00951   nssSlotList *slotList,
00952   NSSAlgorithmAndParameters **ap
00953 );
00954 
00955 #ifdef NSS_3_4_CODE
00956 
00957 NSS_EXTERN PRBool
00958 nssToken_IsPresent
00959 (
00960   NSSToken *token
00961 );
00962 
00963 NSS_EXTERN nssSession *
00964 nssToken_GetDefaultSession
00965 (
00966   NSSToken *token
00967 );
00968 
00969 NSS_EXTERN PRStatus
00970 nssToken_GetTrustOrder
00971 (
00972   NSSToken *tok
00973 );
00974 
00975 NSS_EXTERN PRStatus
00976 nssToken_NotifyCertsNotVisible
00977 (
00978   NSSToken *tok
00979 );
00980 
00981 NSS_EXTERN PRStatus
00982 nssToken_TraverseCertificates
00983 (
00984   NSSToken *token,
00985   nssSession *sessionOpt,
00986   nssTokenSearchType searchType,
00987   PRStatus (* callback)(nssCryptokiObject *instance, void *arg),
00988   void *arg
00989 );
00990 
00991 NSS_EXTERN PRBool
00992 nssToken_IsPrivateKeyAvailable
00993 (
00994   NSSToken *token,
00995   NSSCertificate *c,
00996   nssCryptokiObject *instance
00997 );
00998 
00999 
01000 #endif
01001 
01002 PR_END_EXTERN_C
01003 
01004 #endif /* DEV_H */