PeopleSoft utility to perform base64 encoding or decoding in PeopleCode using PeopleSoft's Pluggable Cryptography Technology (PET) in combination with the PeopleCode Crypt Class.
- Define two new algorithm chains under PeopleTools > Security > Encryption > Algorithm Chain:
Algorithm Chain: BASE64_ENCODE:
1 PSUnicodeToAscii
2 base64_encode
3 PSAsciiToUnicode
Algorithm Chain: 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.
This step will import the custom menu and folder
- Launch Application Designer
- click Tools, Copy Project, From File...
- click Select, choose MXM_CUSTOM_INIT
- click Copy
This step will import the Base64 project
- click Tools, Copy Project, From File...
- click Select, choose MXM_BASE64
- click Copy
Note: Perform this step if the project contains SQL Tables otherwise skip it
- Click Build, Project...
- Check the following options:
a. Create Table
b. Create Indexes
c. Create Views
d. Execute and build script. - Click Build
- Open the component
- Click Tools, Register Component...
- Check off the following:
- Add this component to a menu
- Add this component to a portal registry
- Add this component to a permission list
- Click Next
- Select Menu Name: MXM_CUSTOM_MENU and Bar Name: USE
- Click Next
- Select Folder Name: MXM_CUSTOM
- Change Content Reference Label and Long Description fields to the title of the page
- Check off Always use default local node
- Click Next
- Select Permission List Name: PTPT1200
- Click Next
- Check off Registry entry under Add to project
- Click Finish
Record: MXM_BASE64
Type: Derived/Work
| Field | Type | Length | Long Descr | Short Descr |
|---|---|---|---|---|
| DESCRLONG1 | Long | 0 | Description | Descr |
| MXM_BASE64_ALG | Char | 4 | Algorithm | Algorithm |
| SUBMIT_BTN | Char | 1 | Submit Button | Submit |
| DESCRLONG | Long | 0 | Description | Descr |
Field Name: MXM_BASE64_ALG
Translate values
| Value | Long Name | Short Name |
|---|---|---|
| B64D | Base 64 Decode | Decode |
| B64E | Base 64 Encode | Encode |
Page: MXM_BASE64
Title: Base64 Encode/Decode
MXM_BASE64.DESCRLONG1
MXM_BASE64.MXM_BASE64_ALG
MXM_BASE64.SUBMIT_BTN
MXM_BASE64.DESCRLONG
Field Event: MXM_BASE64.SUBMIT_BTN.FieldChange
If MXM_BASE64.MXM_BASE64_ALG.Value = "B64E" Then
/* ENCODE */
&cryEncode = CreateObject("Crypt");
&cryEncode.Open("BASE64_ENCODE");
&cryEncode.UpdateData(MXM_BASE64.DESCRLONG1.Value);
&encodeResult = &cryEncode.Result;
MXM_BASE64.DESCRLONG.Value = &encodeResult;
End-If;
If MXM_BASE64.MXM_BASE64_ALG.Value = "B64D" Then
/* DECODE */
&cryDecode = CreateObject("Crypt");
&cryDecode.Open("BASE64_DECODE");
&cryDecode.UpdateData(MXM_BASE64.DESCRLONG1.Value);
&decodeResult = &cryDecode.Result;
MXM_BASE64.DESCRLONG.Value = &decodeResult;
End-If;
| Component | MXM_BASE64 |
|---|---|
| Page | MXM_BASE64 |
| Navigation | Custom Components > Base64 Encode/Decode |
| Item Label | Base64 Encode/Decode |
| Search Record | INSTALLATION |
| Add | Selected |
| Update Display | Selected |
| Disable Saving Page | Selected |
| Menu | MXM_CUSTOM_MENU |
| Bar item Name | MENUITEM |
| Portal | Employee |
| Folder Name | MXM_CUSTOM |
| Content Reference label | Base64 Encode/Decode |
| Long Description | Base64 Encode/Decode |
| Sequence Number | 0 |
| Always Use Local Node | Selected |
| Permission Lists | PTPT1200 |
| Actions | Add, Update/Display |
Oracle Support Doc ID 790153.1
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.Result;
/* DECODE */
&cryDecode = CreateObject("Crypt");
&cryDecode.Open("BASE64_DECODE");
&cryDecode.UpdateData(&encodeResult);
&decodeResult = &cryDecode.Result;
Please create a GitHub Issue for any bugs, feature requests, etc. Happy to accept pull requests too!




