Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
virtual P6R::P6ERR P6R::p6IDBC::connectSigned ( const P6WCHAR pURI,
P6SIGNHMAC  signAlg,
p6ICryptoKey pSignKey,
P6DBCRESULT  pfn,
P6VOID pCtx 
)
pure virtual

This method performs the same function as connect() with the added capability of digitally signing the contents of the database on close with the pSignKey.

When the database is openned, its signature is verified to detect unauthorized modifications. It is the caller's responsiblity to manage the signature key, that is the same key must be provided for each access otherwise the signature will not match and an error will be returned.

Not all database implementations support this feature and in this case an eNotSupported error is returned. eNotSupported will also be returned if this method is used to connect to an "in memory" database.

On return of eAborted (a missing signture) or eSignatureMismatch (modified data or signature) the database will not be openned. However, to recover from this situation see the P6DBC_RECOVERBADSIG flag defined above. Note, this should only be done with care, since the database may have been tampered with or corrupted.

Parameters
pURI[ in ] The URI defines the underlying database to use. Currently supported URIs include: 'sqlite3://filename', 'sqlite://:memory:', and 'postgresql8://user-name/password/hostname/hostaddr/port/database-name', where "sqlite3" and "postgresql8" are the database 'schemes'.
signAlg[ in ] Defines the type of signature algorithm used with pSignKey
pSignKey[ in ] A key to sign / verify a digital signature of the database (e.g., SH_SHA1)
pfn[ in ] Pointer to a callback function to be invoked once the connection is complete or has failed. If set to NULL, then the call is blocking, otherwise it returns immedately with a "eOk" result and a call to this function will happen sometimes in the future.
pCtx[ in ] Can be NULL, pointer to a context that is passed to the pfn callback once the connection result is known. This memory is allocated and freed only by the caller.
Returns
SuccessP6R::eOk 
FailureP6R::eNoMemoryInsuffficient memory to properly initialize the component
P6R::eNotInitializedA call to initialize() has not been made.
P6R::eNotFoundThe 'scheme' in the pURI parameter does not match to any known database implementation.
P6R::eInvalidURIInvalid URI format, or rest of URI does not match scheme
P6R::eNotSupportedThe database implementation does not support digital signatures.
P6R::eSignatureMismatchThe signature or the data has been modified.
P6R::eWrongKeyClassSignning operations require a symetric key.
P6R::eInvalidArgOne of the parameters is NULL.
P6R::eSignatureMissingSignature is missing for existing database.