Posts

Showing posts from February, 2015

How to perform base64 encoding or decoding using PeopleCode?

Define two new algorithm chains under PeopleTools > Security > Encryption > Algorithm Chain: Algorithm BASE64_ENCODE: 1 PSUnicodeToAscii 2 base64_encode 3 PSAsciiToUnicode Algorithm BASE64_DECODE: 1 PSUnicodeToAscii 2 base64_decode 3 PSAsciiToUnicode Note the sequence as they are very important and must be exactly as ordered. Define Encryption Profiles using the chains above under PeopleTools > Security > Encryption Profile. As an example here, profile names BASE64_ENCODE and BASE64_DECODE will be used for the sample code below. After the encryption profiles are set up, they can be called upon by the PeopleCode Crypt class. Example Code: Local Crypt &cryEncode, &cryDecode; Local string &encodeResult, &decodeResult; /* ENCODE */ &cryEncode = CreateObject("Crypt"); &cryEncode.Open("BASE64_ENCODE"); &cryEncode.UpdateData("This is the text to be encoded"); &encodeResult = &cryEncode.Re