mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-02 01:07:21 +02:00
63 lines
2.5 KiB
Plaintext
63 lines
2.5 KiB
Plaintext
|
--
|
||
|
-- PGP Public Key Encryption
|
||
|
--
|
||
|
-- ensure consistent test output regardless of the default bytea format
|
||
|
SET bytea_output TO escape;
|
||
|
-- successful encrypt/decrypt
|
||
|
select pgp_pub_decrypt(
|
||
|
pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
|
||
|
dearmor(seckey))
|
||
|
from keytbl where keytbl.id=1;
|
||
|
ERROR: pg_random_bytes() is not supported by this build
|
||
|
DETAIL: This functionality requires a source of strong random numbers
|
||
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|
||
|
select pgp_pub_decrypt(
|
||
|
pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
|
||
|
dearmor(seckey))
|
||
|
from keytbl where keytbl.id=2;
|
||
|
ERROR: pg_random_bytes() is not supported by this build
|
||
|
DETAIL: This functionality requires a source of strong random numbers
|
||
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|
||
|
select pgp_pub_decrypt(
|
||
|
pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
|
||
|
dearmor(seckey))
|
||
|
from keytbl where keytbl.id=3;
|
||
|
ERROR: pg_random_bytes() is not supported by this build
|
||
|
DETAIL: This functionality requires a source of strong random numbers
|
||
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|
||
|
select pgp_pub_decrypt(
|
||
|
pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
|
||
|
dearmor(seckey))
|
||
|
from keytbl where keytbl.id=6;
|
||
|
ERROR: pg_random_bytes() is not supported by this build
|
||
|
DETAIL: This functionality requires a source of strong random numbers
|
||
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|
||
|
-- try with rsa-sign only
|
||
|
select pgp_pub_decrypt(
|
||
|
pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
|
||
|
dearmor(seckey))
|
||
|
from keytbl where keytbl.id=4;
|
||
|
ERROR: No encryption key found
|
||
|
-- try with secret key
|
||
|
select pgp_pub_decrypt(
|
||
|
pgp_pub_encrypt('Secret msg', dearmor(seckey)),
|
||
|
dearmor(seckey))
|
||
|
from keytbl where keytbl.id=1;
|
||
|
ERROR: Refusing to encrypt with secret key
|
||
|
-- does text-to-bytea works
|
||
|
select pgp_pub_decrypt_bytea(
|
||
|
pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
|
||
|
dearmor(seckey))
|
||
|
from keytbl where keytbl.id=1;
|
||
|
ERROR: pg_random_bytes() is not supported by this build
|
||
|
DETAIL: This functionality requires a source of strong random numbers
|
||
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|
||
|
-- and bytea-to-text?
|
||
|
select pgp_pub_decrypt(
|
||
|
pgp_pub_encrypt_bytea('Secret msg', dearmor(pubkey)),
|
||
|
dearmor(seckey))
|
||
|
from keytbl where keytbl.id=1;
|
||
|
ERROR: pg_random_bytes() is not supported by this build
|
||
|
DETAIL: This functionality requires a source of strong random numbers
|
||
|
HINT: You need to rebuild PostgreSQL using --enable-strong-random
|