5 select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'), 'key');
7 -- check whether the defaults are ok
8 select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'),
9 'key', 'expect-cipher-algo=aes128,
13 expect-s2k-digest-algo=sha1,
14 expect-compress-algo=0
17 -- maybe the expect- stuff simply does not work
18 select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'),
19 'key', 'expect-cipher-algo=bf,
23 expect-s2k-digest-algo=md5,
24 expect-compress-algo=1
28 select pgp_sym_decrypt(pgp_sym_encrypt_bytea('Binary', 'baz'), 'baz');
31 select encode(pgp_sym_decrypt_bytea(pgp_sym_encrypt('Text', 'baz'), 'baz'), 'escape');
35 select pgp_sym_decrypt(
36 pgp_sym_encrypt('Secret.', 'key', 'cipher-algo=bf'),
37 'key', 'expect-cipher-algo=bf');
38 select pgp_sym_decrypt(
39 pgp_sym_encrypt('Secret.', 'key', 'cipher-algo=aes'),
40 'key', 'expect-cipher-algo=aes128');
41 select pgp_sym_decrypt(
42 pgp_sym_encrypt('Secret.', 'key', 'cipher-algo=aes192'),
43 'key', 'expect-cipher-algo=aes192');
46 select pgp_sym_decrypt(
47 pgp_sym_encrypt('Secret.', 'key', 's2k-mode=0'),
48 'key', 'expect-s2k-mode=0');
49 select pgp_sym_decrypt(
50 pgp_sym_encrypt('Secret.', 'key', 's2k-mode=1'),
51 'key', 'expect-s2k-mode=1');
52 select pgp_sym_decrypt(
53 pgp_sym_encrypt('Secret.', 'key', 's2k-mode=3'),
54 'key', 'expect-s2k-mode=3');
57 select pgp_sym_decrypt(
58 pgp_sym_encrypt('Secret.', 'key', 's2k-count=1024'),
59 'key', 'expect-s2k-count=1024');
60 -- s2k_count rounds up
61 select pgp_sym_decrypt(
62 pgp_sym_encrypt('Secret.', 'key', 's2k-count=65000000'),
63 'key', 'expect-s2k-count=65000000');
66 select pgp_sym_decrypt(
67 pgp_sym_encrypt('Secret.', 'key', 's2k-digest-algo=sha1'),
68 'key', 'expect-s2k-digest-algo=sha1');
71 select pgp_sym_decrypt(
72 pgp_sym_encrypt('Secret.', 'key', 'sess-key=0'),
73 'key', 'expect-sess-key=0');
74 select pgp_sym_decrypt(
75 pgp_sym_encrypt('Secret.', 'key', 'sess-key=1'),
76 'key', 'expect-sess-key=1');
77 select pgp_sym_decrypt(
78 pgp_sym_encrypt('Secret.', 'key', 'sess-key=1, cipher-algo=bf'),
79 'key', 'expect-sess-key=1, expect-cipher-algo=bf');
80 select pgp_sym_decrypt(
81 pgp_sym_encrypt('Secret.', 'key', 'sess-key=1, cipher-algo=aes192'),
82 'key', 'expect-sess-key=1, expect-cipher-algo=aes192');
83 select pgp_sym_decrypt(
84 pgp_sym_encrypt('Secret.', 'key', 'sess-key=1, cipher-algo=aes256'),
85 'key', 'expect-sess-key=1, expect-cipher-algo=aes256');
88 select pgp_sym_decrypt(
89 pgp_sym_encrypt('Secret.', 'key', 'disable-mdc=1'),
90 'key', 'expect-disable-mdc=1');
93 select pgp_sym_decrypt_bytea(
94 pgp_sym_encrypt(E'1\n2\n3\r\n', 'key', 'convert-crlf=1'),
97 -- conversion should be lossless
98 select digest(pgp_sym_decrypt(
99 pgp_sym_encrypt(E'\r\n0\n1\r\r\n\n2\r', 'key', 'convert-crlf=1'),
100 'key', 'convert-crlf=1'), 'sha1') as result,
101 digest(E'\r\n0\n1\r\r\n\n2\r', 'sha1') as expect;