mco_crypt_init_ctx

Prepare the encryption context by a cipher key string.

For an overview see page Encryption C API

Prototype

 
    void mco_crypt_init_ctx(mco_crypt_ctx_t* crypt_ctx, const char * cipher_key);
     

Arguments

crypt_ctx The address of the encryption context to initialize
cipher_key The encryption key string

Description

This function prepares the encryption context by a cipher key string. This context (which is actually an encryption data table) is utilized by functions performing encryption / decryption. Note that this API assumes use of a symmetric-key algorithm which has no separated encrypt() and decrypt() functions. A single function encrypts information on first pass and decrypts it on the next.

Return Codes

void No value returned

Example

     
    {
        mco_db_h con;
        MCO_RET rc;
        const char *cipher = "my cipher key";
        mco_crypt_ctx_t crypt_ctx;
 
        ...
        rc = mco_db_connect( db_name, &con );
        if ( MCO_S_OK == rc )
        {
            algorithm = mco_crypt_init_ctx( &crypt_ctx, cipher);

            ...
            mco_db_disconnect(con);
        }
    }
     

Files

Header file:
mco.h
Source file:
mcocryptaes.c
Library:
libmcocryptaes.a
Header file:
mco.h
Source file:
mcocryptstub.c
Library:
libmcocryptstub.a