A Guide to Transparent Data Encryption in PostgreSQL

Introduction

In the past decade, Data Security has become one of the biggest concerns for both small and large organizations. With more and more data breaches occurring every day, and legislators struggling to keep up with innovation, it is essential to protect sensitive data by all means necessary. Therefore, the first defense mechanism of every organization should be setting up proper network access and firewalls to prevent unauthorized access and secure all the endpoints.

However, security analysts should always work under the assumption that an attacker will find a way to break into a system. This is where encryption becomes crucial. Data encryption is a method by which one transforms data to make it ineligible by rewriting it in some code. Data encryption is not a new concept. We have been using various encryption techniques from ancient times to protect information from enemies in a data breach. However, encryption has come a long way in the past decade or two.

Transparent Data Encryption, or TDE, is used to secure the data at rest. In other words, it encrypts the data in a database to prevent an attacker from reading the data if they break the first line of defense.

How Does Transparent Data Encryption Work?

The inner workings of Transparent Data Encryption are pretty simple. A TDE does real-time Input/Output encryption and description of the data in the database. When you first enter some data, Transparent Data Encryption uses a database encryption key or a DEK to encrypt the data.

The data will be stored in encrypted form, and whenever you request some data from the database, you provide an authorization key or whitelist the IP address in the database. Transparent Data Encryption will then decrypt the data as it is being sent to you.

Usually, the database boot record will save the database encryption key. You can use the saved key in the boot record to receive the data if you forget the key. The database encryption key or the DEK is a symmetric key and is usually secured by a certificate stored in the server’s master database. You can also secure a database encryption key using an asymmetric key that an Extensible Key Management (EKM) module stores.

One of the best things about Transparent Data Encryption is that it helps you follow various guidelines of the data storage industry. Transparent Data Encryption makes it simpler for an application developer to work on the data as they don’t have to design logic to encrypt the data again. Using Transparent Data Encryption, developers can encrypt the data using AES, 3DS, or any standard data encryption algorithm.

Transparent Data Encryption does not guarantee the security of your data. It merely delays the attacker from being able to convert the data into a legible form. Security is not always in our hands, but when it is, in cases like these, we can make the best use of it. In this case, using a 128-bit key will make the attacker’s work a herculean task. It takes around one billion billion years for someone to crack a 128-bit key using brute force. An attacker will have to resort to social engineering to get rough information on the key, so ensure that you implement the best anti-social engineering methods in your organization.

What Could Happen If We Don’t Use Transparent Data Encryption?

Transparent Data Encryption is essential to ensure that the data stays safe even if the outer defense layers are broken. In today’s IT space, organizations are being attacked by hackers left and right. Even though we cannot completely prevent the attacks, encryption is the best way to ensure that data stays safe even in an attack.

One of the first things every database administrator checks is whether the data at rest is encrypted. Defense in depth (DiD) is a set of principles and techniques that help protect an organization’s data even in a breach, and encryption is the first step in this process.

If we don’t use transparent data encryption, the data at rest will be at very high risk. Every security system should be designed with the assumption that an attacker can find their way into the network through one means or the other. Without Transparent Data Encryption, a security plan will fall apart rather quickly.

Data encryption has become a major part of the security standard in the past decade. As a result, there haven’t been too many cases in which the data was completely unencrypted. However, there have been cases in which the encryption was not good enough.

One such case was the Zynga data breach. According to this case study, Zynga used an SHA-1 encryption algorithm to store users’ passwords. Unfortunately, the encryption was not strong enough, and an attacker named ‘Gnosticplayers’ breached the database obtaining millions of users’ data.

The above incident didn’t have to be so complicated. Using a strong Transparent Data Encryption could have easily stopped or delayed the attacker’s attempts. Furthermore, using Transparent Data Encryption could have helped control many similar incidents as the Zynga data breach. Today, most companies realized the importance of Transparent Data Encryption and are actively using it to secure the data. Even database providers like IBM Cloudant, Azure SQL Database are offering Transparent Data Encryption by default.

What Kinds of Encryption Are Available?

The first thing you need to do is to decide on an encryption level for your PostgreSQL instance. However, before you can decide which  balance of security considerations, performance, stability, and ease of use is the right one, let’s review the overall architecture of PostgreSQL: