Invoking Encryption Profiles from PeopleCode

You access the encryption profile using the PeopleCode Crypt class.

This is an example of PeopleCode that invokes an encryption profile called CRYPT_WRK.CRYPT_PRFL_ID.

In the example the UpdateData method is the encrypt/decrypt command.

&cry = CreateObject("Crypt");
&bar = CRYPT_WRK.CRYPT_PRFL_ID;

/* &cry.Open(<profile name>) is a required command that must be used */ 
/* before any data can be encrypted or decrypted by the named profile.*/
&cry.Open(&bar);

/* UpdateData() is the encrypt/decrypt command. */
&cry.UpdateData(CRYPT_WRK.DESCRLONG);
DERIVED_CRYPT.DESCRLONG = &cry.Result;

/*If there is no Result, then maybe we are running a verify routine.*/

If None(DERIVED_CRYPT.DESCRLONG) Then
   DERIVED_CRYPT.DESCRLONG = &cry.Verified;
End-If;