When TDE is enabled, backup files are encrypted. To perform operations on them directly, you must allow the operation to decrypt the file.
The examples on this page use the OpenSSL passphrase command from Using a passphrase to illustrate the syntax. Replace it with whichever unwrap command you actually configured for the cluster. See Choosing a key protection mechanism if you haven't chosen a mechanism yet.
Verifying a TDE-encrypted backup
To verify an encrypted backup, run pg_verifybackup, providing the same unwrap command you configured for the cluster, either as a command argument or as an environment variable.
Via command argument
pg_verifybackup --key-unwrap-command='openssl enc -d -aes-128-cbc -pbkdf2 -pass pass:<passphrase> -in "%p"' /path/to/backup
Via environment variable
export PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pbkdf2 -pass pass:<passphrase> -in "%p"' pg_verifybackup /path/to/backup
See pg_verifybackup TDE options for details.
Resynchronizing timelines on a TDE-encrypted backup
To resynchronize an encrypted cluster with its backup, run pg_rewind, providing the same unwrap command you configured for the cluster, either as a command argument or as an environment variable.
Via command argument
pg_rewind -D /var/lib/edb/as16/data --source-server="host=primary dbname=postgres" \ --key-unwrap-command='openssl enc -d -aes-128-cbc -pbkdf2 -pass pass:<passphrase> -in "%p"'
Via environment variable
export PGDATAKEYUNWRAPCMD='openssl enc -d -aes-128-cbc -pbkdf2 -pass pass:<passphrase> -in "%p"' pg_rewind -D /var/lib/edb/as16/data --source-server="host=primary dbname=postgres"
See pg_rewind TDE options for details.