security/nss/lib/softoken/sftkdb.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/lib/softoken/sftkdb.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +#include "sftkdbt.h"
     1.8 +#include "sdb.h"
     1.9 +#include "pkcs11i.h"
    1.10 +#include "pkcs11t.h"
    1.11 +
    1.12 +/* raw database stuff */
    1.13 +CK_RV sftkdb_write(SFTKDBHandle *handle, SFTKObject *,CK_OBJECT_HANDLE *);
    1.14 +CK_RV sftkdb_FindObjectsInit(SFTKDBHandle *sdb, const CK_ATTRIBUTE *template,
    1.15 +				 CK_ULONG count, SDBFind **find);
    1.16 +CK_RV sftkdb_FindObjects(SFTKDBHandle *sdb, SDBFind *find, 
    1.17 +			CK_OBJECT_HANDLE *ids, int arraySize, CK_ULONG *count);
    1.18 +CK_RV sftkdb_FindObjectsFinal(SFTKDBHandle *sdb, SDBFind *find);
    1.19 +CK_RV sftkdb_GetAttributeValue(SFTKDBHandle *handle,
    1.20 +	 CK_OBJECT_HANDLE object_id, CK_ATTRIBUTE *template, CK_ULONG count);
    1.21 +CK_RV sftkdb_SetAttributeValue(SFTKDBHandle *handle, SFTKObject *object, 
    1.22 +	 		const CK_ATTRIBUTE *template, CK_ULONG count);
    1.23 +CK_RV sftkdb_DestroyObject(SFTKDBHandle *handle, CK_OBJECT_HANDLE object_id);
    1.24 +CK_RV sftkdb_closeDB(SFTKDBHandle *handle);
    1.25 +
    1.26 +/* keydb functions */
    1.27 +
    1.28 +SECStatus sftkdb_PWIsInitialized(SFTKDBHandle *keydb);
    1.29 +SECStatus sftkdb_CheckPassword(SFTKDBHandle *keydb, const char *pw,
    1.30 +			       PRBool *tokenRemoved);
    1.31 +SECStatus sftkdb_PWCached(SFTKDBHandle *keydb);
    1.32 +SECStatus sftkdb_HasPasswordSet(SFTKDBHandle *keydb);
    1.33 +SECStatus sftkdb_ResetKeyDB(SFTKDBHandle *keydb);
    1.34 +SECStatus sftkdb_ChangePassword(SFTKDBHandle *keydb, 
    1.35 +				char *oldPin, char *newPin,
    1.36 +				PRBool *tokenRemoved);
    1.37 +SECStatus sftkdb_ClearPassword(SFTKDBHandle *keydb);
    1.38 +PRBool sftkdb_InUpdateMerge(SFTKDBHandle *keydb);
    1.39 +PRBool sftkdb_NeedUpdateDBPassword(SFTKDBHandle *keydb);
    1.40 +const char *sftkdb_GetUpdateID(SFTKDBHandle *keydb);
    1.41 +SECItem *sftkdb_GetUpdatePasswordKey(SFTKDBHandle *keydb);
    1.42 +void sftkdb_FreeUpdatePasswordKey(SFTKDBHandle *keydb);
    1.43 +
    1.44 +/* Utility functions */
    1.45 +/*
    1.46 + * OK there are now lots of options here, lets go through them all:
    1.47 + *
    1.48 + * configdir - base directory where all the cert, key, and module datbases live.
    1.49 + * certPrefix - prefix added to the beginning of the cert database example: "
    1.50 + *                      "https-server1-"
    1.51 + * keyPrefix - prefix added to the beginning of the key database example: "
    1.52 + *                      "https-server1-"
    1.53 + * secmodName - name of the security module database (usually "secmod.db").
    1.54 + * readOnly - Boolean: true if the databases are to be openned read only.
    1.55 + * nocertdb - Don't open the cert DB and key DB's, just initialize the
    1.56 + *                      Volatile certdb.
    1.57 + * nomoddb - Don't open the security module DB, just initialize the
    1.58 + *                      PKCS #11 module.
    1.59 + * forceOpen - Continue to force initializations even if the databases cannot
    1.60 + *                      be opened.
    1.61 + */
    1.62 +CK_RV sftk_DBInit(const char *configdir, const char *certPrefix,
    1.63 +	 	const char *keyPrefix, const char *updatedir, 
    1.64 +		const char *updCertPrefix, const char *updKeyPrefix,
    1.65 +		const char *updateID, PRBool readOnly, PRBool noCertDB, 
    1.66 +		PRBool noKeyDB, PRBool forceOpen, PRBool isFIPS,
    1.67 +		SFTKDBHandle **certDB, SFTKDBHandle **keyDB);
    1.68 +CK_RV sftkdb_Shutdown(void);
    1.69 +
    1.70 +SFTKDBHandle *sftk_getCertDB(SFTKSlot *slot);
    1.71 +SFTKDBHandle *sftk_getKeyDB(SFTKSlot *slot);
    1.72 +SFTKDBHandle *sftk_getDBForTokenObject(SFTKSlot *slot, 
    1.73 +                                       CK_OBJECT_HANDLE objectID);
    1.74 +void sftk_freeDB(SFTKDBHandle *certHandle);

mercurial