security/nss/lib/softoken/sftkdb.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial