security/nss/lib/softoken/sftkdb.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     4 #include "sftkdbt.h"
     5 #include "sdb.h"
     6 #include "pkcs11i.h"
     7 #include "pkcs11t.h"
     9 /* raw database stuff */
    10 CK_RV sftkdb_write(SFTKDBHandle *handle, SFTKObject *,CK_OBJECT_HANDLE *);
    11 CK_RV sftkdb_FindObjectsInit(SFTKDBHandle *sdb, const CK_ATTRIBUTE *template,
    12 				 CK_ULONG count, SDBFind **find);
    13 CK_RV sftkdb_FindObjects(SFTKDBHandle *sdb, SDBFind *find, 
    14 			CK_OBJECT_HANDLE *ids, int arraySize, CK_ULONG *count);
    15 CK_RV sftkdb_FindObjectsFinal(SFTKDBHandle *sdb, SDBFind *find);
    16 CK_RV sftkdb_GetAttributeValue(SFTKDBHandle *handle,
    17 	 CK_OBJECT_HANDLE object_id, CK_ATTRIBUTE *template, CK_ULONG count);
    18 CK_RV sftkdb_SetAttributeValue(SFTKDBHandle *handle, SFTKObject *object, 
    19 	 		const CK_ATTRIBUTE *template, CK_ULONG count);
    20 CK_RV sftkdb_DestroyObject(SFTKDBHandle *handle, CK_OBJECT_HANDLE object_id);
    21 CK_RV sftkdb_closeDB(SFTKDBHandle *handle);
    23 /* keydb functions */
    25 SECStatus sftkdb_PWIsInitialized(SFTKDBHandle *keydb);
    26 SECStatus sftkdb_CheckPassword(SFTKDBHandle *keydb, const char *pw,
    27 			       PRBool *tokenRemoved);
    28 SECStatus sftkdb_PWCached(SFTKDBHandle *keydb);
    29 SECStatus sftkdb_HasPasswordSet(SFTKDBHandle *keydb);
    30 SECStatus sftkdb_ResetKeyDB(SFTKDBHandle *keydb);
    31 SECStatus sftkdb_ChangePassword(SFTKDBHandle *keydb, 
    32 				char *oldPin, char *newPin,
    33 				PRBool *tokenRemoved);
    34 SECStatus sftkdb_ClearPassword(SFTKDBHandle *keydb);
    35 PRBool sftkdb_InUpdateMerge(SFTKDBHandle *keydb);
    36 PRBool sftkdb_NeedUpdateDBPassword(SFTKDBHandle *keydb);
    37 const char *sftkdb_GetUpdateID(SFTKDBHandle *keydb);
    38 SECItem *sftkdb_GetUpdatePasswordKey(SFTKDBHandle *keydb);
    39 void sftkdb_FreeUpdatePasswordKey(SFTKDBHandle *keydb);
    41 /* Utility functions */
    42 /*
    43  * OK there are now lots of options here, lets go through them all:
    44  *
    45  * configdir - base directory where all the cert, key, and module datbases live.
    46  * certPrefix - prefix added to the beginning of the cert database example: "
    47  *                      "https-server1-"
    48  * keyPrefix - prefix added to the beginning of the key database example: "
    49  *                      "https-server1-"
    50  * secmodName - name of the security module database (usually "secmod.db").
    51  * readOnly - Boolean: true if the databases are to be openned read only.
    52  * nocertdb - Don't open the cert DB and key DB's, just initialize the
    53  *                      Volatile certdb.
    54  * nomoddb - Don't open the security module DB, just initialize the
    55  *                      PKCS #11 module.
    56  * forceOpen - Continue to force initializations even if the databases cannot
    57  *                      be opened.
    58  */
    59 CK_RV sftk_DBInit(const char *configdir, const char *certPrefix,
    60 	 	const char *keyPrefix, const char *updatedir, 
    61 		const char *updCertPrefix, const char *updKeyPrefix,
    62 		const char *updateID, PRBool readOnly, PRBool noCertDB, 
    63 		PRBool noKeyDB, PRBool forceOpen, PRBool isFIPS,
    64 		SFTKDBHandle **certDB, SFTKDBHandle **keyDB);
    65 CK_RV sftkdb_Shutdown(void);
    67 SFTKDBHandle *sftk_getCertDB(SFTKSlot *slot);
    68 SFTKDBHandle *sftk_getKeyDB(SFTKSlot *slot);
    69 SFTKDBHandle *sftk_getDBForTokenObject(SFTKSlot *slot, 
    70                                        CK_OBJECT_HANDLE objectID);
    71 void sftk_freeDB(SFTKDBHandle *certHandle);

mercurial