Skip to content
Snippets Groups Projects
pgp-pubkey-encrypt_1.out 2.48 KiB
Newer Older
--
-- 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