Question

How to check is the encryption is working? is there any way to see the encrypted data of postgres?

As i was following through the tutorial (https://www.digitalocean.com/community/tutorials/how-to-encrypt-a-database-at-rest-in-postgresql-on-ubuntu#method-2-encrypting-database-using-transparent-data-encryption-tde), I used the second encryption method, TDE, and successfully installed it. Now, I want to check if data encryption is occurring in real-time and find out how to confirm it.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 24, 2024

Hey!

To verify that Transparent Data Encryption is working as expected in PostgreSQL, you’re essentially looking to ensure that the data is encrypted at rest. This means that the data stored on disk is encrypted, making it unreadable without the appropriate decryption mechanism provided by PostgreSQL at runtime. Directly viewing the encrypted data to confirm encryption is a bit tricky since the goal of TDE is to be transparent to users and applications accessing the database through standard PostgreSQL interfaces.

After setting up TDE, PostgreSQL might log messages related to the encryption process during startup or when encrypting data. Review the PostgreSQL log files for any messages indicating that encryption is being initialized or used.

While PostgreSQL doesn’t provide a direct command to check if TDE is active, you can examine the data at the filesystem level. This approach requires caution and might not always be straightforward because understanding the encrypted data requires knowledge of what the unencrypted data looks like.

You can try accessing PostgreSQL data files directly from the filesystem. These files are located in the PostgreSQL data directory (base folder for table data). Without proper decryption mechanisms, the contents should be gibberish. Note that interpreting these files directly can be challenging, as PostgreSQL stores data in a format that isn’t plain text even when not encrypted.

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel