C$ENCRYPT
The C$ENCRYPT library routine encrypts data using a specific symmetric-key algorithm.
The algorithm is specified by the iscobol.crypt.algorithm configuration property.
Syntax:
 CALL "C$ENCRYPT" USING clearText
                        password
                        encryptedText
                       [errorDescription]
                 GIVING returnCode
Parameters:
clearText
PIC X(n)
Specifies the text to be encrypted.
password
PIC X(n)
Specifies the encryption key to be used.
encryptedText
PIC X(n)
Returns the encrypted text.
errorDescription
PIC X(n)
Optional parameter. It returns the Java exception behind a failed encryption.
Return code:
returnCode can be any numeric data item and provides additional information:
0
Operation successful.
-1
Error occurred.
Examples:
Example - Encrypt then decrypt a text using the AES algorithm:
       WORKING-STORAGE SECTION.
       77  secret     pic x(16value "0123456789ABCDEF".
       77  clear-text pic x(15value "some text".
       77  crypt-text pic x(16).
       77  dcrpt-text pic x(15).  
 
       PROCEDURE DIVISION.
 
       MAIN.
           set environment "crypt.algorithm" to "AES".
           call "C$ENCRYPT" using clear-text secret crypt-text.
           display crypt-text.
           call "C$DECRYPT" using crypt-text secret dcrpt-text.
           display dcrpt-text.