tpdecrypt — Decrypt data block
#include <atmi.h>
int tpdecrypt(char *input, long ilen, char *output, long *olen, long flags);
For XATMI client link with -latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm
For XATMI server link with -latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm
Data decrypt function. Function provides access to Enduro/X built-in encryption engine. AES-128 in CBC mode algorithm is used. By default encryption key is composed from current hostname and username, but key could be retrieved from other resources by plugin interface, if configured.
input buffer contains encrypted data with corresponding data length in ilen (number of bytes). output buffer is used for clear data with corresponding data length in olen (number of bytes in/out).
Function may work in binary mode (the input data and output data is binary). The other mode is string mode with flag TPEX_STRING, where input is expected to be Base64 encoded data and output is 0x00 terminated string.
In string mode ilen is ignored, in binary mode ilen is required and must be >*0*. olen is used for checking output buffer sizes. In case if there is no space, the error TPELIMIT is returned, and olen variable is set to estimated space required.
In the result of function olen is set to number bytes written to output buffer.
Valid flags
TPEX_STRING In this mode expected input is EOS terminated string (base64 string). On success output will contain zero byte terminated string data.