This Blog describes the approach adopted to encrypt the RTF Template of BI Publisher stored in the Oracle Database. This Blog explains more on the RTF encryption assuming the audience has the working knowledge of Oracle BI Publisher.
Descriptions
Oracle BI Publisher is a reporting solution introduced by Oracle for better management and delivery of the reports. Oracle BI Publisher is a Java based reporting tool that comes within the technology stack of Oracle E-Business Suite. BI Publisher separates the Data layer and presentation layer which is something different from the Traditional Oracle reporting tool. Oracle BI Publisher Uses the Oracle Report for data query portion and ignores the report layout.
Requirement:
Oracle BI Publisher report has 2 components which are oracle report and template definition for the XML output generated from the Oracle Report. Oracle report was secured using the rwconverter.exe which converts the rdf files to rep files using the command below
Rwconvertor userid=<<apps_username>>/<<Password>> batch=yes source=<<rdf_path>> stype= rdffile dtype=repfile overwrite=yes compile_all=yes
Figure 1: Command for rwconvertor
Templates which are defined in the Template Definition screen as shown below
Above screenshot displays a sample template defined in the Payments module. All the rtf templates are stored in the XDO_LOBS.file_data column in the database which is of datatype CLOB. Oracle 11i didn’t have the features of encrypting the data which are of type CLOB but was capable of encrypting VARCHAR datatype using the public API DBMS_OBFUSCATION_TOOLKIT. Oracle 10g introduced a new package DBMS_CRYPTO which was installed in the sys schema. DBMS_CRYPTO main features are listed below and complete details on the package can be viewed on http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm
DBMS_CRYPTO Features:
- Supports RAW,CLOB and BLOB Dataypes
- Advanced Encryption Standards
- Random generation of encryption keys.
- VARCHAR2 can also be encrypted by converting the data into RAW.
Implementation Method:
DBMS_CRYPTO.ENCRYPT procedure was used to encrypt the source clob stored in the XDO_LOBS table. Below steps explains the flow of the code logic.
- Get the clob data for the rtf template to be encrypted.
SELECT file_data
INTO lb_srcblob
FROM xdo_lobs
WHERE file_name = <<RTF File name>>
AND lob_code = <<Concurrent program shortname>>
- Create a temporary clob to store the encrypted clob in the XDO_LOBS Table.
DBMS_LOB.CREATETEMPORARY(<<variable for encrypted clob>>,
TRUE,
DBMS_LOB.CALL);
DBMS_LOB.OPEN(<<variable for encrypted clob>>,
DBMS_LOB.LOB_READWRITE);
- Call the DBMS_CRYPTO.ENCRYPT procedure to encrypt the source clob.
DBMS_CRYPTO.ENCRYPT(<<variable for encrypted clob>>,
<<variable for source clob>>,
DBMS_CRYPTO.AES_CBC_PKCS5,àEncryption Technique
hextoraw ('101112131415161718191A1B1C1D1E1F00010203040123413123AECCAEBF') à Encryption key,
hextoraw('00000000000000000000000000000000') à optional parameter for block ciphers
);
- Update the encrypted clob value in the XDO_LOBS.file_data table.
- Download the encrypted rtf from the Template Definition window and try to open the same in the Word document. RTF template will not be able to open as the template is encrypted