>- It would be nice to wrap a class or two around the functions (class
>Vault?)
certainly. i just omitted it not knowing what to call it..
CPasswordSafe
CSafe
CPwSafe
etc.
>- Basically, we're abstracting the encrypted database. (Aside from the extra
>password parameter and an extra status code, the encryption is transparent
>to the class's users.) In addition to the functions you've written, I think
>we should have a way to add, delete and modify entries.
my interface had two methods for adding and deleting items [AddItem() and
DeleteItem()]. to modify an item, just alter the pointer you get back from
GetItem() by calling CItemData methods [SetTitle(), etc]
>- The Find() function should also be moved to the core (perhaps renamed
>Exist()?), as well as FindAll
i suppose it could return a collection of found CItemData objects.
>- Passkey should move to the Core,
yes. i hadn't gotten that far on the interface yet. but there could be
methods like:
ChangeCombination( const char* pszOld, const char* pszNew );
>as should the CList<CItemData,CItemData>,
>which is the in-memory database, and access to it should be abstracted from
>the rest of the application, as a first step in replacing it with an STL
>list (or vector?).
yes, this is what i was going for. all my methods rely on the fact that
the collection (whatever it may be) of CItemData will be hidden behind the
interface and no direct access to the collection will be allowed.
>- Of course, CMyString, the crypto functions and Util.c should also move to
>Core, as these are totally GUI-independant. Core.h should #include the
>relevant header files for the users, I think.
yes, that sounds good. single include to get the entire password safe
functionality.
-gregg
>Comments?
>
>
>-----Original Message-----
>From: passwordsafe-devel-admin@...
>[mailto:passwordsafe-devel-admin@... Behalf Of gregg
>conklin
>Sent: Wednesday, April 30, 2003 6:42 PM
>To: passwordsafe-devel
>Subject: RE: [Passwordsafe-devel] redesign
>
>
>here's my initial take on a possible interface to the password safe
>engine. i used HRESULT here just cause i like them (they should be
>portable as they are just longs divided into bit fields). but really
>anything could be done that conveys the same info.
>
>it's a pretty simple interface really. but then, i don't think it needs to
>be too complex.
>
>PASSWORD SAFE ENGINE INTERFACE
>==============================
>
>RETURN CODES
>------------
>// general success
>#define PWSAFE_S_OK S_OK
>
>// general failure
>#define PWAFE_E_Fail MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF,
>0x01 )
>
>#define PWAFE_E_FileNotExist MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF,
>0x02 )
>#define PWAFE_E_FileLocked MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF,
>0x03 )
>#define PWAFE_E_BadCombination MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF,
>0x04 )
>#define PWAFE_E_ReadOnly MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF,
>0x05 )
>#define PWAFE_E_ItemNotFound MAKE_HRESULT( SEVERITY_ERROR, FACILITY_ITF,
>0x06 )
>
>
>METHODS
>-------
>// Opens a safe
>// Parameters:
>// pszFilename - path and filename of safe to open
>// pszCombination - attempt to open file with this combination
>// bReadOnly - safe cannot be modified when true
>// Returns:
>// PWSAFE_S_OK - safe opened with correct password
>// PWSAFE_E_Fail - some unaccounted for problem
>// PWSAFE_E_FileNotExist - pszFilename was not found
>// PWSAFE_E_FileLocked - try setting bReadOnly to true
>// PWSAFE_E_BadCombination - file exists, but pszCombination was wrong
>HRESULT Open( const char* pszFilename, const char* pszCombination, bool
>bReadOnly );
>
>// Close the safe file
>void Close();
>
>// Commit current safe data to disk
>// Returns:
>// PWSAFE_S_OK - data committed
>// PWSAFE_E_Fail - some unaccounted for problem during save
>// PWSAFE_E_ReadOnly - safe was opened in read only mode
>HRESULT Save();
>
>// Returns count of how many entries in this safe
>int GetEntryCount();
>
>// Retrieve an item from the safe
>// Parameters:
>// nItem - index into entries (must be < GetEntryCount())
>// Returns:
>// a valid pointer to an item or NULL
>CItemData* GetItem( int nItem );
>
>// Adds an item to the safe
>// Parameters:
>// pItem - create with new, you no longer own it, don't delete
>// Returns:
>// PWSAFE_S_OK - item added
>// PWSAFE_E_ReadOnly - safe was opened in read only mode, cannot modify
>HRESULT AddItem( CItemData* pItem );
>
>// Delete a single item
>// Parameters:
>// pItem - item to delete [from GetItem()]
>// Returns:
>// PWSAFE_S_OK - Item deleted, memory freed, cease using pItem
>immediatly
>// PWSAFE_E_ReadOnly - safe was opened in read only mode, cannot
>modify
>// PWSAFE_E_ItemNotFound - item was invalid in some way
>HRESULT DeleteItem( CItemData *pItem );
>
>
>some pseudo code of initial load could be:
>
>pwsafe->Open( filename, password, false )
>for ( x = 0; x < pwsafe->GetItemCount(); ++x )
>{
> item = pwsafe->GetItem( x );
> create gui line item entry and populate fields from item
> associate item* with gui line item for use later
>}
>
>
>-gregg
>
>At 10:46 AM 4/29/2003 +0200, you wrote:
> >Hi,
> >
> >Violent agreement here. Once 1.91 is released, I think we need to create a
> >"core" library sub-project that will handle file reading/writing, record
> >encryption/decryption, and other platform-independent functions. Would
> >anyone like to take a stab at defining the interface, i.e., write "core.h"?
>
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>Passwordsafe-devel mailing list
>Passwordsafe-devel@...
>https://lists.sourceforge.net/lists/listinfo/passwordsafe-devel
|