How to decrypt from pgp_sym_encrypt()

Hey everyone,
I have a column in my Postgres database that uses the pgp_sym_encrypt() function to encrypt each user's email using the AES-256 cypher. For eg:

SELECT pgp_sym_encrypt('myemail@gmail.com', 'mypassword', 'compress-algo=1, cipher-algo=aes256');

I am trying to use the Rust equivalent of a crate that is able to decrypt an encrypted email after receiving it from a sqlx query but I couldn't find any. I've checked aes_gcm, pgp and sequoia-openpgp but I unfortunately they did not help my case.

Any assistance would be helpful. Thanks!

Specifically how/why they did not help?

Lookup the documentation for pgp_sym_decrypt in postgres

Also remember that your column type should be bytea not text.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.