Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

TDE Column Encryption

Oracle PL/SQL tips by Boobal Ganesan

This is an excerpt from the book Advanced PL/SQL: The Definitive Reference by Boobal Ganesan.

Transparent Data Encryption (TDE) column encryption can be used for encrypting a specific column data in the database tables that are confidential, such as credit card numbers, social security numbers (SSN) and personal account numbers (PAN). This approach is useful when,

 

1.      The database tables are large.

 

2.      The columns holding the sensitive information are pre-known.

 

Oracle Enterprise Manager Sensitive Data Discovery searches for sensitive data and finds them quickly, which can be then used for encryption. These encrypted columns remain encrypted even if the storage drives are amputated by the unauthorized professionals.

 

Fig 8.1. TDE Column Encryption

In the above figure, the TDE master encryption key is stored outside the database in an external security module, which is accessible only to authorized professionals and the TDE table keys are stored in the data dictionary encrypted by the master encryption key, which is then responsible for encrypting and decrypting the column data. One table key is uniquely created for a table containing one or more encrypted column. The master encryption key stored in the external security module uses an Oracle keystore, which was called as a wallet in the previous releases.

 

TDE encryption can be performed over a set of datatypes and the size of the column to be encrypted must not exceed the maximum size defined below.

 

·         BINARY_DOUBLE

·         BINARY_FLOAT

·         CHAR (Maximum Size: 1932 bytes)

·         DATE

·         INTERVAL DAY TO SECOND

·         INTERVAL YEAR TO MONTH

·         NCHAR (Maximum Size: 966 bytes)

·         NUMBER

·         NVARCHAR2 (Maximum Size: 16,315 bytes)

·         RAW (Maximum Size: 32,699 bytes)

·         TIMESTAMP (Includes TIMESTAMP WITH LOCAL TIME ZONE and TIMESTAMP WITH TIME ZONE)

·         VARCHAR2 (Maximum Size: 32,699 bytes)

 

To create database tables with encrypted columns, we must use the ENCRYPT clause in its column definition in the CREATE TABLE statement as shown in the below example.

 

CREATE

  TABLE customer

  (

    cust_id      NUMBER,

    cust_name    VARCHAR2(100),

    cust_email   VARCHAR2(50) encrypt,

    cust_phone   NUMBER encrypt,

    cust_address VARCHAR2(3000) encrypt

  );

 

The TDE by default adds SALT (adding extra characters) to the column before its encryption. Adding SALT makes it tough for the stealers who use brute force method. We can also choose whether or not to SALT our column data before encrypting it irrespective of whether or not other encrypted columns use SALT.

 

We can also choose any other encrypting algorithm from the available list and define it through the USING clause as shown below,

 

CREATE

  TABLE customer

  (

    cust_id      NUMBER,

    cust_name    VARCHAR2(100),

    cust_email   VARCHAR2(50) encrypt no salt,

    cust_phone   NUMBER encrypt,

    cust_address VARCHAR2(3000) encrypt USING 'AES256'

  );

 

% Note: All the encrypted columns in a table must use the same encryption algorithm. If we try to use different encryption algorithms for multiple columns in the same table, we may encounter ORA-28340: a different encryption algorithm has been chosen for the table exception.

The ALTER TABLE command can be used for encrypting columns in an existing table by either adding an encrypted column or by encrypting an already existing column.

 

To add an encrypted column to an existing table in the database,

 

ALTER TABLE customer ADD (cust_ssn VARCHAR2(11) ENCRYPT USING 'AES256' salt);

 

To encrypt an existing column in a table in the database,

 

ALTER TABLE customer MODIFY (cust_name encrypt);

 

To decrypt an existing column in a table in the database,

 

ALTER TABLE customer MODIFY (cust_name decrypt);

 

To add SALT to an encrypted column in a table in the database,

 

ALTER TABLE customer MODIFY (cust_email encrypt salt);

 

To remove SALT from an encrypted column in a table in the database,

 

ALTER TABLE customer MODIFY (cust_email encrypt no salt);

 

To change the encrypted key for the table containing one or more encrypted column,

 

ALTER TABLE customer rekey;

 

To change the encryption algorithm for the table containing one or more encrypted column,

 

ALTER TABLE customer rekey USING '3DES168';

 

The TDE also adds a Message Authentication Code (MAC) to the data for integrity checking. The default integrity algorithm is SHA-1.

 

ALTER TABLE customer rekey USING '3DES168' 'SHA-1';

 

We can also use the parameter NOMAC for bypassing the integrity check, thus saving up to 20bytes of disk space per encrypted value.

 

ALTER TABLE customer rekey USING '3DES168' 'NOMAC';

 

% Note: If the encrypted column is being indexed, it must be specified without SALT. If not, we may encounter ORA-28338: cannot encrypt indexed column(s) with salt exception.

 

Need to learn to program with PL/SQL?  For complete notes on programming in PL/SQL, we recommend the book Advanced PL/SQL: The Definitive Reference by Boobal Ganesan.

This is a complete book on PL/SQL with everything you need to know to write efficient and complex PL/SQL code.

   
Oracle Training from Don Burleson 

The best on site "Oracle training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

Oracle training
 
 



 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster