Difference between revisions of "Pgp postgres"
Jump to navigation
Jump to search
(Created page with "``` -- Assuming you have a public key named 'my_public_key' already imported into your keyring -- Encrypting a message SELECT pgp_pub_encrypt( 'Your secret message here',...") |
|||
| Line 1: | Line 1: | ||
| + | https://hardyantz.medium.com/data-encryption-in-postgresql-a4b51a60dfc2 | ||
| + | |||
| + | |||
``` | ``` | ||
-- Assuming you have a public key named 'my_public_key' already imported into your keyring | -- Assuming you have a public key named 'my_public_key' already imported into your keyring | ||
Latest revision as of 04:24, 18 March 2024
https://hardyantz.medium.com/data-encryption-in-postgresql-a4b51a60dfc2
-- Assuming you have a public key named 'my_public_key' already imported into your keyring
-- Encrypting a message
SELECT pgp_pub_encrypt(
'Your secret message here',
keys.keydata
) AS encrypted_message
FROM (
SELECT pgp_pub_decrypt(key, 'my_secret_passphrase') AS keydata
FROM pgp_keys
WHERE key_id = 'my_public_key'
) AS keys;