Collaboration diagram for Encryption Functions:

Functions

RDM_RETCODE rdm_dbEncrypt (RDM_DB db, RDM_ENCRYPT enc, const char *optString)
Encrypt a database. More...
RDM_RETCODE rdm_dbGetEncrypt (RDM_DB db, RDM_ENCRYPT *enc)
Get the encryption context associated with a database handle. More...
RDM_RETCODE rdm_dbSetEncrypt (RDM_DB db, RDM_ENCRYPT enc)
Associate an encryption context with a database handle. More...

Detailed Description

Encryption API for a database. All the functions here are located in RDM DB Engine Library. Linker option:

    -lrdmrdm

Additional API for instantiating an encryption context consult Encryption.

Function Documentation

rdm_dbEncrypt()

RDM_RETCODE rdm_dbEncrypt ( RDM_DB db,
RDM_ENCRYPT enc,
const char * optString
)

#include <rdmdbapi.h>

Encrypt a database.

This function can encrypt, decrypt, and re-encrypt an existing RDM database.

When re-encrypting a database image you can choose whether to do a full or quick re-encryption. A quick re-encryption will just change the passcode used for encrypting the randomly generated key used to encrypt the actual database contents. In this case the database contents do not need to be read and rewritten so the operation can be performed very quickly.

A full re-encryption will generate a new internal encryption key and will require each database page to be read, decrypted, re-encrypted, and rewritten to the file. This can be a lengthy operation for very large database images.

To decrypt an encrypted database pass in a NULL encryption context (enc).

Locking Requirements
This function requires that the database be opened in exclusive mode.
Return values
sOKAY Normal, successful return.
eDBNOTOPEN Database not open.
eEXCLUSIVE Exclusive access required.
eTRACTIVE Transaction is active.
See also
rdm_dbOpen
rdm_tfsAllocEncrypt
rdm_dbGetEncrypt
Parameters
[in] db A valid RDM database handle
[in] enc The new encryption context (can be NULL to decrypt)
[in] optString A semicolon delimited string that contains the utility options
Examples
core18Example_main.c.

rdm_dbGetEncrypt()

RDM_RETCODE rdm_dbGetEncrypt ( RDM_DB db,
RDM_ENCRYPT * enc
)

#include <rdmdbapi.h>

Get the encryption context associated with a database handle.

This function allows the application to retrive the encryption context associated with a database handle. It is possible that multiple encryption contexts are associated with a database handle. If that is the case this function will return the most recently associated encryption context.

Locking Requirements
None
Return values
sOKAY Normal, successful return.
See also
rdm_tfsAllocDatabase
rdm_dbSetEncrypt
rdm_tfsGetEncrypt
Parameters
[in] db A valid RDM database handle
[in] enc A pointer to an encryption context

rdm_dbSetEncrypt()

RDM_RETCODE rdm_dbSetEncrypt ( RDM_DB db,
RDM_ENCRYPT enc
)

#include <rdmdbapi.h>

Associate an encryption context with a database handle.

This function will associate an encryption context to a database handle. When a database is opened the system will us the encryption contexts associated with the handle to attempt to open the database.

Typically you would associate the encryption context to a handle prior to open a database.

You can remove all encryption contexts associated with the handle by passing in a NULL encryption context to this function.

Locking Requirements
None.
Return values
sOKAY Normal, successful return.
eDBOPEN Database already opened in this task.
ePRECOMMITTED A precommitted transaction must be committed or rolled back before further operations on this database are allowed.
See also
rdm_tfsAllocEncrypt
rdm_dbEncrypt
rdm_dbGetEncrypt
Parameters
[in] db A valid RDM database handle
[in] enc An RDM_ENCRYPT to associate with db (can be NULL to remove all contexts associated with db)
Examples
core18Example_main.c.