CREATE EXTENSION IF NOT EXISTS pgcrypto;

SELECT set_config('client_server.shared_secret',
                  encode(gen_random_bytes(32), 'hex'), false) AS shared_secret
\gset

\set access_password 'my access password'

\set enc `echo :'access_password' | tr -d '\n' | gpg2 --symmetric --batch --cipher-algo AES256 --passphrase :'shared_secret' | xxd -p | tr -d '\n'`

SELECT encode(pgp_sym_decrypt_bytea(decode(:'enc', 'hex'), current_setting('client_server.shared_secret'), 'cipher-algo=aes256'), 'escape');
