Difference between revisions of "Pgp postgres"

From UVOO Tech Wiki
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',...")
(No difference)

Revision as of 04:19, 18 March 2024

-- 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;