Change ALTER TABLE SET WITHOUT OIDS to rewrite the whole table to physically
[PostgreSQL.git] / contrib / pgcrypto / sql / pgp-decrypt.sql
blob93535ab016ad7d66964846628350a9b52152dce4
1 --
2 -- pgp_descrypt tests
3 --
5 --  Checking ciphers
6 select pgp_sym_decrypt(dearmor('
7 -----BEGIN PGP MESSAGE-----
8 Comment: dat1.blowfish.sha1.mdc.s2k3.z0
10 jA0EBAMCfFNwxnvodX9g0jwB4n4s26/g5VmKzVab1bX1SmwY7gvgvlWdF3jKisvS
11 yA6Ce1QTMK3KdL2MPfamsTUSAML8huCJMwYQFfE=
12 =JcP+
13 -----END PGP MESSAGE-----
14 '), 'foobar');
16 select pgp_sym_decrypt(dearmor('
17 -----BEGIN PGP MESSAGE-----
18 Comment: dat1.aes.sha1.mdc.s2k3.z0
20 jA0EBwMCci97v0Q6Z0Zg0kQBsVf5Oe3iC+FBzUmuMV9KxmAyOMyjCc/5i8f1Eest
21 UTAsG35A1vYs02VARKzGz6xI2UHwFUirP+brPBg3Ee7muOx8pA==
22 =XtrP
23 -----END PGP MESSAGE-----
24 '), 'foobar');
26 select pgp_sym_decrypt(dearmor('
27 -----BEGIN PGP MESSAGE-----
28 Comment: dat1.aes192.sha1.mdc.s2k3.z0
30 jA0ECAMCI7YQpWqp3D1g0kQBCjB7GlX7+SQeXNleXeXQ78ZAPNliquGDq9u378zI
31 5FPTqAhIB2/2fjY8QEIs1ai00qphjX2NitxV/3Wn+6dufB4Q4g==
32 =rCZt
33 -----END PGP MESSAGE-----
34 '), 'foobar');
36 select pgp_sym_decrypt(dearmor('
37 -----BEGIN PGP MESSAGE-----
38 Comment: dat1.aes256.sha1.mdc.s2k3.z0
40 jA0ECQMC4f/5djqCC1Rg0kQBTHEPsD+Sw7biBsM2er3vKyGPAQkuTBGKC5ie7hT/
41 lceMfQdbAg6oTFyJpk/wH18GzRDphCofg0X8uLgkAKMrpcmgog==
42 =fB6S
43 -----END PGP MESSAGE-----
44 '), 'foobar');
46 -- Checking MDC modes
47 select pgp_sym_decrypt(dearmor('
48 -----BEGIN PGP MESSAGE-----
49 Comment: dat1.aes.sha1.nomdc.s2k3.z0
51 jA0EBwMCnv07rlXqWctgyS2Dm2JfOKCRL4sLSLJUC8RS2cH7cIhKSuLitOtyquB+
52 u9YkgfJfsuRJmgQ9tmo=
53 =60ui
54 -----END PGP MESSAGE-----
55 '), 'foobar');
57 select pgp_sym_decrypt(dearmor('
58 -----BEGIN PGP MESSAGE-----
59 Comment: dat1.aes.sha1.mdc.s2k3.z0
61 jA0EBwMCEeP3idNjQ1Bg0kQBf4G0wX+2QNzLh2YNwYkQgQkfYhn/hLXjV4nK9nsE
62 8Ex1Dsdt5UPvOz8W8VKQRS6loOfOe+yyXil8W3IYFwUpdDUi+Q==
63 =moGf
64 -----END PGP MESSAGE-----
65 '), 'foobar');
67 -- Checking hashes
68 select pgp_sym_decrypt(dearmor('
69 -----BEGIN PGP MESSAGE-----
70 Comment: dat1.aes.md5.mdc.s2k3.z0
72 jA0EBwMClrXXtOXetohg0kQBn0Kl1ymevQZRHkdoYRHgzCwSQEiss7zYff2UNzgO
73 KyRrHf7zEBuZiZ2AG34jNVMOLToj1jJUg5zTSdecUzQVCykWTA==
74 =NyLk
75 -----END PGP MESSAGE-----
76 '), 'foobar');
78 select pgp_sym_decrypt(dearmor('
79 -----BEGIN PGP MESSAGE-----
80 Comment: dat1.aes.sha1.mdc.s2k3.z0
82 jA0EBwMCApbdlrURoWJg0kQBzHM/E0o7djY82bNuspjxjAcPFrrtp0uvDdMQ4z2m
83 /PM8jhgI5vxFYfNQjLl8y3fHYIomk9YflN9K/Q13iq8A8sjeTw==
84 =FxbQ
85 -----END PGP MESSAGE-----
86 '), 'foobar');
88 -- Checking S2K modes
89 select pgp_sym_decrypt(dearmor('
90 -----BEGIN PGP MESSAGE-----
91 Comment: dat1.aes.sha1.mdc.s2k0.z0
93 jAQEBwAC0kQBKTaLAKE3xzps+QIZowqRNb2eAdzBw2LxEW2YD5PgNlbhJdGg+dvw
94 Ah9GXjGS1TVALzTImJbz1uHUZRfhJlFbc5yGQw==
95 =YvkV
96 -----END PGP MESSAGE-----
97 '), 'foobar');
99 select pgp_sym_decrypt(dearmor('
100 -----BEGIN PGP MESSAGE-----
101 Comment: dat1.aes.sha1.mdc.s2k1.z0
103 jAwEBwEC/QTByBLI3b/SRAHPxKzI6SZBo5lAEOD+EsvKQWO4adL9tDY+++Iqy1xK
104 4IaWXVKEj9R2Lr2xntWWMGZtcKtjD2lFFRXXd9dZp1ZThNDz
105 =dbXm
106 -----END PGP MESSAGE-----
107 '), 'foobar');
109 select pgp_sym_decrypt(dearmor('
110 -----BEGIN PGP MESSAGE-----
111 Comment: dat1.aes.sha1.mdc.s2k3.z0
113 jA0EBwMCEq4Su3ZqNEJg0kQB4QG5jBTKF0i04xtH+avzmLhstBNRxvV3nsmB3cwl
114 z+9ZaA/XdSx5ZiFnMym8P6r8uY9rLjjNptvvRHlxIReF+p9MNg==
115 =VJKg
116 -----END PGP MESSAGE-----
117 '), 'foobar');
119 select pgp_sym_decrypt(dearmor('
120 -----BEGIN PGP MESSAGE-----
121 Comment: dat1.aes192.sha1.mdc.s2k0.z0
123 jAQECAAC0kQBBDnQWkgsx9YFaqDfWmpsiyAJ6y2xG/sBvap1dySYEMuZ+wJTXQ9E
124 Cr3i2M7TgVZ0M4jp4QL0adG1lpN5iK7aQeOwMw==
125 =cg+i
126 -----END PGP MESSAGE-----
127 '), 'foobar');
129 select pgp_sym_decrypt(dearmor('
130 -----BEGIN PGP MESSAGE-----
131 Comment: dat1.aes192.sha1.mdc.s2k1.z0
133 jAwECAECruOfyNDFiTnSRAEVoGXm4A9UZKkWljdzjEO/iaE7mIraltIpQMkiqCh9
134 7h8uZ2u9uRBOv222fZodGvc6bvq/4R4hAa/6qSHtm8mdmvGt
135 =aHmC
136 -----END PGP MESSAGE-----
137 '), 'foobar');
139 select pgp_sym_decrypt(dearmor('
140 -----BEGIN PGP MESSAGE-----
141 Comment: dat1.aes192.sha1.mdc.s2k3.z0
143 jA0ECAMCjFn6SRi3SONg0kQBqtSHPaD0m7rXfDAhCWU/ypAsI93GuHGRyM99cvMv
144 q6eF6859ZVnli3BFSDSk3a4e/pXhglxmDYCfjAXkozKNYLo6yw==
145 =K0LS
146 -----END PGP MESSAGE-----
147 '), 'foobar');
149 select pgp_sym_decrypt(dearmor('
150 -----BEGIN PGP MESSAGE-----
151 Comment: dat1.aes256.sha1.mdc.s2k0.z0
153 jAQECQAC0kQB4L1eMbani07XF2ZYiXNK9LW3v8w41oUPl7dStmrJPQFwsdxmrDHu
154 rQr3WbdKdY9ufjOE5+mXI+EFkSPrF9rL9NCq6w==
155 =RGts
156 -----END PGP MESSAGE-----
157 '), 'foobar');
159 select pgp_sym_decrypt(dearmor('
160 -----BEGIN PGP MESSAGE-----
161 Comment: dat1.aes256.sha1.mdc.s2k1.z0
163 jAwECQECKHhrou7ZOIXSRAHWIVP+xjVQcjAVBTt+qh9SNzYe248xFTwozkwev3mO
164 +KVJW0qhk0An+Y2KF99/bYFl9cL5D3Tl43fC8fXGl3x3m7pR
165 =SUrU
166 -----END PGP MESSAGE-----
167 '), 'foobar');
169 select pgp_sym_decrypt(dearmor('
170 -----BEGIN PGP MESSAGE-----
171 Comment: dat1.aes256.sha1.mdc.s2k3.z0
173 jA0ECQMCjc8lwZu8Fz1g0kQBkEzjImi21liep5jj+3dAJ2aZFfUkohi8b3n9z+7+
174 4+NRzL7cMW2RLAFnJbiqXDlRHMwleeuLN1up2WIxsxtYYuaBjA==
175 =XZrG
176 -----END PGP MESSAGE-----
177 '), 'foobar');
179 -- Checking longer passwords
180 select pgp_sym_decrypt(dearmor('
181 -----BEGIN PGP MESSAGE-----
182 Comment: dat1.aes.sha1.mdc.s2k3.z0
184 jA0EBwMCx6dBiuqrYNRg0kQBEo63AvA1SCslxP7ayanLf1H0/hlk2nONVhTwVEWi
185 tTGup1mMz6Cfh1uDRErUuXpx9A0gdMu7zX0o5XjrL7WGDAZdSw==
186 =XKKG
187 -----END PGP MESSAGE-----
188 '), '0123456789abcdefghij');
190 select pgp_sym_decrypt(dearmor('
191 -----BEGIN PGP MESSAGE-----
192 Comment: dat1.aes.sha1.mdc.s2k3.z0
194 jA0EBwMCBDvYuS990iFg0kQBW31UK5OiCjWf5x6KJ8qNNT2HZWQCjCBZMU0XsOC6
195 CMxFKadf144H/vpoV9GA0f22keQgCl0EsTE4V4lweVOPTKCMJg==
196 =gWDh
197 -----END PGP MESSAGE-----
198 '), '0123456789abcdefghij2jk4h5g2j54khg23h54g2kh54g2khj54g23hj54');
200 select pgp_sym_decrypt(dearmor('
201 -----BEGIN PGP MESSAGE-----
202 Comment: dat1.aes.sha1.mdc.s2k3.z0
204 jA0EBwMCqXbFafC+ofVg0kQBejyiPqH0QMERVGfmPOjtAxvyG5KDIJPYojTgVSDt
205 FwsDabdQUz5O7bgNSnxfmyw1OifGF+W2bIn/8W+0rDf8u3+O+Q==
206 =OxOF
207 -----END PGP MESSAGE-----
208 '), 'x');
210 -- Checking various data
211 select encode(digest(pgp_sym_decrypt(dearmor('
212 -----BEGIN PGP MESSAGE-----
213 Comment: dat1.aes.sha1.mdc.s2k3.z0
215 jA0EBwMCGJ+SpuOysINg0kQBJfSjzsW0x4OVcAyr17O7FBvMTwIGeGcJd99oTQU8
216 Xtx3kDqnhUq9Z1fS3qPbi5iNP2A9NxOBxPWz2JzxhydANlgbxg==
217 =W/ik
218 -----END PGP MESSAGE-----
219 '), '0123456789abcdefghij'), 'sha1'), 'hex');
220 -- expected: 0225e3ede6f2587b076d021a189ff60aad67e066
222 select encode(digest(pgp_sym_decrypt(dearmor('
223 -----BEGIN PGP MESSAGE-----
224 Comment: dat2.aes.sha1.mdc.s2k3.z0
226 jA0EBwMCvdpDvidNzMxg0jUBvj8eS2+1t/9/zgemxvhtc0fvdKGGbjH7dleaTJRB
227 SaV9L04ky1qECNDx3XjnoKLC+H7IOQ==
228 =Fxen
229 -----END PGP MESSAGE-----
230 '), '0123456789abcdefghij'), 'sha1'), 'hex');
231 -- expected: da39a3ee5e6b4b0d3255bfef95601890afd80709
233 select encode(digest(pgp_sym_decrypt(dearmor('
234 -----BEGIN PGP MESSAGE-----
235 Comment: dat3.aes.sha1.mdc.s2k3.z0
237 jA0EBwMCxQvxJZ3G/HRg0lgBeYmTa7/uDAjPyFwSX4CYBgpZWVn/JS8JzILrcWF8
238 gFnkUKIE0PSaYFp+Yi1VlRfUtRQ/X/LYNGa7tWZS+4VQajz2Xtz4vUeAEiYFYPXk
239 73Hb8m1yRhQK
240 =ivrD
241 -----END PGP MESSAGE-----
242 '), '0123456789abcdefghij'), 'sha1'), 'hex');
243 -- expected: 5e5c135efc0dd00633efc6dfd6e731ea408a5b4c
245 -- Checking CRLF
246 select encode(digest(pgp_sym_decrypt(dearmor('
247 -----BEGIN PGP MESSAGE-----
248 Comment: crlf mess
250 ww0ECQMCt7VAtby6l4Bi0lgB5KMIZiiF/b3CfMfUyY0eDncsGXtkbu1X+l9brjpMP8eJnY79Amms
251 a3nsOzKTXUfS9VyaXo8IrncM6n7fdaXpwba/3tNsAhJG4lDv1k4g9v8Ix2dfv6Rs
252 =mBP9
253 -----END PGP MESSAGE-----
254 '), 'key', 'convert-crlf=0'), 'sha1'), 'hex');
255 -- expected: 9353062be7720f1446d30b9e75573a4833886784
257 select encode(digest(pgp_sym_decrypt(dearmor('
258 -----BEGIN PGP MESSAGE-----
259 Comment: crlf mess
261 ww0ECQMCt7VAtby6l4Bi0lgB5KMIZiiF/b3CfMfUyY0eDncsGXtkbu1X+l9brjpMP8eJnY79Amms
262 a3nsOzKTXUfS9VyaXo8IrncM6n7fdaXpwba/3tNsAhJG4lDv1k4g9v8Ix2dfv6Rs
263 =mBP9
264 -----END PGP MESSAGE-----
265 '), 'key', 'convert-crlf=1'), 'sha1'), 'hex');
266 -- expected: 7efefcab38467f7484d6fa43dc86cf5281bd78e2