QMDecrypt()

Top  Previous  Next

 

The QMDecrypt() function decrypts data that has been encrypted for secure storage or transmission. It is analogous to the QMBasic DECRYPT() function.

 

 

Format

 

VBQMDecrypt(ByVal Data as String, ByVal KeyString as String) as String

 

Cchar * QMDecrypt(char * Data, char * KeyString)

 

where

 

Datais the encrypted data to be decrypted.

 

KeyStringis the encryption key to be used.

 

 

The QMDecrypt() function applies the AES 128 bit encryption algorithm to the supplied data and returns the decrypted text. The key string may be up to 64 characters in length and may contain any character. It is automatically transformed into a form that is useable by the AES algorithm. For optimum data security, the key should be about 16 characters.

 

The encrypted data is structured so that it can never contain characters from the C0 control group (characters 0 to 31) or the mark characters. As a result of this operation, the encrypted data is slightly longer than the decrypted data.

 

Note that in the C API library, a statement of the form

rec = QMDecrypt(data, key)

will return a pointer to a newly allocated memory area that must be released using QMFree() when no longer needed.

 

This function is evaluated on the client system and does not require a server connection to be open.

 

 

Examples

 

VB

X = QMDecrypt(VAR, "MyKey")

C

X = QMDecrypt(VAR, "MyKey");

 

The above example decrypts the data in variable VAR using an encryption key of "MyKey".

 

 

See also:

QMEncrypt()