152 Informix Dynamic Server 11: Advanced Functionality for Modern Business
WHERE call_code = 'L'
;
decrypted_code L
decrypted_descrip+ late shipment
1 row(s) retrieved.
5.3.3 Retrieving encrypted data
As Example 5-8 on page 149 and Example 5-9 on page 151 show, encrypted
data is retrieved using the decrypt_char() function. This function knows from the
encrypted string how to do the decryption for either encryption function.
The returned value has the same size as the original unencrypted data. You do
not need to have variables as large as the encrypted data.
BLOB data is encrypted in the same way as character data. However, you
retrieve the BLOB data using the DECRYPT_BINARY() function.
Example 5-10 demonstrates the DECRYPT_BINARY() function. We alter the
catalog table in the stores database.
Example 5-10 Decrypting binary data
C:\idsdemos\stores9>dbaccess -e stores9 example9
Database selected.
ALTER TABLE catalog ADD adstuff BLOB;
Table altered.
ALTER TABLE catalog ADD enc_stuff BLOB;
Table altered.
UPDATE catalog
SET adstuff = FILETOBLOB ('c:\informix\gif','server')
WHERE catalog_num =10031
;
1 row(s) updated.
SET ENCRYPTION PASSWORD "Erasmo";
Encryption password set.
UPDATE catalog
SET enc_stuff = ENCRYPT_AES (adstuff)
WHERE catalog_num =10031
;
1 row(s) updated.

Get Informix Dynamic Server 11: Advanced Functionality for Modern Business now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.