Oracle DBMS_TDE_TOOLKIT_FFI
Version 12.1.0.2

General Information
Library Note Morgan's Library Page Footer
The Library is currently in the process of being upgraded from Oracle Database Version 12.1.0.1 to 12.1.0.2. Demos are being upgraded to reflect the new Container paradigm as well as EBR (Edition Based Redefinition) and may contain references to CDBs, PDBs, and other objects you may not be familiar with such as CDB_OBJECTS_AE: Welcome to 12c.

Interested in Oracle GoldenGate? Check out the IGGOUG,
Purpose Utilities supporting Transparent Data Encryption and DataPump
AUTHID DEFINER
Dependencies
DBMS_TDE_TOOLKIT TDE_LIBRARY  
Documented No
First Available Not known
Security Model Owned by SYS with no privileges granted
Source {ORACLE_HOME}/rdbms/admin/prvtdtde.plb
Subprograms
 
DATAPUMP_DECRYPT
Decrypts strings for DataPump dbms_tde_toolkit.datapump_encrypt(
instring  IN  RAW,
outstring OUT RAW,
keyid     IN  RAW);
-- the use of StrPt1 to 3 is for webpage formatting only. The string used for testing is the one generated by the encrypt procedure below

DECLARE
 StrPt1  VARCHAR2(40) := '851714F5659E6983D619C768CC5F47CC818351EC';
 StrPt2  VARCHAR2(40) := '9F4809184EE13C2E9ECB490881D454B336E194A0';
 StrPt3  VARCHAR2(40) := 'AB47D616703F598F885AC1575437EF326A3';
 TestStr VARCHAR2(128) := StrPt1 || StrPt2 || StrPt3;
 TestVal RAW(128) := utl_raw.cast_to_raw(TestStr);
 RetKey  RAW(128) := utl_raw.cast_to_raw('abcdefgh');
 RetStr  RAW(2000);
BEGIN
  dbms_tde_toolkit_ffi.datapump_encrypt(TestVal, RetStr, RetKey);
  dbms_output.put_line(RetStr);
END;
/
 
DATAPUMP_ENCRYPT
Encrypts strings for DataPump dbms_tde_toolkit.datapump_decrypt(
instring  IN  RAW,
outstring OUT RAW,
keyid     OUT RAW);
conn / as sysdba

set serveroutput on

DECLARE
 l_credit_card_no VARCHAR2(19) := '1612-1791-1809-2605';
 l_ccn_raw RAW(128) := utl_raw.cast_to_raw(l_credit_card_no);
 RetKey    RAW(128);
 RetStr    RAW(128);
BEGIN
  dbms_tde_toolkit_ffi.datapump_encrypt(l_ccn_raw, RetStr, RetKey);
  dbms_output.put_line(RetStr);
  dbms_output.put_line(RetKey);
END;
/
-- the following exception is generated if a wallet does not exist or exists and is not open
DECLARE
*
ERROR at line 1:
ORA-28365: wallet is not open
ORA-06512: at "SYS.DBMS_TDE_TOOLKIT_FFI", line 5
ORA-06512: at line 7

-- for instructions on creating a wallet follow the link at page bottom
ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY "N0way!";

DECLARE
 l_credit_card_no VARCHAR2(19) := '1612-1791-1809-2605';
 l_ccn_raw RAW(128) := utl_raw.cast_to_raw(l_credit_card_no);
 RetKey    RAW(128);
 RetStr    RAW(128);
BEGIN
  dbms_tde_toolkit_ffi.datapump_encrypt(l_ccn_raw, RetStr, RetKey);
  dbms_output.put_line(RetStr);
  dbms_output.put_line(RetKey);
END;
/

Related Topics
DBMS_CRYPTO
Packages
Security
Transparent Data Encryption
Wallet

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2014 Daniel A. Morgan All Rights Reserved