The column encryption feature, provided by Data Security Center (DSC), allows you to encrypt sensitive data in columns of your ApsaraDB RDS for PostgreSQL instance. This prevents unauthorized personnel from accessing plaintext data using cloud platform software or database connection tools. The feature ensures that data is always available to authorized applications but remains unreadable in the database itself, protecting against internal and external threats. This makes your data on the cloud a truly private asset.
Prerequisites
-
The instance has a major engine version of ApsaraDB RDS for PostgreSQL 16 and a minor engine version of 20250228 or later.
-
The instance is in one of the following regions:
Region type
Region
Chinese mainland
China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Guangzhou), and China (Chengdu).
Outside the Chinese mainland
China (Hong Kong), Singapore (Singapore), Malaysia (Kuala Lumpur), Indonesia (Jakarta), and Germany (Frankfurt).
Overview
The column encryption feature for ApsaraDB RDS for PostgreSQL uses the AES-256-GCM algorithm and local key encryption. You can configure encryption for sensitive columns to ensure data is stored as ciphertext. Authorized users can then access the plaintext data by using a client, such as the column encryption driver (JDBC), for decryption. You can select and modify the scope of encryption, including the ApsaraDB RDS for PostgreSQL instance, database, tables, and columns, at any time.
Preparations
Before you enable column encryption, you must complete the following steps in order: activate or upgrade DSC, authorize DSC to access cloud resources, authorize database assets, and connect to the database to run a sensitive data identification task.
1. Activate or upgrade DSC
2. Authorize cloud resource access
3. Authorize database assets
4. Connect and identify sensitive data
Enable column encryption
-
Log on to the Data Security Center console. In the left-side navigation pane, choose .
ImportantThe Encryption Check column must show Passed before you can configure column encryption for the database. If it shows Failed, the major or minor engine version of the database may not support column encryption. For more information, see FAQ in this topic.
-
Click Rapid Encryption above the database instance list to configure column encryption for all unencrypted columns.
Alternatively, click Rapid Encryption in the Actions column of a specific database instance to configure column encryption only for that instance.
-
In the Encryption Configuration panel, select the Asset Type, Instance name, and Plaintext Permission Accounts. Then, select the target Databases, Table, and Column to encrypt, and click OK. Note the following:
-
ApsaraDB RDS for PostgreSQL supports only the
AES-256-GCMencryption algorithm and the local encryption method. -
After encryption is configured, database accounts default to Ciphertext Permission (JDBC Decryption). By default, these accounts access the ciphertext of encrypted columns. You can use client-side code with a local key to decrypt the data and view the original plaintext.
-
If you need to directly access plaintext data, add the corresponding database account to the Plaintext Permission Accounts list. This grants the account Plaintext Permission, allowing it to directly access the plaintext data of encrypted columns.
ImportantIf you need to perform sensitive data classification and grading on the latest data in the database, the database account used as the credential (the account used to connect DSC to the ApsaraDB RDS for PostgreSQL instance) must have Plaintext Permission.
-
Modify column encryption
Encryption scope
After you enable column encryption, you can modify the scope of encrypted columns by individually enabling or disabling the feature for specific columns within the database instance based on your needs.
-
Log on to the Data Security Center console. In the left-side navigation pane, choose .
-
In the instance list, expand the target instance. In the database list, find the target Databases, Table, and Column name, and click Enable Encryption or Disable Encryption to configure encryption for that column.
Account permissions
Except for accounts that have been granted Plaintext Permissions, all other accounts in the database instance have Ciphertext Permission (JDBC Decryption). You can change an account's permission to Plaintext Permissions or Ciphertext Permission (JDBC Decryption) based on your business needs.
-
Log on to the Data Security Center console.
-
On the page, click Permission Settings in the Accounts area.
Alternatively, in the Actions column of the instance list, click Edit. In the Edit panel, click Configure for Account Permissions.
-
In the Permission Settings panel, search for the target instance and account to view the current permissions.
NoteIf a newly added database account is not listed, perform Asset synchronization first and then check again.
-
In the Actions column for the target account, click Modify Permissions.
You can also select multiple target accounts with the same permission and click Batch Modify Permissions below the list.
-
In the Modify Permissions dialog box, select the target permission and click OK.
Verify column encryption
You can configure database column encryption and database account permissions to verify the encryption result.
-
Connect an ApsaraDB RDS for PostgreSQL 16 instance to DSC and complete sensitive data classification and grading. Enable column encryption for a specific column in the RDS instance, such as the
birth_datecolumn in thestudents01table. Then, set the permission for one database account to Plaintext Permissions and leave another account with Ciphertext Permission (JDBC Decryption). On the column encryption status page for the data table, the birth_date column of the public.students01 table in the testdb01 database has encryption enabled (sensitivity level S2, labeled as personal information, with the AES_256_GCM encryption algorithm), while the other columns (name, sid, id, extra_info, gender) are not encrypted. -
Use an account with Ciphertext Permission (JDBC Decryption) to log on to the database by using Data Management Service (DMS). Run the
SELECT * FROM students01;statement to view the data table. When queried with an account that has Ciphertext Permission (JDBC Decryption), thebirth_datecolumn returns an encrypted ciphertext string instead of a plaintext date. -
Use an account with Clear text permission to log on to the database by using Data Management Service (DMS). Run the
SELECT * FROM students01;statement to view the data table. The encrypted column returns plaintext data.
Client usage
If your database account has Ciphertext Permission (JDBC Decryption), you can use the column encryption driver (JDBC) to connect to the target RDS database. This allows your Java application to access encrypted column data. The JDBC driver automatically decrypts the ciphertext and returns plaintext data, making the process transparent to the application. For more information, see column encryption driver (JDBC).
FAQ
Failed encryption check
Related content
For more information about the features and principles of database column encryption, see Column encryption overview.
If sensitive column data changes after authorization, you must perform a rescan. For more information, see Scan sensitive data by using identification tasks.
