mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-23 14:30:40 +02:00
Previously, gen_random_uuid() would fall back to a weak random number generator, unlike gen_random_bytes() which would just fail. And this was not made very clear in the docs. For consistency, also make gen_random_uuid() fail outright, if compiled with --disable-strong-random. Re-word the error message you get with --disable-strong-random. It is also used by pgp functions that require random salts, and now also gen_random_uuid(). Reported by Radek Slupik. Discussion: https://www.postgresql.org/message-id/20170101232054.10135.50528@wrigleys.postgresql.org
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: generating random data 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: generating random data 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: generating random data 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: generating random data 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: generating random data 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: generating random data 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
|