Merge branch 'upstream' into experimental
Daniel Kahn Gillmor
7 years ago
0 | 2017-03-28 Werner Koch <wk@gnupg.org> | |
1 | ||
2 | Release 1.9.0. | |
3 | + commit aa0390ec3b910bbbc323a15ec3c3351e77785a9a | |
4 | * configure.ac <c>: Bump LT version to C29/A18/R0. | |
5 | <cpp>: Bump LT version to C10/A4/R0. | |
6 | <qt>: Bump LT version to C9/A2/R0. | |
7 | ||
8 | core: Prepare for new key listing data send by gpg. | |
9 | + commit 813ae5fa2d712aa9679b791c67c9c1c43d36ffe4 | |
10 | * src/gpgme.h.in (gpgme_user_id_t): New fields 'origin' and | |
11 | 'last_update'. | |
12 | (gpgme_key_t): New fields 'origin' and 'last_update'. | |
13 | * src/conversion.c (_gpgme_parse_timestamp_ul): New. | |
14 | * src/keylist.c (keylist_colon_handler): Parse fields 19 and 20. | |
15 | ||
16 | * tests/run-keylist.c (main): Print new fields. | |
17 | ||
18 | 2017-03-27 Andre Heinecke <aheinecke@intevation.de> | |
19 | ||
20 | qt: Disable testEncryptDecryptNowrap. | |
21 | + commit 57d60b20f16dd5f1bccbbcaa0a6ed75a554a6414 | |
22 | * lang/qt/tests/t-encrypt.cpp (EncryptTest::testEncryptDecryptNowrap): | |
23 | Disable test. | |
24 | ||
25 | 2017-03-27 Justus Winter <justus@g10code.com> | |
26 | ||
27 | python: Skip tests if running with GnuPG < 2.1.12. | |
28 | + commit 348da58fe0c3656e6177c98fef6b4c4331326c8e | |
29 | * lang/python/tests/support.py (assert_gpg_version): Fix error | |
30 | message. Skip all tests when we use GnuPG older than 2.1.12. | |
31 | ||
32 | 2017-03-24 Andre Heinecke <aheinecke@intevation.de> | |
33 | ||
34 | cpp: Respect decrypt flags in new functions. | |
35 | + commit 18b7906078cf08962c54c1e711cf2d91a24fd4e5 | |
36 | * lang/cpp/src/context.cpp: Respect directly provided flags | |
37 | in the new decrypt functions. | |
38 | ||
39 | qt: Add unittest for decrypt unwrap. | |
40 | + commit 5493164f8665fabf795f3b34a7084770a38ae940 | |
41 | * lang/qt/tests/t-encrypt.cpp | |
42 | (EncryptTest::testEncryptDecryptNowrap): New. | |
43 | ||
44 | cpp: Use gpgme_op_decrypt_ex and add new flags. | |
45 | + commit 8ad37ecc297f208d0a63783c1ffae33ad4c3c81a | |
46 | * lang/cpp/src/context.cpp: New decrypt and decryptVerify functions | |
47 | that take flags as arguments. Use new variants in old functions. | |
48 | (Context::setDecryptionFlags): New helper. | |
49 | (Context::Private::Private): Initialize new member. | |
50 | * lang/cpp/src/context_p.h (Context::Private::decryptFlags): New. | |
51 | * lang/cpp/src/context.h (Context::DecryptFlags): New enum. | |
52 | (Context::EncryptionFlags): Extend for EncryptWrap. | |
53 | ||
54 | 2017-03-24 Werner Koch <wk@gnupg.org> | |
55 | ||
56 | core: New flags GPGME_DECRYPT_UNWRAP and GPGME_ENCRYPT_WRAP. | |
57 | + commit 6ac1f2cdedb085b4ac9372c1e591497e2e618de4 | |
58 | * src/gpgme.h.in (GPGME_ENCRYPT_WRAP): New const. | |
59 | (gpgme_decrypt_flags_t): New enum. | |
60 | (GPGME_DECRYPT_VERIFY): New const | |
61 | (GPGME_DECRYPT_UNWRAP): New const | |
62 | (gpgme_op_decrypt_ext_start): New func. | |
63 | (gpgme_op_decrypt_ext): New func. | |
64 | * src/decrypt-verify.c (gpgme_op_decrypt_ext_start): New. | |
65 | (gpgme_op_decrypt_ext): New. | |
66 | (decrypt_verify_start): Add arg FLAGS. Replace call to | |
67 | engine_op_decrypt_verify by the plain decrypt with the flag set. | |
68 | (gpgme_op_decrypt_verify_start): Pass the flag. | |
69 | (gpgme_op_decrypt_verify): Pass the flag. | |
70 | * src/decrypt.c (decrypt_start): Rename to ... | |
71 | (_gpgme_decrypt_start): this. Add arg FLAGS. Pass FLAGS to | |
72 | engine_op_decrypt. | |
73 | (gpgme_op_decrypt_start): Adjust for chnage pass 0 for FLAG. | |
74 | (gpgme_op_decrypt_start): Ditto. | |
75 | * src/engine.c (_gpgme_engine_op_decrypt_verify): Remove. | |
76 | (_gpgme_engine_op_decrypt): Add arg FLAGS. | |
77 | * src/gpgme.def, src/libgpgme.vers: Add new functions. | |
78 | * src/engine-backend.h (struct engine_ops): Remove member | |
79 | 'decrypt_verify'. Add FLAGS to 'decrypt'. Adjust all initialization. | |
80 | * src/engine-uiserver.c (uiserver_decrypt): Remove. | |
81 | (uiserver_decrypt_verify): Remove. | |
82 | (_uiserver_decrypt): Rename to ... | |
83 | (uiserver_decrypt): this. Replace arg VERIFY by new arg FLAGS. | |
84 | * src/engine-gpg.c (gpg_decrypt): Support GPGME_DECRYPT_UNWRAP. | |
85 | (gpg_encrypt): Support GPGME_ENCRYPT_WRAP. | |
86 | ||
87 | * tests/run-decrypt.c (main): New option --unwrap. | |
88 | * tests/run-encrypt.c (main): New option --wrap. | |
89 | ||
90 | 2017-03-22 Andre Heinecke <aheinecke@intevation.de> | |
91 | ||
92 | qt: Add test for Data::toKeys. | |
93 | + commit 66c334650bd64fdb72c4bd5975e25b8659d320ec | |
94 | * lang/qt/tests/t-various.cpp (TestVarious::testKeyFromFile): New. | |
95 | ||
96 | cpp: Wrap keylist_from_data. | |
97 | + commit 8ddb42ada46f00d8393f6c2df7d6b79a4a5878f0 | |
98 | * lang/cpp/data.h, lang/cpp/data.cpp (GpgME::Data::toKeys): New. | |
99 | ||
100 | qt: Initialize library first in tests. | |
101 | + commit 121873b821636052c10d9e0bd885eb9013c52096 | |
102 | * lang/qt/tests/t-support.cpp (QGpgMETest::initTestCase): Initialize | |
103 | library. | |
104 | ||
105 | 2017-03-22 Justus Winter <justus@g10code.com> | |
106 | ||
107 | python: Improve Python detection. | |
108 | + commit 104635eb503ec764146731888a6975b4329660fd | |
109 | * m4/python.m4 (_AM_PYTHON_INTERPRETER_LIST): Prefer the generic | |
110 | 'pythonX' over 'pythonX.Y'. This way we select the users preferred | |
111 | version for both flavors. Prefer 'python' over 'python3' but not over | |
112 | 'python2' so that the algorithm still finds a 'python2' even if | |
113 | 'python' is a Python3. | |
114 | ||
115 | 2017-03-21 Werner Koch <wk@gnupg.org> | |
116 | ||
117 | core: New API gpgme_op_set_uid_flag. | |
118 | + commit 421ddd1e6706046c5062417fd69a87e10c9fc0a9 | |
119 | * src/gpgme.h.in (gpgme_op_set_uid_flag_start): New. | |
120 | (gpgme_op_set_uid_flag_start): New. | |
121 | * src/gpgme.def, src/libgpgme.vers: Add them. | |
122 | * src/genkey.c (addrevuid_start): Change arg revoke to a flag. | |
123 | (gpgme_op_revuid_start): Pass GENKEY_EXTRAFLAG_REVOKE for the fomer | |
124 | revoke parameter. | |
125 | (gpgme_op_revuid): Ditto. | |
126 | (set_uid_flag): New. | |
127 | (gpgme_op_set_uid_flag_start): New. | |
128 | (gpgme_op_set_uid_flag): New. | |
129 | * src/engine.h (GENKEY_EXTRAFLAG_SETPRIMARY): new. | |
130 | * src/engine-gpg.c (gpg_adduid): Implement that flag. | |
131 | ||
132 | * tests/run-genkey.c (main): New command --set-primary. | |
133 | ||
134 | 2017-03-21 Justus Winter <justus@g10code.com> | |
135 | ||
136 | python: Wrap 'gpgme_op_keylist_from_data_start'. | |
137 | + commit f3e8d8a4518de2768692e0b392262d0da6d0fd84 | |
138 | * NEWS: Update. | |
139 | * lang/python/gpg/core.py (Context.keylist): New keyword argument | |
140 | 'source'. If given, list keys from 'source'. | |
141 | * lang/python/gpgme.i: Wrap the argument to | |
142 | 'gpgme_op_keylist_from_data_start'. | |
143 | * lang/python/tests/Makefile.am (py_tests): Add new test. | |
144 | * lang/python/tests/support.py (EphemeralContext): Do not throw an | |
145 | error if no agent has been started in the context. | |
146 | * lang/python/tests/t-keylist-from-data.py: New file. | |
147 | ||
148 | 2017-03-21 Werner Koch <wk@gnupg.org> | |
149 | ||
150 | core: Extend gpgme_get_dirinfo to return the gpg-wks-client name. | |
151 | + commit 55ac5eed9f59081283d34098a9e0ada753d61d59 | |
152 | * src/dirinfo.c (WANT_GPG_WKS_CLIENT_NAME): New const. | |
153 | (struct dirinfo): New field 'gpg_wks_client_name'. | |
154 | (get_gpgconf_item): Build it on demand. | |
155 | (gpgme_get_dirinfo): New value "gpg-wks-client-name" for WHAT. | |
156 | ||
157 | core: New encryption flag GPGME_ENCRYPT_THROW_KEYIDS. | |
158 | + commit fab8b1a166fff7265d8a7a7acbbf5f30d26cc93c | |
159 | * src/gpgme.h.in (GPGME_ENCRYPT_THROW_KEYIDS): New flag. | |
160 | * src/engine-gpg.c (gpg_encrypt): Implement flag | |
161 | (gpg_encrypt_sign): Implement flag. | |
162 | ||
163 | * tests/run-encrypt.c (main): New option --throw-keyids. | |
164 | ||
165 | 2017-03-21 Andre Heinecke <aheinecke@intevation.de> | |
166 | Werner Koch <wk@gnupg.org> | |
167 | ||
168 | core: New public API gpgme_op_keylist_from_data_start. | |
169 | + commit 35023f313622fb1b34108dd934e84831c58b81aa | |
170 | * src/gpgme.h.in: New API gpgme_op_keylist_from_data_start. | |
171 | * src/libgpgme.vers, src/gpgme.def: Add it. | |
172 | * src/keylist.c (gpgme_op_keylist_from_data_start): New. | |
173 | * src/engine-backend.h (engine_ops): Add field 'keylist_data'. Change | |
174 | all engines to pass NULL for it. | |
175 | * src/engine.c (_gpgme_engine_op_keylist_data): New. | |
176 | * src/engine-gpg.c (gpg_keylist_data): New. | |
177 | (_gpgme_engine_ops_gpg): Register gpg_keylist_data. | |
178 | ||
179 | * tests/run-keylist.c (main): New option --from-file. | |
180 | ||
181 | 2017-03-20 Werner Koch <wk@gnupg.org> | |
182 | ||
183 | core,cpp: New key flag 'is_de_vs'. | |
184 | + commit ea9686ec71a2dd2225ce2b6d6d4038821d36205f | |
185 | * src/gpgme.h.in (_gpgme_subkey): New flag is_de_vs. | |
186 | * tests/run-keylist.c (main): Print that flag. | |
187 | * src/keylist.c (parse_pub_field18): New. | |
188 | (keylist_colon_handler): Parse compliance flags. | |
189 | * lang/cpp/src/key.cpp (Key::isDeVs): New. | |
190 | (Subkey::isDeVs): New. | |
191 | ||
192 | * lang/cpp/src/key.h (class Key): New method isDeVs. | |
193 | (class Subkey): New method isDeVs. | |
194 | ||
195 | 2017-03-20 Justus Winter <justus@g10code.com> | |
196 | ||
197 | tests: Fix distcheck. | |
198 | + commit 392e51dd1181d035c19918222da65d08fdb2ee6d | |
199 | * tests/start-stop-agent: Do not create 'gpg-agent.conf' if it does | |
200 | not exist. | |
201 | ||
202 | python: Fix version check. | |
203 | + commit 57e64d019d993fdeb4323def5352f8ecc98c6fd9 | |
204 | * lang/python/tests/support.py (assert_gpg_version): Cope with | |
205 | non-released versions. | |
206 | ||
207 | tests: Use 'gpg-agent --allow-loopback-pinentry' if applicable. | |
208 | + commit 16b202d9999591b71fb8bb49f6db10ef96d4cbe8 | |
209 | * lang/python/tests/Makefile.am (gpg-agent.conf): Do not hard-code the | |
210 | option. This breaks gpg-agent from GnuPG 2.0. | |
211 | * tests/start-stop-agent: Rather, check if the option is supported and | |
212 | add it to the configuration if it is. | |
213 | ||
214 | python: Skip tests if GnuPG is too old. | |
215 | + commit e1cf8bab319ba1dea41ba5d711dbb66ffd8e6fd6 | |
216 | * lang/python/tests/support.py (assert_gpg_version): New function. | |
217 | * lang/python/tests/t-callbacks.py: Use the new function to skip the | |
218 | test if GnuPG is too old. | |
219 | * lang/python/tests/t-edit.py: Likewise. | |
220 | * lang/python/tests/t-encrypt-sym.py: Likewise. | |
221 | * lang/python/tests/t-quick-key-creation.py: Likewise. | |
222 | * lang/python/tests/t-quick-key-manipulation.py: Likewise. | |
223 | * lang/python/tests/t-quick-key-signing.py: Likewise. | |
224 | ||
225 | python: Remove superfluous initialization. | |
226 | + commit 4572e8d2ac1d3b45e75ce71265c99e591fbf0e28 | |
227 | * lang/python/tests/support.py (init_gpgme): Remove. This is an | |
228 | remnant from the c tests. Nowadays, the Python bindings initialize | |
229 | GPGME automagically. | |
230 | * lang/python/tests/initial.py: Remove call to 'support.init_gpgme'. | |
231 | * lang/python/tests/t-callbacks.py: Likewise. | |
232 | * lang/python/tests/t-decrypt-verify.py: Likewise. | |
233 | * lang/python/tests/t-decrypt.py: Likewise. | |
234 | * lang/python/tests/t-edit.py: Likewise. | |
235 | * lang/python/tests/t-encrypt-large.py: Likewise. | |
236 | * lang/python/tests/t-encrypt-sign.py: Likewise. | |
237 | * lang/python/tests/t-encrypt-sym.py: Likewise. | |
238 | * lang/python/tests/t-encrypt.py: Likewise. | |
239 | * lang/python/tests/t-export.py: Likewise. | |
240 | * lang/python/tests/t-file-name.py: Likewise. | |
241 | * lang/python/tests/t-idiomatic.py: Likewise. | |
242 | * lang/python/tests/t-import.py: Likewise. | |
243 | * lang/python/tests/t-keylist.py: Likewise. | |
244 | * lang/python/tests/t-sig-notation.py: Likewise. | |
245 | * lang/python/tests/t-sign.py: Likewise. | |
246 | * lang/python/tests/t-signers.py: Likewise. | |
247 | * lang/python/tests/t-trustlist.py: Likewise. | |
248 | * lang/python/tests/t-verify.py: Likewise. | |
249 | * lang/python/tests/t-wait.py: Likewise. | |
250 | ||
251 | 2017-03-14 Justus Winter <justus@g10code.com> | |
252 | ||
253 | python: Make error message more helpful. | |
254 | + commit 9d6825be092f1590f28b5bab462eeb944d9b800c | |
255 | * lang/python/tests/run-tests.py: Make the error message shown when we | |
256 | cannot locate the python module in the build tree more helpful. | |
257 | ||
258 | python: Make tests more robust. | |
259 | + commit ac4849953860547b06a167ca9612c4de369d02b6 | |
260 | * lang/python/tests/support.py (TemporaryDirectory): Always use our | |
261 | own version even if 'tempfile.TemporaryDirectory' is provided, because | |
262 | we need to use 'shutil.rmtree(..., ignore_errors=True)' to avoid it | |
263 | tripping over gpg-agent deleting its own sockets. | |
264 | ||
265 | python: Improve build system integration. | |
266 | + commit a4201035fdc050f337a6b9f520c8ddbb569e2eb4 | |
267 | * lang/python/Makefile.am: Use 'set -e' when chaining shell commands | |
268 | together in rules. | |
269 | ||
270 | build: Improve Python detection. | |
271 | + commit 6a371663886a7ba6073f385a3ab5f5a03de8e008 | |
272 | * configure.ac: Do not error out too early if we don't find a matching | |
273 | Python version. We handle this case later. | |
274 | ||
275 | build: Tune M4 macros for our needs. | |
276 | + commit 5189c08af9468cdeb6f16a6ecd0fee53e1e3aa0e | |
277 | * m4/ax_python_devel.m4: Do not emit 'HAVE_PYTHON'. | |
278 | * m4/python.m4 (_AM_PYTHON_INTERPRETER_LIST): Add newer Python | |
279 | versions, drop older ones. Also, sort the list with older versions at | |
280 | the front, newer and generic versions towards the end. This makes the | |
281 | algorithm pick the lowest version that meets the version requirement. | |
282 | ||
283 | build: Add M4 macros for python. | |
284 | + commit 067da472f919e78c95a0a01b68e79a8b7dff173b | |
285 | * m4/python.m4: New file. | |
286 | ||
287 | 2017-03-13 Andre Heinecke <aheinecke@intevation.de> | |
288 | ||
289 | qt: Add test for DN parser. | |
290 | + commit 43aa3eed15dcc4f848915ceabeff35c29c1c57e4 | |
291 | * qt/tests/t-various.cpp (testDN): New. | |
292 | ||
293 | qt: Use gpgrt_asprintf instead of qstrdup. | |
294 | + commit 9d5048d47446450a34cae4f27eb81c02ea5d4afc | |
295 | * lang/qt/src/dn.cpp (parse_dn_part): Use gpgrt_asprintf instead | |
296 | of qstrdup. | |
297 | ||
298 | 2017-03-09 Werner Koch <wk@gnupg.org> | |
299 | ||
300 | core: Fix status error return for gpgsm. | |
301 | + commit d2240a2a1819874929bdab820bcbd3bee7f94407 | |
302 | * src/engine-gpgsm.c (gpgsm_assuan_simple_command): Make sure CB_ERR | |
303 | is returned. | |
304 | * src/import.c (parse_import_res): Do not return an error for the last | |
305 | field. | |
306 | (import_status_handler): Actually return the error from | |
307 | parse_import_res. | |
308 | ||
309 | 2017-03-02 Justus Winter <justus@g10code.com> | |
310 | ||
311 | python: Print path of the Python module used during tests. | |
312 | + commit 41398779abbcb1ec2d7491e141469a752fc706ff | |
313 | * lang/python/tests/initial.py: Print path of the Python module used | |
314 | during tests. Useful to detect if by any mistake the wrong module is | |
315 | picked up. | |
316 | ||
317 | 2017-03-02 Werner Koch <wk@gnupg.org> | |
318 | ||
319 | core: Fix minor code style thing. | |
320 | + commit ef035f079fb067f207e5477d5ed6c5a68fb41f59 | |
321 | * src/engine-gpg.c (gpg_add_algo_usage_expire): Use double parenthesis | |
322 | for bit tests. | |
323 | ||
324 | 2017-03-02 Andre Heinecke <aheinecke@intevation.de> | |
325 | ||
326 | cpp: Add subkey keygrip to API. | |
327 | + commit 8071a6b2ca33c2a46ed1d50ae7283241daaafcd3 | |
328 | * lang/cpp/src/key.cpp (Subkey::keyGrip): New. | |
329 | * lang/cpp/src/key.h: Update accordingly. | |
330 | ||
331 | 2017-03-01 Andre Heinecke <aheinecke@intevation.de> | |
332 | ||
333 | cpp: Add interactor to generate keys on smartcard. | |
334 | + commit d63258066d008de113ed1170f1b0e787a5bdaba1 | |
335 | * lang/cpp/src/editinteractor.cpp (EditInteractor::needsNoResponse): | |
336 | Handle new states. | |
337 | * lang/cpp/src/gpggencardkeyinteractor.cpp, | |
338 | lang/cpp/src/gpggencardkeyinteractor.h: New. | |
339 | * lang/cpp/src/Makefile.am: Update accordingly. | |
340 | ||
341 | qt: Allow creation of default keys without name. | |
342 | + commit fbafb5474d8898ba1b267f4b4dfbefe39f04e72f | |
343 | * lang/qt/src/defaultkeygenerationjob.cpp | |
344 | (DefaultKeyGenerationJob::start): Handle empty name and email. | |
345 | ||
346 | 2017-02-26 Daniel Kahn Gillmor <dkg@fifthhorseman.net> | |
347 | ||
348 | doc: Correct documentation for recp arg of gpgme_op_encrypt_sign_start. | |
349 | + commit 5b49095b89b07591c69827df3973ffabfb3e97b8 | |
350 | * doc/gpgme.texi (gpgme_op_encrypt_sign_start): recp is an array of | |
351 | gpgme_key_t, not a single element. | |
352 | ||
353 | 2017-02-20 Justus Winter <justus@g10code.com> | |
354 | ||
355 | python: Fix test. | |
356 | + commit a7c6353edab57b67180aa127ec77d9353c2366fb | |
357 | * lang/python/tests/t-quick-key-manipulation.py: Modify the | |
358 | configuration file in the ephemeral home directory, not the one used | |
359 | by all the tests. | |
360 | ||
361 | 2017-02-17 Justus Winter <justus@g10code.com> | |
362 | ||
363 | python: Support manipulating the TOFU policy. | |
364 | + commit 15fbac9e72a4d1bff9a3b9e9822f9175b09fbcd5 | |
365 | * NEWS: Update. | |
366 | * doc/gpgme.texi: Fix typos. | |
367 | * lang/python/gpg/constants/__init__.py: Import new files. | |
368 | * lang/python/gpg/constants/tofu/__init__.py: New file. | |
369 | * lang/python/gpg/constants/tofu/policy.py: New file. | |
370 | * lang/python/gpg/core.py (Context.key_tofu_policy): New function. | |
371 | * lang/python/gpgme.i: Nice reprs for gpgme_tofu_info_t. | |
372 | * lang/python/setup.py.in: Install new package. | |
373 | * lang/python/tests/t-quick-key-manipulation.py: Extend test. | |
374 | ||
375 | python: Support quick key signing. | |
376 | + commit 48634e651fcd02431c0518d42ada1f3b402feb2c | |
377 | * NEWS: Update. | |
378 | * doc/gpgme.texi (gpgme_op_keysign): Fix the description of the | |
379 | 'expire' argument. | |
380 | * lang/python/gpg/constants/__init__.py: Import new file. | |
381 | * lang/python/gpg/constants/keysign.py: New file. | |
382 | * lang/python/gpg/core.py (Context.key_sign): New function. | |
383 | * lang/python/tests/Makefile.am (py_tests): Add new test. | |
384 | * lang/python/tests/t-quick-key-signing.py: New test. | |
385 | ||
386 | python: Fix teardown of ephemeral contexts. | |
387 | + commit de8494b16bc50c60a8438f2cae1f8c88e8949f7a | |
388 | * lang/python/tests/support.py (EphemeralContext): New function. | |
389 | * lang/python/tests/t-quick-key-creation.py: Use the new function to | |
390 | manage ephemeral contexts. | |
391 | * lang/python/tests/t-quick-key-manipulation.py: Likewise. | |
392 | * lang/python/tests/t-quick-subkey-creation.py: Likewise. | |
393 | ||
394 | python: Fix using strings as commands in the assuan protocol. | |
395 | + commit 9350168a1eed3f055040d7cc8a9bf4cdf745b23a | |
396 | * lang/python/gpg/core.py (Context.assuan_transact): Fix testing | |
397 | whether the command is a string on Python2. | |
398 | * lang/python/tests/t-protocol-assuan.py: Improve the test to detect | |
399 | this problem. | |
400 | ||
401 | 2017-02-16 Justus Winter <justus@g10code.com> | |
402 | ||
403 | python: Support adding and revoking UIDs. | |
404 | + commit 7641b7b5f2c9d5b38c60cd9326bcb4810c37dae5 | |
405 | * NEWS: Update. | |
406 | * lang/python/gpg/core.py (Context.key_add_uid): New function. | |
407 | (Context.key_revoke_uid): Likewise. | |
408 | * lang/python/tests/Makefile.am (XTESTS): Add new test. | |
409 | * lang/python/tests/t-quick-key-manipulation.py: New file. | |
410 | ||
411 | python: Support quick subkey creation. | |
412 | + commit 13bace25e3d8422f93fd24919994be36042fd220 | |
413 | * NEWS: Update. | |
414 | * lang/python/gpg/core.py (Context.create_subkey): New function. | |
415 | * lang/python/tests/Makefile.am (XTESTS): Add new test. | |
416 | * lang/python/tests/t-quick-subkey-creation.py: New file. | |
417 | ||
418 | python: Support quick key creation. | |
419 | + commit 476b97822b169c30cc246c1de2ff94cf89084706 | |
420 | * NEWS: Update. | |
421 | * lang/python/gpg/constants/__init__.py: Import new file. | |
422 | * lang/python/gpg/constants/create.py: New file. | |
423 | * lang/python/gpg/core.py (Context.create_key): New function. | |
424 | * lang/python/tests/Makefile.am (XTESTS): Add new test. | |
425 | * lang/python/tests/support.py (TemporaryDirectory): New class. | |
426 | * lang/python/tests/t-quick-key-creation.py: New file. | |
427 | ||
428 | python: Fix passphrase callback wrapping. | |
429 | + commit 3bdce4aa3ddd4a3f55b24678faf978d61daa8909 | |
430 | * lang/python/helpers.c (pyPassphraseCb): Cope with 'passphrase_info' | |
431 | being NULL. | |
432 | ||
433 | python: Fix error handling. | |
434 | + commit 048c5f74b61d5e4fa7617ce7c9111c6754bd4409 | |
435 | * lang/python/gpgme.i (typemap gpgme_key_t[]): Set an error if a | |
436 | non-key element is discovered. | |
437 | ||
438 | 2017-02-15 Justus Winter <justus@g10code.com> | |
439 | ||
440 | core: Fix expiration time handling when creating keys. | |
441 | + commit de708e5934cda380dbc3ae51f587c09041de7562 | |
442 | * NEWS: Update. | |
443 | * doc/gpgme.texi (gpgme_op_createkey): Clarify the meaning of the | |
444 | 'expire' parameter. | |
445 | (GPGME_CREATE_NOEXPIRE): Document new flag. | |
446 | (gpgme_op_createsubkey): Clarify the meaning of the 'expire' | |
447 | parameter. | |
448 | * src/engine-gpg.c (gpg_add_algo_usage_expire): Fix handling of the | |
449 | expiration time. | |
450 | * src/gpgme.h.in (GPGME_CREATE_NOEXPIRE): New macro. | |
451 | ||
452 | python: Fix build system integration. | |
453 | + commit 27544d0a74267ab6057dc816ea3311bc9149a200 | |
454 | * lang/python/Makefile.am (copystamp): Also copy the setup script, and | |
455 | link the header files. | |
456 | (all-local): Use local setup script. | |
457 | (sdist): Fix Python source distribution creation. | |
458 | (CLEANFILES): Remove now obsolete files. | |
459 | (install-exec-local): Use local setup script. | |
460 | * lang/python/setup.py.in: Adjust relative paths to in-tree files. | |
461 | ||
462 | python: Update lists of functions returning gpgme_error_t. | |
463 | + commit 25f0435a0022a70af77660d72d33f17bec2d4e51 | |
464 | * lang/python/gpg/core.py (Context._errorcheck): Add instructions how | |
465 | to update the list. Update list. | |
466 | (Data._errorcheck): Likewise. | |
467 | (Context.set_engine_info): Simplify. | |
468 | ||
469 | core: Fix error types. | |
470 | + commit 6df6e01ed5a581765d245bf7303cda4497d0eb22 | |
471 | * NEWS: Update. | |
472 | * src/data.c (gpgme_data_set_flag): Return a 'gpgme_error_t'. | |
473 | * src/error.c (gpgme_strerror_r): Fix type of first argument. | |
474 | * src/gpgme.h.in (gpgme_strerror_r): Adapt. | |
475 | (gpgme_data_set_flag): Likewise. | |
476 | ||
477 | 2017-02-14 Justus Winter <justus@g10code.com> | |
478 | ||
479 | python: Wrap utility functions. | |
480 | + commit 92adc9bbf640eb5d9177d3ba0189e0f6cee4e995 | |
481 | * NEWS: Update. | |
482 | * lang/python/gpg/core.py (pubkey_algo_string): New function. | |
483 | (pubkey_algo_name): Add docstring. | |
484 | (hash_algo_name): Likewise. | |
485 | (get_protocol_name): Likewise. | |
486 | (addrspec_from_uid): New function. | |
487 | * lang/python/gpgme.i (gpgme_pubkey_algo_string): Result must be | |
488 | freed. | |
489 | (gpgme_addrspec_from_uid): Likewise. | |
490 | ||
491 | python: Use the correct function to free buffers. | |
492 | + commit 9fc9533c2835ec53c4fd4f822b09e9fec14626d0 | |
493 | * lang/python/gpgme.i (char *): Free using 'gpgme_free'. | |
494 | ||
495 | python: Add keylist mode parameter. | |
496 | + commit fdc4e33dc3f6c84fe9d7bf9795c603ae3cf5f28d | |
497 | * NEWS: Update. | |
498 | * lang/python/gpg/core.py (Context.keylist): Add 'mode' parameter. | |
499 | ||
500 | python: Nicer repr for user ids. | |
501 | + commit e17ab84129045512cf60c221ee43aa877507662f | |
502 | * lang/python/gpgme.i (_gpgme_user_id): Provide a nicer repr() for | |
503 | user ids. | |
504 | ||
505 | python: Add convenience functions for the home directory. | |
506 | + commit 99b7f4f34dd595579181a696ae976a678fe00d49 | |
507 | * NEWS: Update. | |
508 | * lang/python/gpg/core.py (Context.__init__): Add 'home_dir' argument. | |
509 | (__repr__): Include 'home_dir'. | |
510 | (Context.home_dir): New property. | |
511 | ||
512 | qt: Make sure to remove the tofu.db on clean. | |
513 | + commit 30a603580e0f196c721fa4bd44d24077d9bc06c3 | |
514 | * lang/qt/tests/Makefile.am (CLEANFILES): Add 'tofu.db'. | |
515 | ||
516 | 2017-02-14 Tobias Mueller <muelli@cryptobitch.de> | |
517 | ||
518 | python: Extend SWIG gpgme_{sub,}key with a __repr__ method. | |
519 | + commit 01d5c17587578c729bbbb60f8a65635975e35592 | |
520 | * lang/python/gpgme.i: Added a genericrepr macro and use it for | |
521 | gpgme_key, gpgme_subkey, and gpgme_key_sig. | |
522 | ||
523 | python: Remove the -builtin flag for SWIG. | |
524 | + commit aa49be1ab80c200ab6b62d33bf5d0f5aa334fc56 | |
525 | * lang/python/setup.py.in: Call SWIG without the builtin flag. | |
526 | ||
527 | python: Call SWIG_NewPointerObj rather than SWIG_Python_NewPointerObj. | |
528 | + commit d35651917097ae2eee7d52396d53d010bc34df19 | |
529 | * lang/python/gpgme.i (pygpgme_wrap_gpgme_data_t): Provide a "self" | |
530 | variable for SWIG_NewPointerObj and call SWIG_NewPointerObj rather than | |
531 | SWIG_Python_NewPointerObj. | |
532 | ||
533 | python: Conditionally provide py3 argument to SWIG. | |
534 | + commit d184dbbba8987d9f387feb25791ed891e108dabc | |
535 | * lang/python/setup.py.in: Only call with -py3 when we run under python3 | |
536 | or higher. | |
537 | ||
538 | 2017-02-13 Justus Winter <justus@g10code.com> | |
539 | ||
540 | python: Use one copy of the source tree per Python version. | |
541 | + commit fe65a26ab584bd70fad45c7c4d44330e30a748a4 | |
542 | * lang/python/Makefile.am (copystamp): Create one copy per Python | |
543 | version. | |
544 | (all-local): Adapt. | |
545 | (clean-local): Likewise. | |
546 | (install-exec-local): Likewise. | |
547 | * lang/python/tests/run-tests.py: Likewise. | |
548 | ||
549 | build: Use macOS' compatibility macros to enable all features. | |
550 | + commit 60273e8b2c11d42215a5707bc55e3e0d8f350e07 | |
551 | * configure.ac: On macOS, use the compatibility macros to expose every | |
552 | feature of the libc. This is the equivalent of _GNU_SOURCE on GNU | |
553 | libc. | |
554 | ||
555 | Revert "Disable fd-passing for Apple." | |
556 | + commit f8db658f8b4c3c7941d0029273fb23fbe1ba74ad | |
557 | The actual bug has been located, so this can be reverted. | |
558 | ||
559 | This reverts commit ef5b4ae37d13142e89a051908dc080cda3d24baa. | |
560 | ||
561 | 2017-02-13 Igor Gnatenko <ignatenkobrain@fedoraproject.org> | |
562 | ||
563 | qt: Add missing #include <functional> | |
564 | + commit 60064c665ec98a2a994fc6c8ad701e60b963ce7e | |
565 | * lang/qt/src/qgpgmenewcryptoconfig.cpp, | |
566 | lang/qt/src/threadedjobmixin.h: Include functional. | |
567 | ||
568 | 2017-02-07 Andre Heinecke <aheinecke@intevation.de> | |
569 | ||
570 | qt: Don't rely on implicit include in t-verify. | |
571 | + commit 903bf16a416b1bf608b1e647937c9b06864b0141 | |
572 | * lang/qt/tests/t-various.cpp: Include QTemporaryDir | |
573 | ||
574 | 2017-02-06 Daniel Kahn Gillmor <dkg@fifthhorseman.net> | |
575 | ||
576 | doc: Document that gpgme_op_genkey() parms parameter is not XML. | |
577 | + commit ad22bee5387b1e9a40e8c822a081db3228bb9def | |
578 | * doc/gpgme.texi (GnupgKeyParms): document that input format is not | |
579 | true XML. | |
580 | ||
581 | 2017-02-03 Werner Koch <wk@gnupg.org> | |
582 | ||
583 | core: Optimize fork/exec for *BSD and Solaris. | |
584 | + commit 51bd69f216a9e2930eeba4b5f6c20e952a381720 | |
585 | * configure.ac (closefrom): Add to ac_check_funcs. | |
586 | * src/posix-io.c (_gpgme_io_spawn): Use closefrom. | |
587 | ||
588 | core: Fix possible deadlock due to get_max_fds. | |
589 | + commit 93a59070c699d569d1eac7ba22355fe3f5d10882 | |
590 | * src/posix-io.c (get_max_fds): Do not use the Linux optimization. | |
591 | ||
592 | core: Minor cleanup of commit 195c735. | |
593 | + commit afc308598d1ddaf20d54b4eab30b959066a4e5e6 | |
594 | * src/verify.c (parse_tofu_user): For cleanness use gpg_error ... | |
595 | (_gpgme_verify_status_handler): ... and gpg_err_code. | |
596 | ||
597 | 2017-02-02 Andre Heinecke <aheinecke@intevation.de> | |
598 | ||
599 | qt: Add test for tofu conflict. | |
600 | + commit 43160a39f27f6c3507447620666c85af00b3499c | |
601 | * lang/qt/tests/t-tofuinfo.cpp (TofuInfoTest::testTofuConflict): New. | |
602 | ||
603 | core: Handle multiple TOFU_USER lines in verify. | |
604 | + commit 195c73589232160f45d00f4901c9bb2b0162f0e5 | |
605 | * src/verify.c (op_data_t): Add conflict_user_seen. | |
606 | (parse_tofu_user): Return ERR_DUP_VALUE for mutltiple TOFU_USERS. | |
607 | (_gpgme_verify_status_handler): Handle ERR_DUP_VALUE from | |
608 | parse_tofu_user to ignore the next TOFU_STATS. | |
609 | ||
610 | 2017-02-02 Werner Koch <wk@gnupg.org> | |
611 | ||
612 | core: Replace all calls to *sprintf by gpgrt_*sprintf. | |
613 | + commit 15050ce5fce4ed815503db7c029abb38d08970d6 | |
614 | * configure.ac (vasprintf): Remove check. | |
615 | * src/vasprintf.c: Remove file. | |
616 | * src/util.h (vasprintf, asprintf): Remove prototypes. Replace all | |
617 | calls to vasprintf and asprintf by gpgrt_vasprintf or gpgrt_asprintf. | |
618 | Also take care to use gpgrt_free on the returned value. | |
619 | * src/w32-util.c (_gpgme_get_gpgconf_path): Replace a gpgrt_asprintf | |
620 | by _gpgme_strconcat. | |
621 | (snprintf): New macro to use gpgrt_snprintf instead of the system's | |
622 | standard snprintf. | |
623 | ||
624 | core: Remove unused check for funopen/fopencookie. | |
625 | + commit 563420a88f8a4f561a2faea4d2b4a1c58b375fd8 | |
626 | * configure.ac (funopen): Remove check. | |
627 | * src/funopen.c: Remove file. | |
628 | ||
629 | core: Un-deprecate gpgme_data_rewind. | |
630 | + commit d19bea52afe6efb66a46af6aa4d09928c5d05ee5 | |
631 | * src/gpgme.h.in (gpgme_data_rewind): Un-deprecate. | |
632 | * src/data-compat.c (gpgme_data_rewind): Move to ... | |
633 | * src/data.c (gpgme_data_rewind): here. | |
634 | ||
635 | core: Move all deprecated stuff to the end of gpgme.h. | |
636 | + commit 9b7d81998b734fabeb4fbc697f08fc7795eaa90a | |
637 | ||
638 | ||
639 | 2017-02-01 Andre Heinecke <aheinecke@intevation.de> | |
640 | ||
641 | core: Cleanup gpgme_key_unref frees. | |
642 | + commit 8ede86795a1d419c01b4910ec2fd1fb18b629452 | |
643 | * src/key.c (gpgme_key_unref): Nowadays we assume free(NULL) is ok. | |
644 | ||
645 | core: Fix leakage of address for mail only uids. | |
646 | + commit b5075030bec9b21bf4e515bc1686df3fa43eced2 | |
647 | * src/key.c (gpgme_key_unref): Always free address if set. | |
648 | (_gpgme_key_append_name): Remove memory optimization for address. | |
649 | ||
650 | core: Improve mailbox only uid handling. | |
651 | + commit a28d31fdb623f2ee30e8094d09f1a0d1ae446a9b | |
652 | * src/key.c (_gpgme_key_append_name): Set email and remove name | |
653 | for uid only keys. | |
654 | ||
655 | 2017-01-31 Justus Winter <justus@g10code.com> | |
656 | ||
657 | qt: Increase timeout when waiting for signals. | |
658 | + commit ba594d85e35e63301755977234d3af88a167a215 | |
659 | * lang/qt/tests/t-support.h (QSIGNALSPY_TIMEOUT): New macro. | |
660 | * lang/qt/tests/t-encrypt.cpp: Use the new macro as timeout when | |
661 | waiting for signals. | |
662 | * lang/qt/tests/t-keylist.cpp: Likewise. | |
663 | * lang/qt/tests/t-keylocate.cpp: Likewise. | |
664 | * lang/qt/tests/t-ownertrust.cpp: Likewise. | |
665 | * lang/qt/tests/t-wkspublish.cpp: Likewise. | |
666 | ||
667 | 2017-01-31 Werner Koch <wk@gnupg.org> | |
668 | ||
669 | core: Add new context flag "redraw". | |
670 | + commit 752d3597ef02a95efd693373132bf1e246f0edb0 | |
671 | * src/context.h (struct gpgme_context): New field 'redraw_suggested'. | |
672 | * src/op-support.c (_gpgme_op_reset): Clear REDRAW_SUGGESTED. | |
673 | * src/progress.c (_gpgme_progress_status_handler): Set REDRAW_SUGGESTED. | |
674 | * src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): Add "redraw". | |
675 | * tests/run-sign.c (main): Use it. | |
676 | ||
677 | 2017-01-30 Andre Heinecke <aheinecke@intevation.de> | |
678 | ||
679 | tests: Reduce iterations / threads. | |
680 | + commit 7bd6ab4a91d43d7cbf5d347c0c12e0e4f9f7e3bf | |
681 | * tests/gpg/t-gpgconf.c (main): Reduce iterations to 10. | |
682 | * tests/gpg/t-thread-keylist-verify.c, | |
683 | tests/gpg/t-thread-keylist.c (THREAD_COUNT): Reduce to 10. | |
684 | ||
685 | 2017-01-26 Andre Heinecke <aheinecke@intevation.de> | |
686 | ||
687 | python: Ensure quick-random is used if gpg is gpg2. | |
688 | + commit f3ca2c9ce9fd4a03e293065f10b92589a7e642d6 | |
689 | * lang/python/tests/Makefile.am (gpg.conf): Configure | |
690 | agent-program accordingly. | |
691 | ||
692 | 2017-01-25 Tobias Mueller <muelli@cryptobitch.de> | |
693 | ||
694 | python: default op_keylist_start parameters. | |
695 | + commit 9291ebaa4151a1f6c8c0601095ec45809b963383 | |
696 | * lang/python/gpgme.i: Added gpgme_op_keylist_start with defaults | |
697 | * lang/python/tests/t-keylist.py: Added tests for default parameters | |
698 | ||
699 | 2017-01-25 Andre Heinecke <aheinecke@intevation.de> | |
700 | ||
701 | tests: Use --debug-quick-random for tests. | |
702 | + commit a98951a30a6ae603ffac4ec8c5168aa6d1019933 | |
703 | * tests/start-stop-agent: Don't autostart agent on --stop and | |
704 | running check. Use --debug-quick-random when starting. | |
705 | ||
706 | 2017-01-23 Justus Winter <justus@g10code.com> | |
707 | ||
708 | w32: Fix closing file descriptors. | |
709 | + commit 6f02133bb07726afa6950e5b4685e75621276e60 | |
710 | * src/w32-io.c (writer): Only stop once the buffer is drained. | |
711 | (destroy_writer): Wait for the writers buffer to be drained. This | |
712 | aligns '_gpgme_io_close's behavior with close(2) and fclose(3). | |
713 | ||
714 | 2017-01-17 Andre Heinecke <aheinecke@intevation.de> | |
715 | ||
716 | tests: Add safeguards against nullptr deref. | |
717 | + commit ca69df8c8d3f044340aee2a118cc20d33cd600a1 | |
718 | * t-gpgconf.c (main): Test some values before dereferencing them. | |
719 | ||
720 | 2017-01-16 Andre Heinecke <aheinecke@intevation.de> | |
721 | ||
722 | qt: Use QVERIFY instead of Q_ASSERT in conf test. | |
723 | + commit abfd241d1a1ae8e30e18b7c5e0658b8c54d89544 | |
724 | * lang/qt/tests/t-config.cpp: Use QVERIFY instead of Q_ASSERT. | |
725 | ||
726 | qt: Add test for CryptoConfig. | |
727 | + commit 8aba08d1d0871f439fb7193adc4a2f43a81ee216 | |
728 | * lang/qt/tests/t-config.cpp: New. | |
729 | * lang/qt/tests/Makefile.am: Update accordingly. | |
730 | ||
731 | 2017-01-16 Justus Winter <justus@g10code.com> | |
732 | ||
733 | tests: Fix distcheck. | |
734 | + commit 92543da94cbf8e807b1b33070d273f995cdd5c62 | |
735 | * tests/gpg/Makefile.am (CLEANFILES): Remove gpgconf backups. | |
736 | ||
737 | Fix changing options with gpgconf. | |
738 | + commit 0e242278dfaa64ce31a45b72f5fa0806a3dba898 | |
739 | * src/engine-gpgconf.c (gpgconf_write): Connect a pipe to the child's | |
740 | stderr, and wait for it to be closed as an indication that gpgconf has | |
741 | exited. Also improve error handling. | |
742 | ||
743 | 2017-01-12 Justus Winter <justus@g10code.com> | |
744 | ||
745 | tests: Improve the gpgconf test. | |
746 | + commit 186dcd3494eda7383de57a530fd15776410531a5 | |
747 | * tests/gpg/t-gpgconf.c: Include support functions. | |
748 | (fail_if_err): Remove macro. | |
749 | (init_gpgme): Remove function. | |
750 | (lookup): New function. | |
751 | (main): Update some values and verify that the changes are applied. | |
752 | * tests/gpg/t-support.h (test): New assert-like macro. | |
753 | ||
754 | 2017-01-12 Andre Heinecke <aheinecke@intevation.de> | |
755 | ||
756 | qt: Add support for stringValueList in CryptoConf. | |
757 | + commit 9640dc58e498966b482dcded6990cf4b47c556ac | |
758 | * lang/qt/src/Makefile.am (qgpgme_sources): Add cryptoconfig.cpp | |
759 | * lang/qt/src/cryptoconfig.cpp: New. | |
760 | * lang/qt/src/cryptoconfig.h (CryptoConfigEntry::stringValueList): | |
761 | New. | |
762 | * lang/qt/src/qgpgmenewcryptoconfig.cpp | |
763 | (QGpgMENewCryptoConfigEntry::stringValueList): New. | |
764 | * lang/qt/src/qgpgmenewcryptoconfig.h: Update accordingly. | |
765 | ||
766 | qt: Don't use qstrdup in test passphrase cb. | |
767 | + commit a09ed3f26a1fab54079c37c49df5c440cc792f78 | |
768 | * lang/qt/tests/t-support.h (TestPassphraseProvider::getPassphrase): | |
769 | Use gpgrt_asprintf instead of strdup. | |
770 | ||
771 | 2017-01-11 Andre Heinecke <aheinecke@intevation.de> | |
772 | ||
773 | qt: Clean up test dirs on failure. | |
774 | + commit 56926c9b5012e8135541a933af1d69c5a81f02b3 | |
775 | * t-encrypt.cpp, | |
776 | t-keylist.cpp, | |
777 | t-keylocate.cpp, | |
778 | t-ownertrust.cpp, | |
779 | t-tofuinfo.cpp, | |
780 | t-various.cpp, | |
781 | t-verify.cpp, | |
782 | t-wkspublish.cpp: Use QVERIFY instead of Q_ASSERT | |
783 | ||
784 | qt: Add test for uid functions. | |
785 | + commit 9e643ab67168dfbd189ccc0bfed8fb59253ee79c | |
786 | * lang/qt/tests/t-various.cpp: New. | |
787 | * lang/qt/tests/Makefile.am: Update accordingly. | |
788 | ||
789 | cpp: Add revuid and adduid support. | |
790 | + commit e416f9961837039f259558edf41fccbc181ad128 | |
791 | * lang/cpp/src/context.cpp | |
792 | (Context::revUid, Context::startRevUid), | |
793 | (Context::addUid, Context::startAddUid): New. | |
794 | * lang/cpp/src/context.h: Declare new functions. | |
795 | * lang/cpp/src/key.cpp (Key::UserID::revoke) | |
796 | (Key::addUid): Idomatic helpers. | |
797 | lang/cpp/src/key.h: Declare new functions. | |
798 | * NEWS: Update accordingly. | |
799 | ||
800 | Fix Qgpgme build for macos. | |
801 | + commit efe58fe011f195d98adb4f03b1e1068a26ba287b | |
802 | * lang/qt/src/dn.cpp: Include string.h | |
803 | (parse_dn_part): Use qstrdup. | |
804 | * lang/qt/tests/t-support.h (getPassphrase): Use qstrdup. | |
805 | ||
806 | Fix cmake configuration files for MacOS. | |
807 | + commit 2e661b9e1a9b50656a5c9646d7444a98477010c1 | |
808 | * configure.ac: Set HAVE_MACOS_SYSTEM conditional. | |
809 | * lang/qt/src/Makefile.am, | |
810 | lang/cpp/src/Makefile.am, | |
811 | lang/qt/src/QGpgmeConfig.cmake.in.in, | |
812 | lang/cpp/src/GpgmeConfig.cmake.in.in: Use libsuffix again to | |
813 | distinguish between macos .dylib | |
814 | ||
815 | 2017-01-03 Justus Winter <justus@g10code.com> | |
816 | ||
817 | python: Improve compatibility with Scheme tests. | |
818 | + commit b14419f68b3aaa90025e0e97151de7c3da7806fb | |
819 | * lang/python/tests/run-tests.py: Add stub --parallel option. | |
820 | ||
821 | python: Add a switch '--quiet' to the test runner. | |
822 | + commit d0e91d28f63b74e53673902e675be8a54b6b90d3 | |
823 | * lang/python/tests/run-tests.py: Add and honor a switch '--quiet'. | |
824 | This way we can use this script to run Python tests one by one without | |
825 | the noise, and the script will setup the necessary environment for us. | |
826 | ||
827 | 2017-01-02 Andre Heinecke <aheinecke@intevation.de> | |
828 | ||
829 | qt: Update config sync doc / comment. | |
830 | + commit ececfd5de81f1851943be7b284b672d5b02aceb4 | |
831 | * lang/qt/src/cryptoconfig.h (CryptoConfig::sync): Document | |
832 | that runtime option is always set. | |
833 | * lang/qt/Src/qgpgmenewcryptoconfig.cpp | |
834 | (QGpgMENewCryptoConfigComponent::sync): Remove outdated comment | |
835 | and warn on error. | |
836 | ||
837 | core: Always use runtime for gpgconf changes. | |
838 | + commit 7103315829847163f1c6f52cad25d1ddb33358f0 | |
839 | * src/engine-gpgconf.c (gpgconf_write): Add --runtime. | |
840 | * src/gpgme.h.in (gpgme_conf_opt_change): Document this | |
841 | behavior. | |
842 | ||
843 | 2017-01-01 Ben Kibbey <bjk@luxsci.net> | |
844 | ||
845 | Fix gpg_addkey() to work with GPGME_CREATE_NOPASSWD as well. | |
846 | + commit a4b9f1a2b404fd8627d5ac567617510abd55d980 | |
847 | * src/engine-gpg.c (gpg_addkey): Pass --batch to gpg when | |
848 | GPGME_CREATE_NOPASSWD is set to fix pinentry without loopback mode. | |
849 | ||
850 | 2016-12-27 Ben Kibbey <bjk@luxsci.net> | |
851 | ||
852 | Fix GPGME_CREATE_NOPASSWD without pinentry loopback. | |
853 | + commit d83b8f0dc84d6cf7fe2e091bd1b103ceedfa3d6c | |
854 | * src/engine-gpg.c(gpg_createkey): Pass --batch to gpg when | |
855 | GPGME_CREATE_NOPASSWD is set. | |
856 | ||
857 | 2016-12-19 Raphael Kubo da Costa <rakuco@FreeBSD.org> | |
858 | ||
859 | Qt: Make sure extended grep is used with '|'. | |
860 | + commit 211844f049d714cd4d5aab96347705cb0c209c5d | |
861 | * m4/qt.m4: Use grep -E when using the alternation character. | |
862 | ||
863 | 2016-12-16 Andre Heinecke <aheinecke@intevation.de> | |
864 | ||
865 | cpp: Ensure that hasSecret is correct after update. | |
866 | + commit da5343a9d2c8c0ca6431162aac4bd5c73b4ae6dd | |
867 | * lang/cpp/src/key.cpp (Key::update): Check for | |
868 | a secret key first before listing public keys. | |
869 | ||
870 | 2016-12-15 Andre Heinecke <aheinecke@intevation.de> | |
871 | ||
872 | cpp: Fix addrSpec for keys without email. | |
873 | + commit 85e05537e15346896a271d3f62bead9dd7e3f180 | |
874 | * lang/cpp/src/key.cpp (UserID::addrSpec): Use uid->address instead | |
875 | of normalizing again. | |
876 | (&operator<<(std::ostream &, const UserID &): Print it. | |
877 | ||
878 | cpp: Fix update of partial key in verifyresult. | |
879 | + commit 5673f3e54af535155893290a685b3afb44c7f58d | |
880 | * lang/cpp/src/verificationresult.cpp | |
881 | (Signature::key(bool,bool)): Don't update the returned copy | |
882 | but the actual key of the signature. | |
883 | ||
884 | 2016-12-07 Andre Heinecke <aheinecke@intevation.de> | |
885 | ||
886 | Clarify what "checking on bit" means. | |
887 | + commit 7880335273382f05cbbe38aa965a566c4127ba6a | |
888 | * doc/gpgme.texi (gpgme_sigsum_t summary): Clarify what "you | |
889 | can check one bit means" | |
890 | ||
891 | 2016-12-05 Tobias Mueller <muelli@cryptobitch.de> | |
892 | ||
893 | python: Try to be more helpful when given a string to encrypt(). | |
894 | + commit 05896c210f7fa9ce7b97784a75e49dc4489e9252 | |
895 | * lang/python/helpers.c (_gpg_obj2gpgme_data_t): Extended error | |
896 | message. | |
897 | * lang/python/tests/t-encrypt.py: Test for "encode" in error message. | |
898 | ||
899 | python: Define a macro for wrapping fragile result objects. | |
900 | + commit fb7f4cb973abc9f5eb05eb240607be35c1be986c | |
901 | * lang/python/gpgme.i (wrapresult): New Macro. | |
902 | ||
903 | 2016-12-01 Tobias Mueller <muelli@cryptobitch.de> | |
904 | ||
905 | python: Check "buffer" when writing to sys.stdout for python2 compat. | |
906 | + commit ae21d2705fc46725e1f9af1651b68d16155d1501 | |
907 | * lang/python/tests/support.py (print_data): Add check for buffer. | |
908 | ||
909 | python: Make Context have a repr method. | |
910 | + commit 154389f2a5e4c13081cf0624222aad29ee480b56 | |
911 | * lang/python/gpg/core.py (Context.__repr__): New function. | |
912 | ||
913 | python: Make Results have a nicer __repr__. | |
914 | + commit db2f6c1ca3d2ef228f4ca6653d594537622c8588 | |
915 | * lang/python/gpg/results.py (Result.__str__): Renamed to '__repr__' | |
916 | ... | |
917 | * lang/python/gpg/results.py (Result.__repr__): ... and added fields. | |
918 | ||
919 | 2016-11-25 Justus Winter <justus@g10code.com> | |
920 | ||
921 | python: Fix removing the TOFU database. | |
922 | + commit fd4d476214ae06e33f4a6dac534d3deca5cc6cd3 | |
923 | * lang/python/Makefile.am (CLEANFILES): Move 'tofu.db'... | |
924 | * lang/python/tests/Makefile.am (CLEANFILES): ... here. | |
925 | ||
926 | tests: Remove tofu.db. | |
927 | + commit 9b22f82afc5518961e4bea1fc516b79800e379a2 | |
928 | * lang/python/Makefile.am (CLEANFILES): Add 'tofu.db'. | |
929 | * tests/gpg/Makefile.am (CLEANFILES): Likewise. | |
930 | ||
931 | 2016-11-17 Heiko Becker <heirecka@exherbo.org> | |
932 | ||
933 | Remove a forgotten instance of @libsuffix@ | |
934 | + commit 572c1aac107125ce62230251713349348373db5a | |
935 | * lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove a forgotten | |
936 | instance of @libsuffix@. | |
937 | ||
0 | 938 | 2016-11-16 Werner Koch <wk@gnupg.org> |
1 | 939 | |
2 | 940 | Release 1.8.0. |
941 | + commit f06220b691e9711afdabaa19886244ae7724eed5 | |
3 | 942 | * configure.ac: Set version to 1.8.0. Set LT version C28/A17/RO. |
4 | 943 | Set CPP LT version to C9/A3/R0. Set Qt LT version to C8/A1/R0. |
5 | 944 | |
6 | 945 | core: Do not leak the override session key to ps(1). |
946 | + commit 9fc92a15bd0a30437a39d0eb28b6f40edc22e6e8 | |
7 | 947 | * src/engine-gpg.c (struct engine_gpg): New field |
8 | 948 | override_session_key. |
9 | 949 | (gpg_release): Free that field. |
14 | 954 | 2016-11-16 Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
15 | 955 | |
16 | 956 | doc,tests: Require use of ctx_flag before use of session_key. |
957 | + commit 573064742145aa5f9bf04baa88af918c0c4d5e12 | |
17 | 958 | * doc/gpgme.texi: Document requirements of verifying that it is OK to |
18 | 959 | use session_key. |
19 | 960 | * tests/run-decrypt.c: Ensure that we fail if we're unable to access |
38 | 979 | 2016-11-15 Andre Heinecke <aheinecke@intevation.de> |
39 | 980 | |
40 | 981 | qt, cpp: Add cmake config files for w32. |
982 | + commit b2c07bd47bd608afa5cc819b60a7b5bb8c9dd96a | |
41 | 983 | * lang/cpp/src/GpgmeppConfig-w32.cmake.in.in |
42 | 984 | lang/qt/src/QGpgmeConfig-w32.cmake.in.in: New. |
43 | 985 | * lang/cpp/src/GpgmeppConfig.cmake.in.in, |
47 | 989 | * configure.ac: Configure them. |
48 | 990 | |
49 | 991 | qt: Use new style connect in th..mixin. |
992 | + commit 45abe6d142e314ba7099ad80b6365af171b06fec | |
50 | 993 | * lang/qt/src/threadedjobmixin.h |
51 | 994 | (ThreadedJobMixin::lateInitialization): Use new style connect. |
52 | 995 | |
53 | 996 | 2016-11-15 Werner Koch <wk@gnupg.org> |
54 | 997 | |
55 | 998 | core: Implement context flag "override-session-key". |
999 | + commit 7659d42468b604db2936b021425683f407eba4a7 | |
56 | 1000 | * src/gpgme.c (gpgme_set_ctx_flag): Add flags "export-session-key" and |
57 | 1001 | "override-session-key". |
58 | 1002 | (gpgme_get_ctx_flag): Ditto. |
81 | 1025 | (main): Add options --export-session-key and --override-session-key. |
82 | 1026 | |
83 | 1027 | core: Add public function gpgme_get_ctx_flag. |
1028 | + commit 3234b1bf1d6939772677d64f6c1e1820ec98e3cd | |
84 | 1029 | * src/gpgme.h.in (gpgme_get_ctx_flag): New. |
85 | 1030 | * src/gpgme.c (gpgme_set_ctx_flag): Move down the file and add a trace |
86 | 1031 | statement. |
90 | 1035 | 2016-11-15 Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
91 | 1036 | |
92 | 1037 | core: Enable extraction of session keys. |
1038 | + commit cad1210fb8a7402cb29e607f8f9680005314120d | |
93 | 1039 | * src/gpgme.c (gpgme_set_export_session_keys): New function. |
94 | 1040 | (gpgme_get_export_session_keys): New function. |
95 | 1041 | * src/gpgme.h.in (struct _gpgme_op_decrypt_result): Add session_key |
126 | 1072 | 2016-11-14 Andre Heinecke <aheinecke@intevation.de> |
127 | 1073 | |
128 | 1074 | qt: Add API to get the context for a Job. |
1075 | + commit 9451faa2ee333904cff59f92ab62918e13ab4b87 | |
129 | 1076 | * lang/qt/src/job.cpp, |
130 | 1077 | lang/qt/src/job.h (Job::context): New. |
131 | 1078 | * lang/qt/src/threadedjobmixin.cpp |
134 | 1081 | * NEWS: Update for cpp and qt. |
135 | 1082 | |
136 | 1083 | cpp: Add get / set Sender API. |
1084 | + commit d09a84eaf1e4f8c6c2e462995fa15c1a5690a6ce | |
137 | 1085 | * cpp/src/context.cpp, cpp/src/context.h (Context::setSender), |
138 | 1086 | (Context::getSender): Add simple wrappers. |
139 | 1087 | |
140 | 1088 | qt, cpp: Enable dll build for windows. |
1089 | + commit f3790ddf56558fb0a08af95fdbae979cd6589aad | |
141 | 1090 | * lang/cpp/src/Makefile.am, |
142 | 1091 | lang/qt/src/Makefile.am: Add -no-undefined to LDFLAGS. |
143 | 1092 | |
144 | 1093 | w32: Fix build of w32-glib. |
1094 | + commit b91c383386fe9eadd90afdb9bb1f8ec6c528173b | |
145 | 1095 | * src/Makefile.am (main_sources): Remove system_components_not_extra. |
146 | 1096 | (libgpgme_la_SOURCES): Add system_components_not_extra. |
147 | 1097 | (libgpgme_glib_la_SOURCES): Remove duplicated ath files. |
149 | 1099 | 2016-11-11 Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
150 | 1100 | |
151 | 1101 | doc: Correct deftypefun for gpgme_op_decrypt_verify_start. |
1102 | + commit 16a30205064914eef578d84d07141b5d51d82838 | |
152 | 1103 | * doc/gpgme.texi: Documentationabout gpgme_op_decrypt_verify_start was |
153 | 1104 | stored under the name gpgme_op_decrypt_verify instead. |
154 | 1105 | |
155 | 1106 | doc: Correct text about gpgme_cancel_async. |
1107 | + commit d50bdb269e86db36a443958e3bfc6816a44d468e | |
156 | 1108 | * doc/gpgme.texi: Documentation about gpgme_cancel_async should refer |
157 | 1109 | to the correct name. |
158 | 1110 | |
159 | 1111 | core: Non-zero values should set _armor, _textmode, and _online. |
1112 | + commit da035768bd9a880becee5d0d553dfe12299f96eb | |
160 | 1113 | * src/gpgme.c (gpgme_set_armor, gpgme_set_textmode, |
161 | 1114 | gpgme_set_offline): Ensure that non-zero values actually set the |
162 | 1115 | appropriate internal bit. |
164 | 1117 | 2016-11-11 Alon Bar-Lev <alon.barlev@gmail.com> |
165 | 1118 | |
166 | 1119 | tests,python: Atomic directory creation. |
1120 | + commit 41d8c7e51a8989be633b9ada124c58a01fae7d54 | |
167 | 1121 | * lang/python/tests/Makefile.am: Use MIDIR_P. |
168 | 1122 | * tests/gpg/Makefile.am: Ditto. |
169 | 1123 | * tests/gpgsm/Makefile.am: Ditto. |
171 | 1125 | 2016-11-10 Werner Koch <wk@gnupg.org> |
172 | 1126 | |
173 | 1127 | core: Use better error code when using select with a too high fd. |
1128 | + commit 6e57379c8e37c0863f7d12819a5a7d0781bd76d2 | |
174 | 1129 | * src/posix-io.c (_gpgme_io_select): Return EMFILE instead of EBADF. |
175 | 1130 | |
176 | 1131 | 2016-11-10 Andre Heinecke <aheinecke@intevation.de> |
177 | 1132 | |
178 | 1133 | tests: Reduce thread count in new thread tests. |
1134 | + commit ddd0a3cf90ac4b0a27ea610ebd7b9b8016ff43c4 | |
179 | 1135 | * gpg/t-thread-keylist-verify.c, |
180 | 1136 | gpg/t-thread-keylist.c: Reduce threads to 100 |
181 | 1137 | |
182 | 1138 | 2016-11-10 Werner Koch <wk@gnupg.org> |
183 | 1139 | |
184 | 1140 | core: Detect unreadable keyrings. |
1141 | + commit 2a39bd6c30d21c43c86645a7908ce6c57dad5e20 | |
185 | 1142 | * src/keylist.c (op_data_t): Add field keydb_search_err. |
186 | 1143 | (keylist_status_handler): Parse STATUS_ERROR into that var. |
187 | 1144 | (gpgme_op_keylist_next): Use that err instead of GPG_ERR_EOF. |
189 | 1146 | 2016-11-10 Andre Heinecke <aheinecke@intevation.de> |
190 | 1147 | |
191 | 1148 | tests: Fix additional memleaks in thread tests. |
1149 | + commit d0030efb45ec8436dd84a9623d2f66b80c6b9e10 | |
192 | 1150 | * tests/gpg/t-thread-keylist-verify.c (start_verify): Release |
193 | 1151 | data. |
194 | 1152 | (start_keylist): Unref keys. |
195 | 1153 | * tests/gpg/t-thread-keylist.c (start_keylist): Unref keys. |
196 | 1154 | |
197 | 1155 | tests: Improve new thread tests. |
1156 | + commit 4d5174e4a83dcd524f8085f6646145f81b50a02a | |
198 | 1157 | * tests/gpg/t-thread-keylist-verify.c (start_keylist): Mark |
199 | 1158 | arg as unused. Release context. |
200 | 1159 | (start_verify): Ditto. |
204 | 1163 | (main): Mark args as unused. |
205 | 1164 | |
206 | 1165 | core: Use gpgrt locking for thread safeness. |
1166 | + commit 09b64554328445e99a8cc78fc34ea49c2ea2e7f9 | |
207 | 1167 | * configure.ac: Require libgpg-error 1.17. No longer |
208 | 1168 | check for pthread. |
209 | 1169 | * doc/gpgme.texi: Document removed neccessity for thread |
229 | 1189 | 2016-11-09 Justus Winter <justus@g10code.com> |
230 | 1190 | |
231 | 1191 | python: Require at least GPGME 1.7 for out-of-tree builds. |
1192 | + commit f1f341062e24724e26928d893dd5769d3ccf5fa2 | |
232 | 1193 | * lang/python/setup.py.in: Bump required version to 1.7. |
233 | 1194 | |
234 | 1195 | 2016-11-09 Werner Koch <wk@gnupg.org> |
235 | 1196 | |
236 | 1197 | w32: Better protect the IO-system's fd_table. |
1198 | + commit 10f2e1c30be651e74a03f4563a9f212d7416adb3 | |
237 | 1199 | * src/w32-io.c (fd_table_lock): New. |
238 | 1200 | (new_fd): Lock allocation of a new slot. |
239 | 1201 | (release_fd): Lock deallocation of a slot. |
241 | 1203 | 2016-11-04 Andre Heinecke <aheinecke@intevation.de> |
242 | 1204 | |
243 | 1205 | cpp: Add API for swdb queries. |
1206 | + commit 3509cf2f9846360848b6c08d36cbca18373c935e | |
244 | 1207 | * lang/cpp/src/swdbresult.cpp, |
245 | 1208 | lang/cpp/src/swdbresult.h (SwdbResult): New. |
246 | 1209 | * lang/cpp/src/Makefile.am: Update accordingly. |
247 | 1210 | |
248 | 1211 | cpp: Add more EngineInfo::Version ctors. |
1212 | + commit 512de91f9a8da8f491e09653eb4b5bdd0a027198 | |
249 | 1213 | * lang/cpp/src/engineinfo.h |
250 | 1214 | (EngineInfo::Version::Version(const char*)), |
251 | 1215 | (EngineInfo::Version::Version()): New. |
252 | 1216 | |
253 | 1217 | cpp: Don't include gpgme.h in tofuinfo header. |
1218 | + commit 4d3f33d0e9d960df2c34fb4d215987ab4d36111c | |
254 | 1219 | * lang/cpp/src/tofuinfo.h: Don't include gpgme.h |
255 | 1220 | |
256 | 1221 | cpp: Extend gpgmefw for tofuinfo and swdb query. |
1222 | + commit 23979b9be5a6028e3e9cafc3aff632bc720b81f2 | |
257 | 1223 | * lang/cpp/src/gpgmefw.h (gpgme_tofu_info_t) |
258 | 1224 | (gpgme_query_swdb_result_t): New forwards. |
259 | 1225 | |
260 | 1226 | 2016-11-04 Werner Koch <wk@gnupg.org> |
261 | 1227 | |
262 | 1228 | w32: Fix locating gpgconf on 64 bit systems. |
1229 | + commit df08a0ca3f029b06b7e3a6bd63330df5cb96585a | |
263 | 1230 | * src/w32-util.c (find_program_at_standard_place): Use access to check |
264 | 1231 | whether the binary is at CSIDL_PROGRAM_FILES before testing |
265 | 1232 | CSIDL_PROGRAM_FILESX86. |
267 | 1234 | 2016-11-03 Werner Koch <wk@gnupg.org> |
268 | 1235 | |
269 | 1236 | core: Add gpgme_op_query_swdb and helper. |
1237 | + commit aad94cb7c313d4501bed748f48830cbb93c67e20 | |
270 | 1238 | * src/gpgme.h.in (gpgme_query_swdb_result_t): New. |
271 | 1239 | (gpgme_op_query_swdb): New. |
272 | 1240 | (gpgme_op_query_swdb_result): New. |
290 | 1258 | 2016-11-03 Andre Heinecke <aheinecke@intevation.de> |
291 | 1259 | |
292 | 1260 | qt: Change license of export / version header. |
1261 | + commit 34a4e8017be452e8ead6b9c2da84be1ec7929cae | |
293 | 1262 | * lang/qt/src/qgpgme_export.h, |
294 | 1263 | lang/qt/src/qgpgme_version.h: Change license to GPLv2+ |
295 | 1264 | |
296 | 1265 | 2016-11-03 Werner Koch <wk@gnupg.org> |
297 | 1266 | |
298 | 1267 | core: Make use of --homedir in gpgconf. |
1268 | + commit 0c2038c0043c1e79547b55e79c3d3e267dae801c | |
299 | 1269 | * src/engine-gpgconf.c (struct engine_gpgconf): Add field 'version'. |
300 | 1270 | (have_gpgconf_version): New. |
301 | 1271 | (gpgconf_release): Free VERSION. |
305 | 1275 | 2016-11-02 Andras Mantia <andras@kdab.com> |
306 | 1276 | |
307 | 1277 | qt: Fix build with g++ 4.8.x. |
1278 | + commit b4658f6a1110bb0b54bd5dfc9df8e8b390e38d61 | |
308 | 1279 | * lang/qt/src/defaultkeygenerationjob.cpp |
309 | 1280 | (DefaultKeyGenerationJob::start): Explicitly connect pointer |
310 | 1281 | in the QPointer. |
312 | 1283 | 2016-11-02 Andre Heinecke <aheinecke@intevation.de> |
313 | 1284 | |
314 | 1285 | qt, cpp: Fix versioning in cmake config and header. |
1286 | + commit bf9aa0ccf7b0165aa3a1af2bdb18daca7c02ce74 | |
315 | 1287 | * configure.ac (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO): New |
316 | 1288 | subst variables for the version header. |
317 | 1289 | * lang/cpp/src/GpgmeppConfigVersion.cmake.in, |
320 | 1292 | lang/qt/src/qgpgme_version.h.in: Use new variables. |
321 | 1293 | |
322 | 1294 | qt: Install cmake config into qgpgme subdir. |
1295 | + commit b5c4d56cfdcafade3467be100fca6f1c89ecab73 | |
323 | 1296 | * lang/qt/src/Makefile.am: Install cmake config file in qgpgme subdir. |
324 | 1297 | |
325 | 1298 | qt: Require gpgmepp from cmake config script. |
1299 | + commit 4149194d2e2f2f4d142926ba4d4efbd336b543f2 | |
326 | 1300 | * lang/qt/src/QGpgmeConfig.cmake.in.in: Require cpp. |
327 | 1301 | |
328 | 1302 | qt, cpp: Add all generated files to cleanfiles. |
1303 | + commit 8486f213423311174ebff5cba74127cbd9bb3c2a | |
329 | 1304 | * cpp/src/Makefile.am (CLEANFILES), |
330 | 1305 | qt/src/Makefile.am (CLEANFILES): Add all generated files |
331 | 1306 | to cleanfiles. |
333 | 1308 | 2016-11-01 Andre Heinecke <aheinecke@intevation.de> |
334 | 1309 | |
335 | 1310 | qt: Add Distinguished Name parser from libkleo. |
1311 | + commit 627c5deed84b4481710b6c0de06b26e886679bbe | |
336 | 1312 | * lang/qt/src/dn.cpp (DN, DN::Attribute): New public API. |
337 | 1313 | * lang/qt/src/dn.h: New. |
338 | 1314 | * lang/qt/src/Makefile.am: Update accordingly. |
339 | 1315 | |
340 | 1316 | qt, cpp: Install version headers in subdirs. |
1317 | + commit 567123de21247cab05762d799400739a12eb67ae | |
341 | 1318 | * lang/cpp/src/Makefile.am, |
342 | 1319 | lang/qt/src/Makefile.am: Install version headers in include |
343 | 1320 | subdirs. |
345 | 1322 | 2016-10-31 Justus Winter <justus@g10code.com> |
346 | 1323 | |
347 | 1324 | python: Use vanity modules for constants in tests and examples. |
1325 | + commit 4b3264345084a0c9bf9f97fb233df700d7608e66 | |
348 | 1326 | * lang/python/gpg/constants/sig/notation.py: New file. |
349 | 1327 | * lang/python/gpg/constants/sig/__init__.py: Import new module. |
350 | 1328 | |
374 | 1352 | * lang/python/tests/t-wait.py: Likewise. |
375 | 1353 | |
376 | 1354 | python: Import the topmost module in tests and examples. |
1355 | + commit 20dc37a0e7e1531b0e568a6ec29b1c2d18de59c3 | |
377 | 1356 | * examples/verifydetails.py: Only import the topmost module 'gpg' and |
378 | 1357 | update the code accordingly. |
379 | 1358 | * tests/support.py: Likewise. |
399 | 1378 | * tests/t-wrapper.py: Likewise. |
400 | 1379 | |
401 | 1380 | python: Improve constants module. |
1381 | + commit 70b7064e5c4f3eff9c296c00156724bc0cdaa64f | |
402 | 1382 | * lang/python/gpg/constants/__init__.py: Import all modules below |
403 | 1383 | 'constants/'. Interface hygiene: delete 'util'. |
404 | 1384 | * lang/python/gpg/constants/data/encoding.py: Delete 'util'. |
416 | 1396 | 2016-10-31 Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
417 | 1397 | |
418 | 1398 | python: Rename Python module from PyME to gpg. |
1399 | + commit 2fac017618a76882605125b05ff1f7393fe99860 | |
419 | 1400 | This follows weeks of discussion on the gnupg-devel mailing list. |
420 | 1401 | Hopefully it will make it easier for people using Python to use GnuPG |
421 | 1402 | in the future. |
423 | 1404 | 2016-10-25 Werner Koch <wk@gnupg.org> |
424 | 1405 | |
425 | 1406 | core: New API functions gpgme_set_sender, gpgme_get_sender. |
1407 | + commit b8159eadb5636cd9d93ee60c41e75d5978927870 | |
426 | 1408 | * src/context.h (struct gpgme_context): Add field 'sender'. |
427 | 1409 | * src/gpgme.c: Include mbox-util.h. |
428 | 1410 | (gpgme_release): Free SENDER. |
445 | 1427 | 2016-10-19 Andre Heinecke <aheinecke@intevation.de> |
446 | 1428 | |
447 | 1429 | qt: Improve WKSPublishJob apidoc. |
1430 | + commit 26cbba3c9cb04a68b95f3a6000ac9bd93fe76dd7 | |
448 | 1431 | * lang/qt/src/wkspublishjob.h: Improve doc. |
449 | 1432 | |
450 | 1433 | 2016-10-18 Werner Koch <wk@gnupg.org> |
451 | 1434 | |
452 | 1435 | Release 1.7.1. |
1436 | + commit 2c490cdb3e50761c498357982445ebb01f18dc1e | |
453 | 1437 | * configure.ac: Set LT version to C27/A16/R0. Note that the LT |
454 | 1438 | versions for cpp and Qt have already been updated. |
455 | 1439 | |
456 | 1440 | 2016-10-14 Werner Koch <wk@gnupg.org> |
457 | 1441 | |
458 | 1442 | tests: Make t-cancel more portable. |
1443 | + commit 05e8e1260baa5cbc6f1d6e387e642c1f6c188d44 | |
459 | 1444 | * tests/gpg/t-cancel.c: Include sys/time.h and protect sys/select.h. |
460 | 1445 | |
461 | 1446 | python: Call ln(1) in a portable way. |
1447 | + commit c6cab5a2bd6e7ed226c6c3f0b78b3f48b47db74c | |
462 | 1448 | * lang/python/Makefile.am: Specify target dir for ln. |
463 | 1449 | |
464 | 1450 | 2016-10-14 Andre Heinecke <aheinecke@intevation.de> |
465 | 1451 | |
466 | 1452 | cpp: Fix init of string from null. |
1453 | + commit 1e8c34a9192956bb2fe96a7a6a76ff59de8d1c0c | |
467 | 1454 | * lang/cpp/src/key.cpp (UserID::addrSpecFromString): Check return |
468 | 1455 | value before creating the string. |
469 | 1456 | |
470 | 1457 | 2016-10-13 Justus Winter <justus@g10code.com> |
471 | 1458 | |
472 | 1459 | python: Make 'get_key' more idiomatic. |
1460 | + commit f526d0e22e8b881ccbca66b46a0e1b68bbc4cd6b | |
473 | 1461 | * lang/python/pyme/core.py (Context.get_key): Raise errors.KeyNotFound |
474 | 1462 | if the key is not found. This error is both a KeyError for idiomatic |
475 | 1463 | error handling as well as a GPGMEError so we don't break existing |
479 | 1467 | * lang/python/tests/t-keylist.py: Test the new behavior. |
480 | 1468 | |
481 | 1469 | python: Return public keys by default. |
1470 | + commit 1e6073ffa98db2c265adbcf0dbbe70c067a910f0 | |
482 | 1471 | * lang/python/pyme/core.py (Core.get_key): Return public keys by |
483 | 1472 | default, improve docstring. |
484 | 1473 | * lang/python/examples/testCMSgetkey.py: Update example. |
485 | 1474 | * lang/python/examples/verifydetails.py: Likewise. |
486 | 1475 | |
487 | GnuPG-bug-id: 2751 | |
488 | ||
489 | 1476 | python: Fix example. |
1477 | + commit cabd4c74e52c8983d624b6877cddc7f8912eff04 | |
490 | 1478 | * lang/python/examples/inter-edit.py: Fix example. |
491 | 1479 | |
492 | Fixes-commit: a458e7fe | |
493 | ||
494 | 1480 | 2016-10-13 Andre Heinecke <aheinecke@intevation.de> |
495 | 1481 | |
496 | 1482 | cpp: Fix version number. |
1483 | + commit 56302e7bb6a694a7c570f389f9a7883efdfdaf42 | |
497 | 1484 | * configure.ac (LIBGPGMEPP_LT_CURRENT): Bump. |
498 | 1485 | |
499 | 1486 | qt, cpp: Fix permissions of Config files. |
1487 | + commit a274c7590aa0e38d682d5177904983632f471cb0 | |
500 | 1488 | * lang/cpp/src/Makefile.am, |
501 | 1489 | lang/qt/src/Makefile.am: Do not install config files as executable. |
502 | 1490 | |
503 | 1491 | qt: Install SpecialJob. |
1492 | + commit 2538c12fa0728f4113f83f69f8c8ec9efb163872 | |
504 | 1493 | * lang/qt/src/Makefile.am: Install SpecialJob |
505 | 1494 | * NEWS: mention it. |
506 | 1495 | |
507 | 1496 | qt, cpp: Fix expected targets in Config files. |
1497 | + commit a3cf30f89418c8a6bc9456533d95ba7fc2a33a4c | |
508 | 1498 | * lang/cpp/src/GpgmeppConfig.cmake.in.in, |
509 | 1499 | lang/qt/src/QGpgmeConfig.cmake.in.in: Remove KF5 variants. |
510 | 1500 | |
511 | 1501 | 2016-10-11 Daniel Vrátil <dvratil@kde.org> |
512 | 1502 | |
513 | 1503 | qt: Add missing implementation of MultiDeleteJob. |
1504 | + commit e5a35af5573651b96a90ef4a537b040333595472 | |
514 | 1505 | * lang/qt/src/multideletejob.h: Fix include, cryptobackend.h is now |
515 | 1506 | called protocol.h |
516 | 1507 | * lang/qt/src/multideletejob.cpp: New file. |
517 | 1508 | * lang/qt/src/Makefile.am: Add multideletejob.cpp. |
518 | 1509 | |
519 | 1510 | qt: Install abstractimportjob.h. |
1511 | + commit ce7385caabb57e5435695cc912acffe2815770b7 | |
520 | 1512 | * lang/cpp/src/Makefile.am: Install abstractimportjob.h since it's |
521 | 1513 | included from importjob.h |
522 | 1514 | |
523 | 1515 | 2016-10-11 Andre Heinecke <aheinecke@intevation.de> |
524 | 1516 | |
525 | 1517 | cpp: Add API for gpgme_addrspec_from_uid. |
1518 | + commit 54f94b14e2bb9b38ffd89f509406bfbd012da632 | |
526 | 1519 | * lang/cpp/src/key.cpp (UserID::addrSpecFromString): New static |
527 | 1520 | function to expose addrspec from uid. |
528 | 1521 | (UserID::addrSpec): New. Get addrSpec from Userid. |
531 | 1524 | 2016-10-10 Andre Heinecke <aheinecke@intevation.de> |
532 | 1525 | |
533 | 1526 | Add NEWS for cpp and qt, bump cpp version. |
1527 | + commit e7ceb83a5969581f5e1b0b6a69d18a93b594f6d4 | |
534 | 1528 | * NEWS: Add entries for cpp and qt changes. |
535 | 1529 | * configure.ac: Bump cpp version because of added API. |
536 | 1530 | |
537 | 1531 | Add convenience function to get key from sig. |
1532 | + commit b6b820bff14a9aa8fa67755b246c90062ffdba14 | |
538 | 1533 | * lang/cpp/src/verificationresult.cpp (Signature::key(bool, bool)): |
539 | 1534 | New. Can be used to search / update the key associcated with this |
540 | 1535 | signature. |
541 | 1536 | |
542 | 1537 | cpp: Return null key if the signature had no key. |
1538 | + commit 34e9dfee81958160f6604849b63369ae4de67417 | |
543 | 1539 | * lang/cpp/src/verificationresult.cpp (Private): Add null key |
544 | 1540 | to list when there is no key associated with the signature. |
545 | 1541 | |
546 | 1542 | qt: Add simple verify test. |
1543 | + commit f131a5e72b0881cafcc3b0a91da8f050af2684a6 | |
547 | 1544 | * lang/qt/tests/t-verify.cpp: New. Small test if a signature |
548 | 1545 | returns a key with fingerprint. |
549 | 1546 | * lang/qt/tests/Makefile.am: Add new test. |
550 | 1547 | |
551 | 1548 | core: Fix w32 crash in find_program_in_dir. |
1549 | + commit 098a2da15b1b46b145add623dec0488abd39bd74 | |
552 | 1550 | * src/w32-util.c (find_program_in_dir): Fix call to _gpgme_strconcat. |
553 | 1551 | |
554 | 1552 | 2016-10-08 Werner Koch <wk@gnupg.org> |
555 | 1553 | |
556 | 1554 | core: New helper function gpgme_addrspec_from_uid. |
1555 | + commit 0ea2ff67900c243fff9f689658dcb23d1c0961cd | |
557 | 1556 | * src/gpgme.h.in: Add gpgme_addrspec_from_uid. |
558 | 1557 | * src/gpgme.def, src/libgpgme.vers: Ditto. |
559 | 1558 | * src/mbox-util.c (gpgme_addrspec_from_uid): New. |
561 | 1560 | 2016-10-06 Justus Winter <justus@g10code.com> |
562 | 1561 | |
563 | 1562 | Add missing includes. |
1563 | + commit 857592041b8355cd58a7068c9f2446cf8dc0968f | |
564 | 1564 | * lang/cpp/src/key.cpp: Include <strings.h> for 'strcasecmp'. |
565 | 1565 | * tests/gpg/t-cancel.c: Include <sys/select.h> for 'fd_set' and |
566 | 1566 | friends. |
568 | 1568 | 2016-10-05 Andre Heinecke <aheinecke@intevation.de> |
569 | 1569 | |
570 | 1570 | cpp: Bump Revision. |
1571 | + commit 8033cff441e9ea185531290273ec343f3402703c | |
571 | 1572 | * configure.ac (LIBGPGMEPP_LT_REVISION): Bump revision. |
572 | 1573 | |
573 | 1574 | qt: Fix spelling error in WKSPublishJob. |
1575 | + commit 88c7e84ede4b6017cac3a396e8c87c2bd3a2bf58 | |
574 | 1576 | * src/qgpgmewkspublishjob.cpp, |
575 | 1577 | src/qgpgmewkspublishjob.h, |
576 | 1578 | src/wkspublishjob.h, |
579 | 1581 | accordingly. |
580 | 1582 | |
581 | 1583 | qt: Disable tests that require a password for 2.0. |
1584 | + commit 24779c9e2301bd17fd328d65b0383e1cbc944119 | |
582 | 1585 | * lang/qt/tests/t-encrypt.cpp: Disable tests that require |
583 | 1586 | a password for 2.0. |
584 | 1587 | |
585 | 1588 | Add warning flags for c++ compiler, too. |
1589 | + commit 4984cc93db6b55f2420a9abd844c074a5fb4ed0c | |
586 | 1590 | * configure.ac (CXXFLAGS): Add Wall and Wextra. |
587 | 1591 | |
588 | 1592 | qt: Fix unused variable warnings. |
1593 | + commit 9d1df990386010e0581b542a76a4f5d85d8d11b5 | |
589 | 1594 | * qt/src/qgpgmenewcryptoconfig.cpp, |
590 | 1595 | qt/src/threadedjobmixin.h, |
591 | 1596 | qt/tests/t-encrypt.cpp, |
593 | 1598 | qt/tests/t-wkspublish.cpp: Mark additional variables as unused. |
594 | 1599 | |
595 | 1600 | cpp: Add support for URL Data encodings. |
1601 | + commit 370ee1aa802ec6a4030a39b2df7d24a0c47e5ac7 | |
596 | 1602 | * lang/cpp/src/data.h (Data::Encoding): Extend enum. |
597 | 1603 | * lang/cpp/src/data.cpp (Data::encoding), |
598 | 1604 | Data::setEncoding): Support new values. |
599 | 1605 | |
600 | 1606 | cpp: Fix gcc diagnostic push / pop. |
1607 | + commit 39dd7585f5a7d801942efcb375d6dd46d01d2968 | |
601 | 1608 | * lang/cpp/src/context.cpp: Fix pragmas. |
602 | 1609 | |
603 | 1610 | qt: Disable t-wkspublish test. |
1611 | + commit 52a91ccc6a25425d4374b77040e30efb6816940f | |
604 | 1612 | * lang/qt/tests/Makefile.am (TESTS): Remove t-wkspublish. |
605 | 1613 | |
606 | 1614 | 2016-09-30 Alon Bar-Lev <alon.barlev@gmail.com> |
607 | 1615 | |
608 | 1616 | python: Link 'data.h' and 'config.h' into the builddir. |
1617 | + commit 453ab9d24ca48c9e01d21e1454d6b08de1938b76 | |
609 | 1618 | * lang/python/Makefile.am: Link to the files. |
610 | 1619 | * lang/python/gpgme.i: Update path. |
611 | 1620 | * lang/python/setup.py.in: Do not add the top builddir to the include |
612 | 1621 | path. |
613 | 1622 | |
614 | 1623 | python: Add 'prepare' target. |
1624 | + commit 68fb8371a1dd5f4e05e50b1733f9996d139cbf38 | |
615 | 1625 | * lang/python/Makefile.am: Add 'prepare' target. |
616 | 1626 | |
617 | 1627 | 2016-09-29 Andre Heinecke <aheinecke@intevation.de> |
618 | 1628 | |
619 | 1629 | cpp, qt: Handle modified includedir installation. |
1630 | + commit 7302791c0d308c3284ac24a743035d27a0c0b6ba | |
620 | 1631 | * lang/cpp/src/Makefile.am, |
621 | 1632 | lang/qt/src/Makefile.am: Replace resolved_includedir. |
622 | 1633 | * lang/cpp/src/GpgmeppConfig.cmake.in.in, |
626 | 1637 | 2016-09-27 Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
627 | 1638 | |
628 | 1639 | Clarify licensing. |
1640 | + commit 145392f07f42ef23ebcb83a917b4d8e2964e7aa8 | |
629 | 1641 | * src/b64dec.c, src/mbox-util.c, src/mbox-util.h: These three files |
630 | 1642 | are explicitly licensed under LGPL, but their comments suggest that |
631 | 1643 | details about the warranty can be found in the GPL. Adjust comments |
634 | 1646 | 2016-09-27 Justus Winter <justus@g10code.com> |
635 | 1647 | |
636 | 1648 | tests: Fix check for gpg versions not reporting the critical flag. |
1649 | + commit a423603f80d9eb653ce9c171662db2175d7456f5 | |
637 | 1650 | * lang/python/tests/t-sig-notation.py: Also blacklist 2.0.x. |
638 | 1651 | * tests/gpg/t-sig-notation.c: Likewise. |
639 | 1652 | |
640 | 1653 | 2016-09-26 Justus Winter <justus@g10code.com> |
641 | 1654 | |
642 | 1655 | python: Correctly translate to size_t. |
1656 | + commit c38fabfea0601ed5f61e27e0bf43f8e74c67ce2a | |
643 | 1657 | * lang/python/gpgme.i: Correctly translate Python number to size_t. |
644 | 1658 | |
645 | 1659 | python: Correctly translate off_t. |
1660 | + commit 1d80e7374aa3150306c86afe7acdc8e8eb05143f | |
646 | 1661 | * lang/python/gpgme.i: Improve int/long translations, correctly handle |
647 | 1662 | off_t with large file support. |
648 | 1663 | |
649 | 1664 | python: Include 'config.h'. |
1665 | + commit 3703a4723899d7563937b4b99f5bbe4dd8d3dfed | |
650 | 1666 | * lang/python/Makefile.am: Pass 'top_builddir' to 'setup.py'. |
651 | 1667 | * lang/python/gpgme.i: Include 'config.h'. |
652 | 1668 | * lang/python/helpers.c: Likewise. |
656 | 1672 | 2016-09-23 Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
657 | 1673 | |
658 | 1674 | Fix spelling. |
1675 | + commit 95f38652f696476b38a040644eac40b4511d2b32 | |
659 | 1676 | * lang/cpp/src/context.h, lang/qt/src/protocol.h, |
660 | 1677 | lang/qt/src/wkspublishjob.h, src/data-identify.c, src/engine-gpg.c: |
661 | 1678 | minor spelling cleanup. |
662 | 1679 | |
663 | 1680 | move some file encodings to UTF-8. |
1681 | + commit a11450eb048df79a3f2b00ebef6d7cab07ad5054 | |
664 | 1682 | * THANKS, doc/ChangeLog-2011, tests/ChangeLog-2011, |
665 | 1683 | tests/gpg/geheim.txt: convert from iso 8859-1 to utf-8. |
666 | 1684 | * lang/qt/src/dataprovider.cpp, lang/qt/src/qgpgmerefreshkeysjob.cpp, |
670 | 1688 | 2016-09-23 Andre Heinecke <aheinecke@intevation.de> |
671 | 1689 | |
672 | 1690 | tests: Check data after decryption. |
1691 | + commit 9b38817968b90caf73f123255fe427691e82fec4 | |
673 | 1692 | * tests/gpgsm/t-decrypt.c (main): Check data matches expected. |
674 | 1693 | Only print result if it does not. |
675 | 1694 | |
676 | 1695 | cpp, qt: Include config.h. |
1696 | + commit a142f187b7ddb2728ec3e1743da4a0c4538ab40a | |
677 | 1697 | lang/cpp/src/callbacks.cpp, |
678 | 1698 | lang/cpp/src/configuration.cpp, |
679 | 1699 | lang/cpp/src/context.cpp, |
747 | 1767 | 2016-09-22 Werner Koch <wk@gnupg.org> |
748 | 1768 | |
749 | 1769 | w32: Silence some warnings about unused parameters. |
1770 | + commit 583aafdd6870a7fb12a34d90993fd0f46928592c | |
750 | 1771 | * src/assuan-support.c (my_recvmsg, my_sendmsg, my_waitpid) |
751 | 1772 | (my_socketpair) [W32]: Mark unused parameters. |
752 | 1773 | |
753 | 1774 | core: Fix error checking in _gpgme_mkstemp. |
1775 | + commit c447b64d5989845a2ae2cf8fb30a92d2a0bd05af | |
754 | 1776 | * src/w32-util.c (_gpgme_mkstemp): Fix error checking. |
755 | 1777 | (dlopen): Mark FLAGS as unused. |
756 | 1778 | |
757 | 1779 | core: New helper function _gpgme_strconcat. |
1780 | + commit dc39552d01094eff2bef5f9fcd1c16928909d20e | |
758 | 1781 | * src/conversion.c: Include stdarg.h. |
759 | 1782 | (do_strconcat): New. |
760 | 1783 | (_gpgme_strconcat): New. |
772 | 1795 | 2016-09-22 Daiki Ueno <ueno@gnu.org> |
773 | 1796 | |
774 | 1797 | tests: Add test for cancellation. |
1798 | + commit 7a6543c2dfeef874a34086c8f3eeb1dbdf1ce822 | |
775 | 1799 | * tests/gpg/t-cancel.c: New file. |
776 | 1800 | * tests/gpg/Makefile.am (tests_skipped): New variable, default to |
777 | 1801 | t-genkey and t-cancel. |
779 | 1803 | * tests/gpg/.gitignore: Add t-cancel. |
780 | 1804 | |
781 | 1805 | gpg: Add option --exit-on-status-write-error. |
1806 | + commit dee56820cabde60c43c9bf8281b8d411cb2ad644 | |
782 | 1807 | * src/engine-gpg.c (gpg_new): Add --exit-on-status-write-error if the |
783 | 1808 | engine version is latest enough to expect progress output from gpg. |
784 | 1809 | |
785 | 1810 | tests: Fix select usage in t-eventloop. |
1811 | + commit d0cf6b15121c9b42dbcef243e5ce30c9996a449c | |
786 | 1812 | * tests/gpg/t-eventloop.c (do_select): Supply timeout value to select. |
787 | 1813 | |
788 | 1814 | doc: Fix minor errors in I/O callback example. |
1815 | + commit 0aaf1dedd629446ab991fff76581b4b58e4872a0 | |
789 | 1816 | * gpgme.texi (I/O Callback Example): Fix typos, add timeout to select, |
790 | 1817 | and initialize mutex as recursive. |
791 | 1818 | |
792 | 1819 | 2016-09-21 Andreas Stieger <astieger@suse.com> |
793 | 1820 | |
794 | 1821 | cpp: Avoid missing returns in non-void functions. |
1822 | + commit ae324b51ffa338b891387bff2657d60c1fd3ae40 | |
795 | 1823 | * lang/cpp/src/context.cpp |
796 | 1824 | (Context::signaturePolicyURL): return nullptr on default |
797 | 1825 | (to_tofu_policy_t): add default case for unknown |
803 | 1831 | 2016-09-21 Werner Koch <wk@gnupg.org> |
804 | 1832 | |
805 | 1833 | Release 1.7.0. |
1834 | + commit e7ab75379feadcc2894d9d4cde0f16ad0044780d | |
806 | 1835 | * configure.ac: Bump LT vesion to C26/A15/R0. |
807 | 1836 | |
808 | 1837 | python: Create install dir. |
1838 | + commit 936928632b02d7cc2ac645543bb03e4c94285f05 | |
809 | 1839 | * lang/python/Makefile.am (install-exec-local): Create dir. |
810 | 1840 | |
811 | 1841 | 2016-09-20 Werner Koch <wk@gnupg.org> |
812 | 1842 | |
813 | 1843 | tests: Make "make -j distcheck" work in Python. |
1844 | + commit 0763357e39d140b068ee9838a5da08be75426d9f | |
814 | 1845 | * lang/python/Makefile.am (SUBDIRS): Make current dir fist. |
815 | 1846 | * lang/python/tests/Makefile.am (xcheck): Depend on pubring-stamp. |
816 | 1847 | (CLEANFILES): Remove private-keys-v1.d/gpg-sample.stamp. |
821 | 1852 | basename. |
822 | 1853 | |
823 | 1854 | tests: Use --batch for gpg import. |
1855 | + commit bfb6890ded99f040fe8ecf910f927a136e4acfda | |
824 | 1856 | * lang/python/tests/Makefile.am (./pubring-stamp): Use --batch with |
825 | 1857 | GPG to avoid Pinentries during import when using GnuPG >= 2.1. |
826 | 1858 | Replace touch by echo. |
827 | 1859 | * tests/gpg/Makefile.am (./pubring-stamp): Ditto. |
828 | 1860 | |
829 | 1861 | tests: Improve portability. |
1862 | + commit 29207bcd3bf4de7264197db6758130375b16d9bb | |
830 | 1863 | * lang/qt/tests/Makefile.am (clean-local): Avoid non-portable "--" |
831 | 1864 | * lang/python/Makefile.am (copystamp): Use well defined cp -R instead |
832 | 1865 | of cp -r. |
833 | 1866 | |
834 | 1867 | build: Create swdb file. |
1868 | + commit df7e92b4d585b7dce919c5a3aab9524f6e183cbe | |
835 | 1869 | * Makefile.am (distcheck-hook): New. |
836 | 1870 | (dist-hook): s/VERSION/PACKAGE_VERSION/ for future compatibility. |
837 | 1871 | |
838 | 1872 | 2016-09-20 Justus Winter <justus@g10code.com> |
839 | 1873 | |
840 | 1874 | python: Fix detection of Python available versions. |
1875 | + commit ef99b74eb12463db7da5806a316e3b55f8097c5c | |
841 | 1876 | * configure.ac: Test for 'PYTHON_VERSION' as 'AX_PYTHON_DEVEL' sets |
842 | 1877 | 'PYTHON' but clears the former. |
843 | 1878 | |
844 | Fixes-commit: 99db3512 | |
845 | ||
846 | 1879 | 2016-09-19 Andre Heinecke <aheinecke@intevation.de> |
847 | 1880 | |
848 | 1881 | core: Remove moc artifact. |
1882 | + commit e3c35147d6adb754d4eb0781a54af2a8f0803663 | |
849 | 1883 | * src/moc_kdpipeiodevice.cpp: Removed. |
850 | 1884 | * src/Makefile.am (EXTRA_DIST): Remove moc_kdpipeiodevice.cpp. |
851 | 1885 | |
852 | 1886 | qt: Improve README. |
1887 | + commit 3f92253e0e476d77aa11463bc51ade367985855f | |
853 | 1888 | * lang/qt/README: Add more content. Clearly note license difference. |
854 | 1889 | |
855 | 1890 | cpp: Improve README. |
1891 | + commit 66febf9942c321d30b8770f6aa6cd6ce2315d34f | |
856 | 1892 | * lang/cpp/README: Add more content, move license to bottom. |
857 | 1893 | |
858 | 1894 | qt: Add debug output for testTofuPolicy. |
1895 | + commit d438cb59a068b6f076e6bd70d3a2c46bc05ccb5c | |
859 | 1896 | * lang/qt/tests/t-tofuinfo.cpp (testTofuPolicy): Add |
860 | 1897 | debug output. |
861 | 1898 | |
862 | 1899 | 2016-09-19 Ben Kibbey <bjk@luxsci.net> |
863 | 1900 | |
864 | 1901 | core: Check for GPG_TTY as well as DISPLAY. |
1902 | + commit 9d62bacac7826cb73bb18fac7268f3d2df662d7b | |
865 | 1903 | * src/engine-assuan.c (llass_new): Update --ttyname from GPG_TTY. |
866 | 1904 | * src/engine-g13.c (g13_new): Ditto. |
867 | 1905 | * src/engine-gpg.c (gpg_new): Ditto. |
871 | 1909 | 2016-09-16 Andre Heinecke <aheinecke@intevation.de> |
872 | 1910 | |
873 | 1911 | qt: Add test for setting tofu policy. |
1912 | + commit a8ff34fc3025af4079cede7f8f9fdf40189b8638 | |
874 | 1913 | * lang/qt/tests/t-tofuinfo.cpp (testTofuPolicy): New. |
875 | 1914 | |
876 | 1915 | qt: Add job for tofupolicy. |
1916 | + commit 77aecfb5c97cea1a99f1ff627748cf71767bac5c | |
877 | 1917 | * lang/qt/src/job.cpp, lang/qt/src/protocol.h, |
878 | 1918 | lang/qt/src/protocol_p.h: Register job. |
879 | 1919 | * lang/qt/src/qgpgmetofupolicyjob.cpp, |
882 | 1922 | * lang/qt/src/Makefile.am: Update accordingly. |
883 | 1923 | |
884 | 1924 | cpp: Add support for gpgme_op_tofu_policy. |
1925 | + commit 4d384d7bfef044094695271576ca233625bb520a | |
885 | 1926 | * src/context.cpp, src/context.h (setTofuPolicy, setTofuPolicyStart): |
886 | 1927 | New. |
887 | 1928 | |
888 | 1929 | cpp: Declare sizes of tofu-info enums. |
1930 | + commit 32baac8cdec6fee51bdfc3c55cb2ee141e086df4 | |
889 | 1931 | * lang/cpp/src/tofuinfo.h (Policy, Validity): Declare sizes. |
890 | 1932 | |
891 | 1933 | 2016-09-16 Werner Koch <wk@gnupg.org> |
892 | 1934 | |
893 | 1935 | cpp: Silence use of deprecated function warning. |
1936 | + commit bd24db313d860ae46d37776dcf1067455d1b9880 | |
894 | 1937 | * lang/cpp/src/context.cpp (GpgME): Use pragma to silence wardning. |
895 | 1938 | |
896 | 1939 | core: Document the version a function has been deprecated. |
1940 | + commit b615316168f4d33311909d4056b236d13c69488f | |
897 | 1941 | * src/gpgme.h.in (_GPGME_DEPRECATED): Change to take versio numbers |
898 | 1942 | for documentation. Change all places. |
899 | 1943 | (_GPGME_DEPRECATED_OUTSIDE_GPGME): Ditto. |
900 | 1944 | * lang/python/gpgme-h-clean.py: Adjust RE. |
901 | 1945 | |
902 | 1946 | core: Map GPGME_STATUS_EOF to the empty string. |
1947 | + commit 3d6340e8c59ee11a95e03fb213ad9b228be47833 | |
903 | 1948 | * src/status-table.c (_gpgme_status_to_string): Return "" for EOF. |
904 | 1949 | * src/engine-gpg.c (read_status): Ditto. The old code accidently used |
905 | 1950 | GPGME_STATUS_EOF which is the integer 0 and neiteyr NULL nor a string. |
908 | 1953 | Kai Michaelis <kai@gnupg.org> |
909 | 1954 | |
910 | 1955 | python: Release the GIL during calls into GPGME. |
1956 | + commit 6af7bee076bacbc0cdfe7de342bce43ca5671b3b | |
911 | 1957 | * lang/python/helpers.c (pyme_raise_callback_exception): Re-acquire |
912 | 1958 | the Global Interpreter Lock. |
913 | 1959 | (pyPassphraseCb, pyme_set_passphrase_cb, pyProgressCb, |
921 | 1967 | 2016-09-16 Justus Winter <justus@g10code.com> |
922 | 1968 | |
923 | 1969 | python: Adapt to 'gpgme_op_interact'. |
1970 | + commit a458e7fe2006d92bd5a838e2747fb66bbac4b1b8 | |
924 | 1971 | * lang/python/examples/inter-edit.py: Update example. |
925 | 1972 | * lang/python/gpgme.i (gpgme_edit_cb_t): Turn into |
926 | 1973 | 'gpgme_interact_cb_t'. |
938 | 1985 | 2016-09-16 Werner Koch <wk@gnupg.org> |
939 | 1986 | |
940 | 1987 | core: Remove stub to try implementing gpg < 2.1 support for createkey. |
1988 | + commit 268e251b802cc7c19831722d7e3a52777a0f412f | |
941 | 1989 | * src/engine-gpg.c (gpg_createkey_legacy): Remove. |
942 | 1990 | (gpg_genkey): Remove call. |
943 | 1991 | |
944 | 1992 | core: Fix setting og the verification result. |
1993 | + commit 1f9641dd0fb08e4a3df3b507b974a3f78887920f | |
945 | 1994 | * src/verify.c (parse_new_sig): Proberly handle the RC in an ERRSIG |
946 | 1995 | status. |
947 | 1996 | |
948 | 1997 | 2016-09-15 Werner Koch <wk@gnupg.org> |
949 | 1998 | |
950 | 1999 | core: New function gpgme_op_interact, deprecate gpgme_op_edit. |
2000 | + commit ed1f2700a73060e2615697491ea9e49ded4293e6 | |
951 | 2001 | * src/gpgme.h.in (gpgme_interact_cb_t): New. |
952 | 2002 | (GPGME_INTERACT_CARD): New. |
953 | 2003 | (gpgme_op_interact_start, gpgme_op_interact): New. |
965 | 2015 | (main): s/gpgme_op_edit/gpgme_op_interact/. |
966 | 2016 | |
967 | 2017 | core: Minor change of the gpgme_op_edit semantics. |
2018 | + commit d2b72d3cc19fe2a7d548dac38d55e069e0c9a904 | |
968 | 2019 | * src/edit.c (command_handler): Handle special error code. |
969 | 2020 | * src/engine-gpg.c (read_status): Ditto. |
970 | 2021 | * src/engine-gpgsm.c (status_handler): Ditto. |
974 | 2025 | 2016-09-14 Werner Koch <wk@gnupg.org> |
975 | 2026 | |
976 | 2027 | core: New function gpgme_op_tofu_policy. |
2028 | + commit 7c37719d79345a665ec2f4570e3f257033b58c62 | |
977 | 2029 | * src/gpgme.h.in (gpgme_op_tofu_policy_start): New function. |
978 | 2030 | (gpgme_op_tofu_policy): New function. |
979 | 2031 | * src/libgpgme.vers, src/gpgme.def: Add new functions. |
990 | 2042 | * tests/Makefile.am (noinst_PROGRAMS): Add it. |
991 | 2043 | |
992 | 2044 | core: Defer implementation of gpgme_op_createkey with gpg < 2.1. |
2045 | + commit d79dcb78d867aaf55b85aea117c4ae6035a1531a | |
993 | 2046 | * src/engine-gpg.c (gpg_createkey_legacy): Mark unused variables. |
994 | 2047 | |
995 | 2048 | core: New function gpgme_op_keysign. |
2049 | + commit bfd2bd0ccc9fed8284ef932ac788d4ca0dba0336 | |
996 | 2050 | * src/gpgme.h.in (gpgme_op_keysign_start, gpgme_op_keysign): New. |
997 | 2051 | (GPGME_KEYSIGN_LOCAL): New. |
998 | 2052 | (GPGME_KEYSIGN_LFSEP): New. |
1016 | 2070 | 2016-09-14 Justus Winter <justus@g10code.com> |
1017 | 2071 | |
1018 | 2072 | python: Clarify that we support Python 2.7 too. |
2073 | + commit 594c3b8b052e60b6be77ed532fe46549133a9726 | |
1019 | 2074 | * lang/python/README: Use 'Python' instead of 'Python 3'. |
1020 | 2075 | * lang/python/pyme/version.py.in: Likewise. |
1021 | 2076 | * lang/python/setup.py.in: Add classifier for 2.7, drop 3 only. |
1022 | 2077 | |
1023 | 2078 | python: Trim imports. |
2079 | + commit 4011b2b2a1050f0837e989da3db9b5459e71ccd6 | |
1024 | 2080 | * lang/python/examples/encrypt-to-all.py: Drop unused import of 'os'. |
1025 | 2081 | * lang/python/examples/signverify.py: Likewise. |
1026 | 2082 | * lang/python/examples/simple.py: Likewise. |
1027 | 2083 | * lang/python/examples/verifydetails.py: Likewise. |
1028 | 2084 | |
1029 | 2085 | python: Improve error handling. |
2086 | + commit 44d18200d5ffe8691e18d93ce6c534660702b982 | |
1030 | 2087 | * lang/python/gpgme.i (gpgme_engine_info_t): Improve error handling. |
1031 | 2088 | |
1032 | 2089 | python: Adapt to TOFU changes. |
2090 | + commit f6cd560ca74248dd719a37cfb34386148727a92d | |
1033 | 2091 | * lang/python/pyme/results.py (TofuInfo): Drop. |
1034 | 2092 | (Signature): The TOFU information moved to the key. |
1035 | 2093 | |
1036 | 2094 | python: Improve build system integration. |
2095 | + commit 99db351288d5bb075f124ef10e540e25bc36b70a | |
1037 | 2096 | * configure.ac: Try to compile a Python module for each version. |
1038 | 2097 | * m4/m4_ax_swig_python.m4: Drop unused file. |
1039 | 2098 | |
1040 | 2099 | 2016-09-14 Werner Koch <wk@gnupg.org> |
1041 | 2100 | |
1042 | 2101 | core: New function gpgme_op_revuid. |
2102 | + commit c943380b7a2cc9b32f81c22224fc6f92e8ea8469 | |
1043 | 2103 | * src/engine.h (GENKEY_EXTRAFLAG_REVOKE): New. |
1044 | 2104 | * src/genkey.c (adduid_start): Rename to addrevuid_start. Add arg |
1045 | 2105 | REVOKE and pass it as extraflags. Remove useless ARMOR extraflag. |
1050 | 2110 | * tests/run-genkey.c: Add option --revuid. |
1051 | 2111 | |
1052 | 2112 | core: Change a parameter for the engine's genkey function. |
2113 | + commit c22f5884c50557f54704f4becc5a8c1ee0749547 | |
1053 | 2114 | * src/engine.h (GENKEY_EXTRAFLAG_ARMOR): New. |
1054 | 2115 | * src/engine-backend.h (engine_ops): Rename USE_ARMOR in genkey to |
1055 | 2116 | EXTRAFLAGS. |
1064 | 2125 | 2016-09-14 Justus Winter <justus@g10code.com> |
1065 | 2126 | |
1066 | 2127 | python: Build for both Python2 and Python3. |
2128 | + commit 24b4162d908b48a92660020be0b776c2874fb05a | |
1067 | 2129 | * NEWS: Update. |
1068 | 2130 | * configure.ac: Check for multiple Python versions. |
1069 | 2131 | * lang/python/Makefile.am: Build and install for both Python versions. |
1073 | 2135 | 2016-09-14 Werner Koch <wk@gnupg.org> |
1074 | 2136 | |
1075 | 2137 | core: New function gpgme_op_adduid. |
2138 | + commit 3210f3e4725afc5ee2810b9a1361918ec9c42ca4 | |
1076 | 2139 | * src/genkey.c: Replace most error codes GPG_ERR_INV_VALUE by |
1077 | 2140 | GPG_ERR_INV_ARG. |
1078 | 2141 | (struct op_data_t): Add field UIDMODE. |
1083 | 2146 | * tests/run-genkey.c: Add option --adduid. |
1084 | 2147 | |
1085 | 2148 | core: New function gpgme_op_createsubkey. |
2149 | + commit cc353701b0fde4c811ddc1e9a91b852dfe9f4e06 | |
1086 | 2150 | * src/genkey.c (createsubkey_start): New. |
1087 | 2151 | (gpgme_op_createsubkey_start, gpgme_op_createsubkey): New. |
1088 | 2152 | * src/gpgme.def, src/libgpgme.vers: Add them. |
1094 | 2158 | 2016-09-13 Werner Koch <wk@gnupg.org> |
1095 | 2159 | |
1096 | 2160 | core: Use const char * where appropriate. |
2161 | + commit 51f9acbca935c5287d9a28205037b0923e9a65f5 | |
2162 | ||
1097 | 2163 | |
1098 | 2164 | core: Cast away the common const problem with spawn and argv. |
2165 | + commit 686a065f639ef006e33c164e282d787bcd169754 | |
1099 | 2166 | * src/dirinfo.c (read_gpgconf_dirs): Use a cast to assignd to ARGV. |
1100 | 2167 | |
1101 | 2168 | core: Fix condition-always-true warning in trace macro. |
2169 | + commit 3009e6162eaa39adaaf45f06fc4f88c7153360ee | |
1102 | 2170 | * src/data-compat.c (old_user_read): Cast AMT. |
1103 | 2171 | |
1104 | 2172 | core: Mark unused function args. |
2173 | + commit 4a200146b602349eebb4eac2e102357748d7ba5b | |
2174 | ||
1105 | 2175 | |
1106 | 2176 | tests: Mark lots of unused vars and fix const mismatches. |
2177 | + commit 9064eebdc05e7149c2c8cc899fbd7874622fb769 | |
2178 | ||
1107 | 2179 | |
1108 | 2180 | tests: Use gpgme_io_write in passhrase callbacks. |
2181 | + commit 4491ef0a9a15d3b307d1ade37ff620ef9fcb2478 | |
1109 | 2182 | * tests/gpg/t-support.h (passphrase_cb): Use gpgme_io_write. |
1110 | 2183 | * tests/gpgsm/t-support.h (passphrase_cb): Ditto. |
1111 | 2184 | * tests/run-support.h (passphrase_cb): Ditto. |
1112 | 2185 | |
1113 | 2186 | core: Do not pass const char* to functions taking a char*. |
2187 | + commit 3972f476e00f27d41a0aeabcb66600905b6737bd | |
2188 | ||
1114 | 2189 | |
1115 | 2190 | build: Use more compiler warnings. |
2191 | + commit 0510591c36591816a6ff3f87a04451001b7ed46f | |
1116 | 2192 | * configure.ac: Add useful compiler warnings. |
1117 | 2193 | |
1118 | 2194 | core: New function gpgme_op_create_key. |
2195 | + commit 00c501d296da287bec2fd6a0e3912abfbde90a98 | |
1119 | 2196 | * src/engine-backend.h (engine_ops): Change prototype of genkey. |
1120 | 2197 | * src/engine-gpgsm.c (gpgsm_genkey): Change accordingly. |
1121 | 2198 | * src/engine-gpg.c (gpg_genkey): Change it to a dispatcher. |
1152 | 2229 | 2016-09-13 Justus Winter <justus@g10code.com> |
1153 | 2230 | |
1154 | 2231 | python: Handle slight differences between Python 2 and 3. |
2232 | + commit 70a3be27a509a1b5ea7372bee93d83c5019427ff | |
1155 | 2233 | * lang/python/helpers.c (pyDataWriteCb): Handle Python integers being |
1156 | 2234 | returned on Python 2. |
1157 | 2235 | (pyDataSeekCb): Likewise. |
1168 | 2246 | using bytestrings in Python 3 would be very inconvenient. |
1169 | 2247 | |
1170 | 2248 | python: Fix types and error handling. |
2249 | + commit 4abff7d750a1abf5b388a4c87ec321fc3e4aed10 | |
1171 | 2250 | * lang/python/helpers.c (_pyme_edit_cb): Drop the const. |
1172 | 2251 | (_pyme_assuan_{data,inquire,status}_cb): Fix error handling. |
1173 | 2252 | |
1174 | 2253 | 2016-09-12 Justus Winter <justus@g10code.com> |
1175 | 2254 | |
1176 | 2255 | python: Avoid Python3-only form of super(). |
2256 | + commit c0c50318bd8ef6c8119ad9fdc53ad9087ded4c32 | |
1177 | 2257 | * lang/python/pyme/core.py (GpgmeWrapper.__repr__): Use more |
1178 | 2258 | compatible form of super. |
1179 | 2259 | (GpgmeWrapper.__setattr__): Likewise. |
1181 | 2261 | (Data.__init__): Likewise. |
1182 | 2262 | |
1183 | 2263 | python: Make type translation compatible with Python 2.7. |
2264 | + commit 1d5bbbf1185a0d1f82750f10b69dad3999f7ef4c | |
1184 | 2265 | * lang/python/gpgme.i: Avoid functions not available in Python 2.7. |
1185 | 2266 | * lang/python/helpers.c: Likewise. |
1186 | 2267 | |
1187 | 2268 | python: Avoid hardcoding the interpreter. |
2269 | + commit 70999d81618b3d3ae6b61a43be2ce703ad284275 | |
1188 | 2270 | * lang/python/setup.py.in: Avoid hardcoding the interpreter. |
1189 | 2271 | |
1190 | 2272 | python: Do not rely on subprocess.DEVNULL. |
2273 | + commit b48b852a846129914d6c63ec7b47388cdcf6acca | |
1191 | 2274 | * lang/python/setup.py.in: Do not rely on subprocess.DEVNULL. |
1192 | 2275 | |
1193 | 2276 | tests: Fix version comparison. |
2277 | + commit dfd99ab50c3bc1d6745b6f682791e4885e8d8a9a | |
1194 | 2278 | * tests/gpg/t-sig-notation.c: Fix version comparison. |
1195 | 2279 | |
1196 | Fixes-commit: a0263ad2 | |
1197 | ||
1198 | 2280 | tests: Make signature notation test compatible with older GnuPGs. |
2281 | + commit a0263ad282d350b548cbbc27e96f196d9217d040 | |
1199 | 2282 | * lang/python/tests/t-sig-notation.py: Only check the critical flag |
1200 | 2283 | when GnuPG >= 2.1.13 is used. |
1201 | 2284 | * tests/gpg/t-sig-notation.c: Likewise. |
1202 | 2285 | |
1203 | Fixes-commit: c88c9ef3 | |
1204 | ||
1205 | 2286 | 2016-09-12 Andre Heinecke <aheinecke@intevation.de> |
1206 | 2287 | |
1207 | 2288 | qt: Fix some includes. |
2289 | + commit d480f6b701894f78f3f4016d69c0e3b87939930b | |
1208 | 2290 | * lang/qt/src/qgpgmekeyformailboxjob.cpp: Explicitly include |
1209 | 2291 | QStringList. |
1210 | 2292 | * lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp: Move |
1213 | 2295 | 2016-09-12 Justus Winter <justus@g10code.com> |
1214 | 2296 | |
1215 | 2297 | qt: Fix tofu test. |
2298 | + commit 7b9e6ea376d04fb4694ed22369abaae92ce3ec86 | |
1216 | 2299 | * lang/qt/tests/t-tofuinfo.cpp: Adjust member names. |
1217 | 2300 | |
1218 | Fixes-commit: 120b1478 | |
1219 | ||
1220 | 2301 | 2016-09-07 Werner Koch <wk@gnupg.org> |
1221 | 2302 | |
1222 | 2303 | core,cpp: Extend the TOFU information. |
2304 | + commit 120b14783c0312d782dc08ce4949a6209d5ccc7b | |
1223 | 2305 | * src/gpgme.h.in (struct _gpeme_tofu_info): Rename FIRSTSEEN to |
1224 | 2306 | SIGNFIRST and LASTSEEN to SIGNLAST. Add ENCRFIST and ENCRLAST. |
1225 | 2307 | * src/keylist.c (parse_tfs_record): Parse to ENCRFIRST and ENCRLAST. |
1234 | 2316 | 2016-09-06 Andre Heinecke <aheinecke@intevation.de> |
1235 | 2317 | |
1236 | 2318 | tests: Set passphrase cb in t-encrypt-mixed. |
2319 | + commit 151da95470f174dc770b2111890ad650a1697276 | |
1237 | 2320 | * tests/gpg/t-encrypt-mixed.c (main): Set passphrase cb. |
1238 | 2321 | |
1239 | 2322 | core: Check for gpg version for loopback mode. |
2323 | + commit e8cb143c8337b122a6790f769ddb0a97c4baccd3 | |
1240 | 2324 | * src/engine-gpg.c (build_argv): Check for version 2.1.0 |
1241 | 2325 | before adding pinentry-mode. |
1242 | 2326 | |
1243 | 2327 | core: Fix passphrase cb for mixed sym encrypt. |
2328 | + commit efe7e11dfa2ff911b477ce748292e53e7a50347e | |
1244 | 2329 | * src/encrypt.c (encrypt_start): Handle SYMMETRIC flag. |
1245 | 2330 | * src/encrypt-sign.c (encrypt_sign_start): Ditto. |
1246 | 2331 | |
1247 | 2332 | 2016-09-05 Andre Heinecke <aheinecke@intevation.de> |
1248 | 2333 | |
1249 | 2334 | qt: Clarify comment and strings in tofuinfo test. |
2335 | + commit ab3fbdbd05cfd1b039bb5b1eb3941fbb4bcf6307 | |
1250 | 2336 | * lang/qt/tests/t-tofuinfo.cpp (testTofuSignCount) |
1251 | 2337 | (testTofuKeyList): Ensure distinct messages. Clarify comment. |
1252 | 2338 | |
1253 | 2339 | qt: Enable signcount checks in tofuinfo test. |
2340 | + commit 965b842fad6ec6fbd8902f3a32119abcd0728fe4 | |
1254 | 2341 | * lang/qt/tests/t-tofuinfo.cpp: Enable checks for signcount. |
1255 | 2342 | |
1256 | 2343 | cpp: Add convenience update function to a key. |
2344 | + commit 79439e76cc5b302222874a1f9e93665cb12801ac | |
1257 | 2345 | * lang/cpp/src/key.cpp (Key::update): New. |
1258 | 2346 | * lang/cpp/src/key.h: Update accordingly. |
1259 | 2347 | |
1260 | 2348 | cpp: Add ostream operators for key and uid. |
2349 | + commit 444d85ace0dddff5c511961927052d9946035b00 | |
1261 | 2350 | * lang/cpp/src/key.cpp (Key, UserID): Add ostream operator. |
1262 | 2351 | * lang/cpp/src/key.h: Update accordingly. |
1263 | 2352 | |
1264 | 2353 | qt: Add missing header redirection. |
2354 | + commit 8a39a595eb802b80a6ad756b0ee8939e9733e86f | |
1265 | 2355 | * lang/qt/src/keyformailboxjob.h, |
1266 | 2356 | lang/qt/src/qgpgmekeyformailboxjob.h: Fix includes. |
1267 | 2357 | |
1268 | 2358 | qt: Include cpp before core directory. |
2359 | + commit e3a4697894cc5a93c295e84bb10c743bc7fdc87e | |
1269 | 2360 | * lang/qt/src/Makefile.am (AM_CPPFLAGS): Include cpp before core. |
1270 | 2361 | |
1271 | 2362 | 2016-08-25 Andre Heinecke <aheinecke@intevation.de> |
1272 | 2363 | |
1273 | 2364 | qt: Fix 2.1 t-support copy. |
2365 | + commit 05570bd3d05fb3d7934c1122f0d5ef5fdbaa7974 | |
1274 | 2366 | * lang/qt/src/t-support.cpp (copyKeyring): Fix seckey copy. |
1275 | 2367 | |
1276 | 2368 | qt: Fix and extend TofuInfo test. |
2369 | + commit 9fc72e928bf2cf239bd3b0facdf33ceb1acc975b | |
1277 | 2370 | * lang/qt/tests/t-tofuinfo.cpp: Delete executed jobs. |
1278 | 2371 | (testTofuKeyList): New. |
1279 | 2372 | (testSupported): Activate for 2.1.16 |
1280 | 2373 | (signAndVerify): Disable sigcount tests. |
1281 | 2374 | |
1282 | 2375 | qt: Fix keyring copy in tests. |
2376 | + commit c875f07e559a7c53fc173b4c3f9f5715f3fbb8f8 | |
1283 | 2377 | * lang/qt/test/t-encrypt.cpp, |
1284 | 2378 | lang/qt/test/t-tofuinfo.cpp: Assert on copy failure. |
1285 | 2379 | * lang/qt/test/t-support.cpp (copyKeyrings): Fix path. |
1286 | 2380 | |
1287 | 2381 | qt: Add generic flag support for keylistjobs. |
2382 | + commit 4e37d0bb1255558ce20e1a5ac83a2d06a37f8b0b | |
1288 | 2383 | * lang/qt/src/keylistjob.h (addMode): New. |
1289 | 2384 | * lang/qt/src/qgpgmekeylistjob.h (addMode): New. |
1290 | 2385 | * lang/qt/src/qgpgmekeylistjob.cpp (addMode: New. |
1291 | 2386 | |
1292 | 2387 | qt: Ensure that current src dir is included first. |
2388 | + commit 5a92cc96da183ebb19867a2a910f53ba41e76ae9 | |
1293 | 2389 | * lang/qt/src/Makefile.am: Reorder include directives. |
1294 | 2390 | |
1295 | 2391 | cpp: Add WithTofu Keylist Mode. |
2392 | + commit f311b92ceaedb12c9e00a722b6b47bbe6b50871e | |
1296 | 2393 | * lang/cpp/src/context.cpp: Handle WithTofu. |
1297 | 2394 | * lang/cpp/src/global.h (KeyListMode): Add WithTofu. |
1298 | 2395 | * lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t): Handle WithTofu. |
1299 | 2396 | |
1300 | 2397 | qt: Fix tofuinfo test when gpg is gpg2. |
2398 | + commit 053e6e0a7b8ea38ad9d4160c84814867bbb9fcf6 | |
1301 | 2399 | * lang/qt/tests/t-support.cpp (QGpgMETest::copyKeyrings): New helper. |
1302 | 2400 | * lang/qt/tests/t-support.h: Declare. |
1303 | 2401 | * lang/qt/tests/t-encrypt.cpp: use it |
1304 | 2402 | * lang/qt/tests/t-tofuinbo.cpp: ditto. |
1305 | 2403 | |
1306 | 2404 | qt: Remove unused variable in test. |
2405 | + commit f08904b810d77d87c66d9c7875c4e7f2bde5dd92 | |
1307 | 2406 | * t-wkspublish.cpp (testWKSPublishCreate): Remove context. |
1308 | 2407 | |
1309 | 2408 | qt: Add test for wkspublishjob. |
2409 | + commit df04b232b8897f030534f8c3fbc87064edf8ae7d | |
1310 | 2410 | * lang/qt/tests/t-wkspublish.cpp: New. |
1311 | 2411 | * lang/qt/tests/Makefile.am: Update accordingly. |
1312 | 2412 | |
1313 | 2413 | qt: Add WKSPublishJob. |
2414 | + commit 94420b05775122b25885c66ac67f77c59d01644d | |
1314 | 2415 | * lang/qt/src/Makefile.am: Add new files. |
1315 | 2416 | * lang/qt/src/job.cpp: Include moc / subclass stub. |
1316 | 2417 | * lang/qt/src/protocol.h: Add virtual for new job. |
1320 | 2421 | lang/qt/src/qgpgmewkspublishjob.h: New. |
1321 | 2422 | |
1322 | 2423 | Cpp: Change firstSeen / lastSeen return values. |
2424 | + commit de7b67f9b2e6bd43a036fa0bcc6a8ca4f5b10986 | |
1323 | 2425 | * lang/cpp/src/tofuinfo.cpp, |
1324 | 2426 | lang/cpp/src/tofuinfo.h (TofuInfo::firstSeen, TofuInfo::lastSeen): |
1325 | 2427 | Change return values to unsigned long and update doc. |
1326 | 2428 | |
1327 | 2429 | Cpp: Add wrapper for gpgme_get_dirinfo. |
2430 | + commit abcd9a283ee8f81870622c8e1dbdc7aad38c0358 | |
1328 | 2431 | * lang/cpp/src/context.cpp (dirInfo): New. |
1329 | 2432 | * lang/cpp/src/global.h (dirInfo): New. |
1330 | 2433 | |
1331 | 2434 | Cpp: Add support for spawn engine. |
2435 | + commit ece8b02a839d6fc566fea7b6e59fabff164f6cf5 | |
1332 | 2436 | * lang/cpp/src/context.cpp (Context::spawn, Context::spawnAsync): New. |
1333 | 2437 | * lang/cpp/src/context.h: Add prototypes. |
1334 | 2438 | (SpawnFlags): New. |
1337 | 2441 | 2016-08-25 Werner Koch <wk@gnupg.org> |
1338 | 2442 | |
1339 | 2443 | core: Add GPGME_KEYLIST_MODE_WITH_TOFU. |
2444 | + commit 9ee103957e4136337b92d238283f8ef30fd4a7c5 | |
1340 | 2445 | * src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_TOFU): New. |
1341 | 2446 | * src/engine-gpg.c (gpg_keylist_build_options): Use that. |
1342 | 2447 | * src/keylist.c: Include limits.h. |
1352 | 2457 | 2016-08-24 Werner Koch <wk@gnupg.org> |
1353 | 2458 | |
1354 | 2459 | core: Adjust for TOFU_STATS change in gnupg 2.1.16. |
2460 | + commit 38798fee5b539d6153a8a7856152959412ee59b5 | |
1355 | 2461 | * src/gpgme.h.in (_gpgme_tofu_info): Change 'firstseen' and 'lastseen' |
1356 | 2462 | to a timestamp value. |
1357 | 2463 | * src/verify.c (parse_tofu_stats): Do not cap these values at UINT_MAX. |
1358 | 2464 | |
1359 | 2465 | core: Set the 'encrcount' field in gpgme_tofu_info_t. |
2466 | + commit 1eefc2d43c0adb2ce516f8e3509ace2fb562e401 | |
1360 | 2467 | * src/verify.c (parse_tofu_stats): Set ENCRCOUNT field. |
1361 | 2468 | |
1362 | 2469 | cpp: Get rid of AssuanResult due to its deprecation. |
2470 | + commit e20b0f0201543834f15c5d50cd3b2ece69a35d70 | |
1363 | 2471 | * lang/cpp/src/assuanresult.cpp: Remove. |
1364 | 2472 | * lang/cpp/src/assuanresult.h: Remove. |
1365 | 2473 | * lang/cpp/src/Makefile.am: Remove these files. |
1373 | 2481 | 2016-08-24 Andre Heinecke <aheinecke@intevation.de> |
1374 | 2482 | |
1375 | 2483 | Qt: Adapt (disabled) tofuinfo test to new API. |
2484 | + commit d2e40fb7adf667f3e2d2457ee4c646ea4d4d88b3 | |
1376 | 2485 | * lang/qt/tests/t-tofuinfo.cpp: Switch to UID based API. |
1377 | 2486 | |
1378 | 2487 | Cpp: Add Key to signature. |
2488 | + commit 7c5a4974b71c30e824cbfcb3a0a70064e5ed5adb | |
1379 | 2489 | * lang/cpp/src/verificationresult.cpp, |
1380 | 2490 | lang/cpp/src/verificationresult.h (Signature::key): New. |
1381 | 2491 | |
1382 | 2492 | Cpp: Use fpr field for primaryFingerprint. |
2493 | + commit 40ea1c85773cbe324557c34b3a4282f609fcdaf6 | |
1383 | 2494 | * lang/cpp/src/key.cpp (Key::primaryFingerprint): Return |
1384 | 2495 | fpr value if available. |
1385 | 2496 | |
1386 | 2497 | 2016-08-23 Andre Heinecke <aheinecke@intevation.de> |
1387 | 2498 | |
1388 | 2499 | Cpp: Move tofuinfo from signature to userid. |
2500 | + commit 799b168243e6499ac01bf59e0656547f353a2589 | |
1389 | 2501 | * lang/cpp/src/key.cpp (UserID::tofuInfo): New. |
1390 | 2502 | * lang/cpp/src/key.h: Update accordingly. |
1391 | 2503 | * lang/cpp/src/tofuinfo.cpp: Remove dropped fields. |
1397 | 2509 | 2016-08-23 Werner Koch <wk@gnupg.org> |
1398 | 2510 | |
1399 | 2511 | core: Put the protocol into a TOFU created key object. |
2512 | + commit 2972c44bd7e97b2169dea9c4a49d9754afdae3f0 | |
1400 | 2513 | * src/verify.c (parse_tofu_user): Add arg 'protocol' and store it in |
1401 | 2514 | the KEY. |
1402 | 2515 | (_gpgme_verify_status_handler): Pass protocol. |
1403 | 2516 | |
1404 | 2517 | core: Change the way TOFU information are represented. |
2518 | + commit be4ff75d7d5ac6ed15feb245ef3cec59b4bad561 | |
1405 | 2519 | * src/gpgme.h.in (struct _gpgme_signature): Remove field 'tofu'. Add |
1406 | 2520 | field 'key'. |
1407 | 2521 | (struct _gpgme_key): Add field 'fpr'. |
1419 | 2533 | * tests/run-keylist.c (main): Print more fields. |
1420 | 2534 | |
1421 | 2535 | core: Extend gpgme_user_id_t with 'address'. |
2536 | + commit 3955dce06e9d056599e5ec7d40301e66b9305195 | |
1422 | 2537 | * src/mbox-util.c, src/mbox-util.h: Adjust for use in gpgme. |
1423 | 2538 | * src/Makefile.am (main_sources): Add mbox-util. |
1424 | 2539 | * src/key.c (_gpgme_key_append_name): Set 'address' field of uid. |
1427 | 2542 | 2016-08-22 Werner Koch <wk@gnupg.org> |
1428 | 2543 | |
1429 | 2544 | core: New code for parsing mail addresses. |
2545 | + commit 26c5ba528ce1411d96655952ec48359105695c0f | |
1430 | 2546 | * src/mbox-util.c: New. |
1431 | 2547 | * src/mbox-util.h: New. |
1432 | 2548 | |
1433 | 2549 | core: Add new items for gpgme_get_dirinfo. |
2550 | + commit 24e61984c9532924135c57b8ff98489a2d3bd4a3 | |
1434 | 2551 | * src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New. |
1435 | 2552 | (WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New |
1436 | 2553 | (WANT_DIRMNGR_SOCKET): New. |
1441 | 2558 | (gpgme_get_dirinfo): Likewise. |
1442 | 2559 | |
1443 | 2560 | core: Base gpgme_get_dirinfo(uiserver-socket) on the socket dir. |
2561 | + commit c9e7dcb100d807583d8e312da459561138231376 | |
1444 | 2562 | * src/dirinfo.c (dirname_len): New. |
1445 | 2563 | (parse_output): Change computation of UISRV_SOCKET. |
1446 | 2564 | |
1447 | 2565 | 2016-08-21 Werner Koch <wk@gnupg.org> |
1448 | 2566 | |
1449 | 2567 | core: New commands --lang and --have-lang for gpgme-config. |
2568 | + commit 3e60788810f93cfcd7f08e5882aff32ed7b6f831 | |
1450 | 2569 | * configure.ac (GPGME_CONFIG_AVAIL_LANG): New ac_subst. |
1451 | 2570 | * src/gpgme-config.in (avail_lang): Add commands --lang and |
1452 | 2571 | --have-lang. |
1454 | 2573 | 2016-08-18 Andre Heinecke <aheinecke@intevation.de> |
1455 | 2574 | |
1456 | 2575 | core: Remove (now) useless diagnostic. |
2576 | + commit 30f156280f18500ee522db58aecd40711c8af685 | |
1457 | 2577 | * src/w32-io.c(_gpgme_io_spawn): Remove spawnhelper not found |
1458 | 2578 | diagnostic. |
1459 | 2579 | |
1460 | 2580 | core: Fail loudly in case w32 spawner not found. |
2581 | + commit 9cf983b0199950c8f8cccee2cb8e45aafcba9fd1 | |
1461 | 2582 | * src/w32-io.c (_gpgme_io_spawn): Show a message box in |
1462 | 2583 | case gpgme-w32spawn.exe not found. |
1463 | 2584 | |
1464 | 2585 | 2016-08-17 Andre Heinecke <aheinecke@intevation.de> |
1465 | 2586 | |
1466 | 2587 | Cpp: Fix some pedantic warnings. |
2588 | + commit 64194b0f8df1afe6135cd119fd3216fc8db68033 | |
1467 | 2589 | * lang/cpp/src/context.cpp, |
1468 | 2590 | lang/cpp/src/context.h (Context::getKeysFromRecipients): Remove |
1469 | 2591 | ignored / invalid const qualifier. |
1472 | 2594 | 2016-08-16 Werner Koch <wk@gnupg.org> |
1473 | 2595 | |
1474 | 2596 | core: New global flag "require-gnupg". |
2597 | + commit 8c09dd9989bcd434a8cb5997770cb8414b96bd5c | |
1475 | 2598 | * src/gpgme.c (gpgme_set_global_flag): Add flag. |
1476 | 2599 | * src/engine.c (engine_minimal_version): New variable. |
1477 | 2600 | (_gpgme_set_engine_minimal_version): New function. |
1480 | 2603 | * tests/run-keylist.c (main): New option --require-gnupg. |
1481 | 2604 | |
1482 | 2605 | core: Simplify setting of dummy versions. |
2606 | + commit b7b0e7b5bfefd51c8092ea54f262b18aebf78128 | |
1483 | 2607 | * src/engine.c (_gpgme_engine_info_release): Do not assert but free |
1484 | 2608 | FILE_NAME. |
1485 | 2609 | (gpgme_get_engine_info): Provide default for VERSION and REQ_VERSION. |
1495 | 2619 | 2016-08-12 Andre Heinecke <aheinecke@intevation.de> |
1496 | 2620 | |
1497 | 2621 | Qt: Add test for progress signal of encryptjob. |
2622 | + commit 391e55411cda11446ca9de4dd0dc2b54d3e6fff5 | |
1498 | 2623 | * lang/qt/tests/t-encrypt.cpp (testProgress): New. |
1499 | 2624 | |
1500 | 2625 | Cpp: Provide size-hint for seekable and mem data. |
2626 | + commit df7bbf5a66576a5a320b54c8f6ad52bc84f0e833 | |
1501 | 2627 | * lang/cpp/src/data.cpp (GpgME::Data::Data): Set size-hint for |
1502 | 2628 | mem and DataProvider based Data. |
1503 | 2629 | |
1504 | 2630 | 2016-08-12 Werner Koch <wk@gnupg.org> |
1505 | 2631 | |
1506 | 2632 | core: Make use of the "size-hint" in engine-gpg. |
2633 | + commit fe1e8e71aa18b4ac6471292b2894b8859f42f7c8 | |
1507 | 2634 | * src/engine-gpg.c: Include data.h. |
1508 | 2635 | (add_input_size_hint): New. |
1509 | 2636 | (gpg_decrypt, gpg_encrypt, gpg_encrypt_sign, gpg_sign) |
1515 | 2642 | size for the input data. |
1516 | 2643 | |
1517 | 2644 | core: Add gpgme_data_set_flag to add more meta data to data objects. |
2645 | + commit 293d1736911fd5e77b8cec305168b35b2420c612 | |
1518 | 2646 | * src/gpgme.h.in (gpgme_data_set_flag): New public function. |
1519 | 2647 | * src/data.c (gpgme_data_set_flag): New. |
1520 | 2648 | (_gpgme_data_get_size_hint): New. |
1525 | 2653 | 2016-08-12 Andre Heinecke <aheinecke@intevation.de> |
1526 | 2654 | |
1527 | 2655 | Qt: Fix defaultkeygenerationjob build. |
2656 | + commit 75c974c4e0a31981325f7d151bd13f2523f5df20 | |
1528 | 2657 | * lang/qt/src/defaultkeygenerationjob.cpp: Include moc. |
1529 | 2658 | |
1530 | 2659 | 2016-08-11 Andre Heinecke <aheinecke@intevation.de> |
1531 | 2660 | |
1532 | 2661 | Qt: Add DefaultKeyGenerationJob. |
2662 | + commit 105f5446e69db00291164397cf0d8e68374cf420 | |
1533 | 2663 | * lang/qt/src/defaultkeygenerationjob.cpp, |
1534 | 2664 | lang/qt/src/defaultkeygenerationjob.h: New. |
1535 | 2665 | * lang/qt/src/Makefile.am: Update accordingly. |
1536 | 2666 | |
1537 | 2667 | Qt: Ensure all public classes are exported. |
2668 | + commit 59e2251a083b0ed61b3ab6d47015cef7cc6ceb05 | |
1538 | 2669 | * src/abstractimportjob.h, |
1539 | 2670 | src/cryptoconfig.h, |
1540 | 2671 | src/deletejob.h, |
1550 | 2681 | src/verifydetachedjob.h: Export classes. |
1551 | 2682 | |
1552 | 2683 | Qt: Add KeyForMailboxJob. |
2684 | + commit 8c5abc8d932affab4bc79a85e3f98f6f6b982ae8 | |
1553 | 2685 | * lang/qt/src/job.cpp: Include moc and make subclass. |
1554 | 2686 | * lang/qt/src/keyformailboxjob.h, |
1555 | 2687 | lang/qt/src/qgpgmekeyformailboxjob.cpp, |
1563 | 2695 | 2016-08-10 Werner Koch <wk@gnupg.org> |
1564 | 2696 | |
1565 | 2697 | doc: Get rid of version.texi. |
2698 | + commit b7d99e02188b7907b09fec3032fc1fd82fc2668a | |
1566 | 2699 | * configure.ac (CC_FOR_BUILD): New. |
1567 | 2700 | * doc/mkdefsinc.c: New. Taken from GnuPG and modified for gpgme. |
1568 | 2701 | * doc/Makefile.am (EXTRA_DIST): Add defsincdate and mkdefsinc.c |
1573 | 2706 | * doc/gpgme.texi: Include defs.inc. Remove version.texi. |
1574 | 2707 | |
1575 | 2708 | build: Declare all languages for make dist. |
2709 | + commit 48691db97b759d67aa7b49c36bb704b5806ade2e | |
1576 | 2710 | * lang/Makefile.am (DIST_SUBDIRS): New. |
1577 | 2711 | |
1578 | 2712 | core: Do not identify PNG files as PGP signatures. |
2713 | + commit a9168185ba97aa1d827315cd8017899bf904aded | |
1579 | 2714 | * src/data-identify.c (next_openpgp_packet): Blacklist PNG files. |
1580 | 2715 | |
1581 | 2716 | 2016-08-10 Andre Heinecke <aheinecke@intevation.de> |
1582 | 2717 | |
1583 | 2718 | Cpp: Handle empty recipients consistently. |
2719 | + commit 09667a6006986a782af98ca1de4d6521e1b8f353 | |
1584 | 2720 | * lang/cpp/src/context.cpp (Context::getKeysFromRecipients): |
1585 | 2721 | New helper. |
1586 | 2722 | (Context::encrypt, Context::startEncryption, Context::signAndEncrypt) |
1589 | 2725 | as private helper. |
1590 | 2726 | |
1591 | 2727 | core: Handle ENCRYPT_SYMMETRIC also for sig & enc. |
2728 | + commit b602d8bc7bd726afb52dc60cc07e4609e88d4511 | |
1592 | 2729 | * src/engine-gpg.c (gpg_encrypt_sign): Handle ENCRYPT_SYMMETRIC |
1593 | 2730 | flag. |
1594 | 2731 | |
1595 | 2732 | Qt: Remove unused variable. |
2733 | + commit d467018ce36f5be36751267c3b6079e8c1ee5d8a | |
1596 | 2734 | * lang/qt/src/qgpgmerefreshkeysjob.cpp (slotStatus): Remove |
1597 | 2735 | unused variable typ. |
1598 | 2736 | |
1599 | 2737 | Qt: Create TestPassphraseProvider on stack. |
2738 | + commit a27d7755d071aad42efc2aa4ea3899ba7b17f8bf | |
1600 | 2739 | * lang/qt/tests/t-encrypt.cpp, lang/qt/tests/t-tofuinfo.cpp: Create |
1601 | 2740 | TestPassphraseProvider on stack. |
1602 | 2741 | |
1603 | 2742 | Cpp: Clarify ownership of provider classes. |
2743 | + commit 21d5e71d486da8e37cf53f2b968646b39a6daa72 | |
1604 | 2744 | * lang/cpp/src/context.h: Note that the context does not take |
1605 | 2745 | ownership of providers. |
1606 | 2746 | |
1607 | 2747 | 2016-08-10 Justus Winter <justus@g10code.com> |
1608 | 2748 | |
1609 | 2749 | tests: Fix memory leak. |
2750 | + commit 04f994d5db6db0575dc73c2356c7d51424e2d9fe | |
1610 | 2751 | * tests/gpg/t-encrypt-mixed.c (main): Free 'text2'. |
1611 | 2752 | |
1612 | 2753 | 2016-08-10 Andre Heinecke <aheinecke@intevation.de> |
1613 | 2754 | |
1614 | 2755 | core: Ensure err is initalized in gpg_encrypt. |
2756 | + commit 270887309f4b673b13e58c29ea3989c56989590e | |
1615 | 2757 | * src/engine-gpg.c (gpg_encrypt): Initialize err. |
1616 | 2758 | |
1617 | 2759 | Qt: Fix t-keylist moc include. |
2760 | + commit 0c222e1b3cabe1a8b84a2877420cdd5df56171b5 | |
1618 | 2761 | * lang/qt/tests/t-keylist.cpp: Don't include t-support.moc |
1619 | 2762 | |
1620 | 2763 | 2016-08-09 Andre Heinecke <aheinecke@intevation.de> |
1621 | 2764 | |
1622 | 2765 | Qt: Clean up debug output in tests. |
2766 | + commit 969f223d8de21d7c8b0f7646bbf8dbb5864e8d03 | |
1623 | 2767 | * lang/qt/tests/t-support.cpp: Remove accidentally commited |
1624 | 2768 | debug output. |
1625 | 2769 | |
1626 | 2770 | Qt: Add encryption test and refactor testsuite. |
2771 | + commit f209ec8f581ae597b37f2e3a5e452e4b53b2d4c7 | |
1627 | 2772 | * lang/qt/tests/Makefile.am: Add t-encrypt and t-support. |
1628 | 2773 | * lang/qt/tests/t-support.cpp, lang/qt/tests/t-support.c (QGpgMETest): |
1629 | 2774 | New. Class to handle common cleanup / init. |
1635 | 2780 | encryption. Mixed encryption test is disabled. |
1636 | 2781 | |
1637 | 2782 | Qt: Add support for EncryptJobs with generic flags. |
2783 | + commit 34b456c3fb9e59788b07a75441da482bb28bda87 | |
1638 | 2784 | * lang/qt/src/encryptjob.h, lang/qt/src/signencryptjob.h, |
1639 | 2785 | lang/qt/src/qgpgmeencryptjob.h, lang/qt/src/qgpgmeencryptjob.cpp, |
1640 | 2786 | lang/qt/src/qgpgmesignencryptjob.cpp, |
1642 | 2788 | that accept generic EncryptFlags. |
1643 | 2789 | |
1644 | 2790 | Cpp: Add support for all EncryptionFlags. |
2791 | + commit 17372393798ea5e2d6838f3dd1e001dd4a66c941 | |
1645 | 2792 | * lang/cpp/src/context.h (EncryptionFlags): Extend. |
1646 | 2793 | * lang/cpp/src/context.cpp (encryptflags2encryptflags): Ditto. |
1647 | 2794 | |
1648 | 2795 | Cpp: Fix simple symmetric encryption. |
2796 | + commit bf776ce94cf454f1b3f1645b1cde09cd1c54324b | |
1649 | 2797 | * lang/cpp/src/context.cpp (Context::encrypt): If no recipients |
1650 | 2798 | are provided encrypt with NULL and not an empty array. |
1651 | 2799 | |
1652 | 2800 | core: Add support for mixed symmetric and asym enc. |
2801 | + commit 3d2f027d0f40e7ec4ab48cee89ff0ee10b423566 | |
1653 | 2802 | * src/gpgme.h.in (gpgme_encrypt_flags_t): New flag |
1654 | 2803 | GPGME_ENCRYPT_SYMMETRIC. |
1655 | 2804 | * src/engine-gpg.c (gpg_encrypt): Also add --symmetric if the flag |
1666 | 2815 | 2016-08-08 Werner Koch <wk@gnupg.org> |
1667 | 2816 | |
1668 | 2817 | core: Let GPGME_PROTOCOL_ASSUAN pass Assuan comments through. |
2818 | + commit b5e16b036f0045524a583d8a366d8a3366fc0005 | |
1669 | 2819 | * src/engine-assuan.c (llass_new): Set ASSUAN_CONVEY_COMMENTS, |
1670 | 2820 | |
1671 | 2821 | 2016-08-08 Andre Heinecke <aheinecke@intevation.de> |
1672 | 2822 | |
1673 | 2823 | Prepend LD_LIBRARY_PATH for python tests. |
2824 | + commit ab6f66d676581cb497e581e4af40e2fe5bff507b | |
1674 | 2825 | * lang/python/tests/Makefile.am (TESTS_ENVIRONMENT): Prepend path |
1675 | 2826 | instead of setting the value. |
1676 | 2827 | |
1677 | 2828 | 2016-08-05 Justus Winter <justus@g10code.com> |
1678 | 2829 | |
1679 | 2830 | python: Clean up and modernize examples. |
2831 | + commit 2a613e87156b23c4aa6aa5ce38505cb285de6a18 | |
1680 | 2832 | * lang/python/examples/Examples.rst: Delete file. |
1681 | 2833 | * lang/python/examples/t-edit.py: Likewise. This is actually a test |
1682 | 2834 | case and has been moved to 'tests'. |
1696 | 2848 | 2016-08-04 Werner Koch <wk@gnupg.org> |
1697 | 2849 | |
1698 | 2850 | core: Extend gpgme_subkey_t to carry the keygrip. |
2851 | + commit 6f3dc66634e30d86aa6250c4ac22f9b8f7ec1be9 | |
1699 | 2852 | * src/gpgme.h.in (struct _gpgme_subkey): Add file 'keygrip'. |
1700 | 2853 | * src/key.c (gpgme_key_unref): Free KEYGRIP. |
1701 | 2854 | * src/keylist.c (keylist_colon_handler): Parse GRP records. |
1707 | 2860 | 2016-08-03 Justus Winter <justus@g10code.com> |
1708 | 2861 | |
1709 | 2862 | python: Add a nicer interface to list keys. |
2863 | + commit 56e26b54da9f16961209275d7a61883d3ea898ca | |
1710 | 2864 | * lang/python/pyme/core.py (Context.keylist): New method. |
1711 | 2865 | * lang/python/tests/t-keylist.py: Test new method. |
1712 | 2866 | |
1713 | 2867 | 2016-08-02 Justus Winter <justus@g10code.com> |
1714 | 2868 | |
1715 | 2869 | python: Add a flag identifying in-tree builds. |
2870 | + commit 4c8265d32ddff5960a464b8d4e8d7d2258495b2e | |
1716 | 2871 | * lang/python/helpers.c (pyme_in_tree_build): New variable. |
1717 | 2872 | * lang/python/helpers.h (pyme_in_tree_build): New declaration. |
1718 | 2873 | * lang/python/pyme/version.py.in (in_tree_build): New variable. |
1720 | 2875 | as appropriate. |
1721 | 2876 | |
1722 | 2877 | python: Fix build system integration. |
2878 | + commit 0bd7d8c1977183abc414e11aafa26a4f834ca2a5 | |
1723 | 2879 | * lang/python/Makefile.am: Be more careful when cleaning the build |
1724 | 2880 | directory, we must not delete the generated file 'pyme/version.py'. |
1725 | 2881 | |
1726 | 2882 | doc: Document the Assuan protocol. |
2883 | + commit 135185b7ef2225aa5e8c54a6cf1265d3e6cbbe48 | |
1727 | 2884 | * doc/gpgme.texi: Document the Assuan protocol. |
1728 | 2885 | |
1729 | GnuPG-bug-id: 2407 | |
1730 | ||
1731 | 2886 | 2016-07-28 Justus Winter <justus@g10code.com> |
1732 | 2887 | |
1733 | 2888 | python: Fix out-of-tree build. |
2889 | + commit 4e728de8421e2ade2061786aaebcdae3f60da3b8 | |
1734 | 2890 | * lang/python/MANIFEST.in: Add 'private.h'. |
1735 | 2891 | |
1736 | Fixes-commit: 3d4dc3f0 | |
1737 | ||
1738 | 2892 | python: Improve error handling. |
2893 | + commit 5a7c7a86f7e8eaf10e37138617a2d838f9d4466f | |
1739 | 2894 | * lang/python/pyme/core.py (Context.protocol): Check that the engine |
1740 | 2895 | is usable before setting the protocol. |
1741 | 2896 | (Context._errorcheck): Add missing functions. |
1742 | 2897 | |
1743 | 2898 | src: Fix dummy engine versions. |
2899 | + commit b9e6eacd06ffeb36854c208aa4325cff3e3dfbbe | |
1744 | 2900 | Previously, 'gpgme_engine_check_version' failed for these protocols |
1745 | 2901 | because the version parser failed to parse the dummy versions. |
1746 | 2902 | |
1753 | 2909 | (uiserver_get_req_version): Likewise. |
1754 | 2910 | |
1755 | 2911 | python: Drop superfluous imports and trim public interface. |
2912 | + commit 2ff58fcbd5c060dac3a7feec478819d2c5a164ec | |
1756 | 2913 | * lang/python/pyme/__init__.py: Avoid leaking low-level 'gpgme', make |
1757 | 2914 | sure the main module looks nice and tidy, appease pyflakes. |
1758 | 2915 | * lang/python/pyme/errors.py: Appease pyflakes. |
1765 | 2922 | * lang/python/tests/t-signers.py: Likewise. |
1766 | 2923 | |
1767 | 2924 | python: Rename compiled SWIG module. |
2925 | + commit 2f754440f28e8f81babdf7efa6186edbc8ad99fd | |
1768 | 2926 | Avoid the name pygpgme, as this is the name of another popular Python |
1769 | 2927 | binding for GPGME. |
1770 | 2928 | |
1779 | 2937 | * lang/python/setup.py.in: Likewise. |
1780 | 2938 | |
1781 | 2939 | python: Rename exported functions. |
2940 | + commit b5aa05c3b261c3846ebbcf76e7505cff5459f918 | |
1782 | 2941 | Avoid the name pygpgme, as this is the name of another popular Python |
1783 | 2942 | binding for GPGME. |
1784 | 2943 | |
1790 | 2949 | * lang/python/pyme/core.py: Likewise. |
1791 | 2950 | |
1792 | 2951 | python: Rename private functions. |
2952 | + commit 1d2f22aae668ce136cacd254875e118dc1faa6a2 | |
1793 | 2953 | Avoid the name pygpgme, as this is the name of another popular Python |
1794 | 2954 | binding for GPGME. |
1795 | 2955 | |
1803 | 2963 | prototypes here. |
1804 | 2964 | |
1805 | 2965 | python: Support the Assuan engine. |
2966 | + commit de69fa496c09386d5e99747670d6887cf52dd09e | |
1806 | 2967 | * lang/python/gpgme.i: Add typemaps for the Assuan protocol callbacks. |
1807 | 2968 | * lang/python/helpers.c (_pyme_assuan_{data,inquire,status}_cb): New |
1808 | 2969 | functions. |
1814 | 2975 | * lang/python/tests/t-protocol-assuan.py: New file. |
1815 | 2976 | |
1816 | 2977 | python: Improve engine information handling. |
2978 | + commit 355d7072863ac1f0f725e77141a59f3ed8a5e4af | |
1817 | 2979 | * lang/python/gpgme.i (gpgme_engine_info_t): Wrap engine infos. |
1818 | 2980 | * lang/python/pyme/core.py (Context.engine_info): New property. |
1819 | 2981 | (Context.{g,s}et_engine_info): Improve docstrings. |
1820 | 2982 | * lang/python/pyme/results.py (EngineInfo): New class. |
1821 | 2983 | |
1822 | 2984 | python: Add accessors for the protocol. |
2985 | + commit 78f7bf4dcf75206faae5776c2ee4166628313532 | |
1823 | 2986 | * lang/python/pyme/core.py (Context.__init__): Add 'protocol' |
1824 | 2987 | parameter. |
1825 | 2988 | (Context.protocol): New accessors. |
1826 | 2989 | |
1827 | 2990 | python: Expose less functions to the Python world. |
2991 | + commit 3d4dc3f0218234a27103bdb6f93b17c0703b71a2 | |
1828 | 2992 | * lang/python/Makefile.am (EXTRA_DIST, COPY_FILES): Add new file. |
1829 | 2993 | * lang/python/gpgme.i: Include new file and add comments. |
1830 | 2994 | * lang/python/helpers.c: Include new file. |
1834 | 2998 | 2016-07-19 Ben Kibbey <bjk@luxsci.net> |
1835 | 2999 | |
1836 | 3000 | Fix including nil bytes in keylist output. |
3001 | + commit 6a7ee33abd5059f5ae2f70a7dd9f610c16552f8e | |
1837 | 3002 | * src/gpgme-tool.c (cmd_keylist,gt_result): use strlen(). |
1838 | 3003 | |
1839 | 3004 | 2016-07-15 Justus Winter <justus@g10code.com> |
1840 | 3005 | |
1841 | 3006 | python: Make GPGME's version easily accessible. |
3007 | + commit e545ca3f682b615ce447c186a2c73489a32b0592 | |
1842 | 3008 | * lang/python/pyme/version.py.in (gpgme_versionstr): New variable. |
1843 | 3009 | |
1844 | 3010 | python: Add an idiomatic interface. |
3011 | + commit 1f318b7aaaa77672fab117d54fe75221780df83c | |
1845 | 3012 | * configure.ac: Bump required Python version. |
1846 | 3013 | * lang/python/pyme/__init__.py: Update docstring. Import Context and |
1847 | 3014 | Data. |
1876 | 3043 | 2016-07-14 Andre Heinecke <aheinecke@intevation.de> |
1877 | 3044 | |
1878 | 3045 | Qt: Disable keylocate test for gnupg < 2.0.10. |
3046 | + commit d2f2cbd297c4d2f2c3264ecc3ffb7a2b3a70bd55 | |
1879 | 3047 | * lang/qt/tests/t-keylocate.cpp: Disable test for gnupg < 2.0.10 |
1880 | 3048 | |
1881 | 3049 | Cpp: Add EngineInfo::Version class. |
3050 | + commit 41de1ab904eaddffb2de17b1de8ef41e462daabe | |
1882 | 3051 | * lang/cpp/src/engineinfo.cpp (EngineInfo::engineVersion): New. |
1883 | 3052 | * lang/cpp/src/engineinfo.h (EngineInfo::engineVersion): Declare. |
1884 | 3053 | (EngineInfo::Version): Small helper to work with versions. |
1885 | 3054 | |
1886 | 3055 | Qt: Fix usage of ignore-invalid-option in tests. |
3056 | + commit e7f4c364732660c6cda25720b7dbc5b1c917e368 | |
1887 | 3057 | * Makefile.am (pubring-stamp): Fix config. |
1888 | 3058 | |
1889 | 3059 | Qt: Fix tests if gpg2 is gpg. |
3060 | + commit e4c0645c1eea9380d80a20895eb83c9dd7228776 | |
1890 | 3061 | * lang/qt/tests/Makefile.am (pubring-stamp): Loopback and provide |
1891 | 3062 | passphrase on command line when importing. |
1892 | 3063 | |
1893 | 3064 | 2016-07-14 Justus Winter <justus@g10code.com> |
1894 | 3065 | |
1895 | 3066 | python: Fix test. |
3067 | + commit fddcc62abd57cb04e84861abd3991c7d529c2464 | |
1896 | 3068 | * lang/python/tests/t-keylist.py: Do not assume key alpha is trusted |
1897 | 3069 | yet. |
1898 | 3070 | |
1899 | 3071 | 2016-07-13 Werner Koch <wk@gnupg.org> |
1900 | 3072 | |
1901 | 3073 | build: Update config.{guess,sub} to {2016-05-15,2016-06-20}. |
3074 | + commit a9670d152a4598aef1ae0960a79fb6f5d8db55ad | |
1902 | 3075 | * build-aux/config.guess: Update. |
1903 | 3076 | * build-aux/config.sub: Update. |
1904 | 3077 | |
1905 | 3078 | core: New GPGME_DATA_ENCODING_MIME. |
3079 | + commit d8d5f5a16712244fe6eff860b6ac5f007b1bf870 | |
1906 | 3080 | * src/gpgme.h.in (GPGME_DATA_ENCODING_MIME): New. |
1907 | 3081 | * src/data.c (gpgme_data_set_encoding): Adjust check. |
1908 | 3082 | * src/engine-gpg.c (have_gpg_version): New. |
1915 | 3089 | * src/gpgme-tool.c (server_data_encoding): Add flag --mime. |
1916 | 3090 | |
1917 | 3091 | core: Pass the engine's version string to the engine's new function. |
3092 | + commit 2095b1573a8196ba3efdf817324d1b3ee05cbb93 | |
1918 | 3093 | * src/engine-backend.h (engine_ops): Add arg 'version' to NEW. |
1919 | 3094 | * src/engine-assuan.c (llass_new): Add dummy arg 'version'. |
1920 | 3095 | * src/engine-g13.c (g13_new): Ditto. |
1931 | 3106 | 2016-07-13 Andre Heinecke <aheinecke@intevation.de> |
1932 | 3107 | |
1933 | 3108 | Cpp: Add feature enum for new identify. |
3109 | + commit 537cb871fd59f3a20c697a046715e6339ff6633b | |
1934 | 3110 | * lang/cpp/src/context.cpp (supported_features2): Add |
1935 | 3111 | BinaryAndFineGrainedIdentify |
1936 | 3112 | * lang/cpp/src/global.h (Feature2): ditto. |
1938 | 3114 | 2016-07-12 Justus Winter <justus@g10code.com> |
1939 | 3115 | |
1940 | 3116 | python: Port more tests. |
3117 | + commit 1bff47ee58bcf9d0016fb7ac7e37cbf075abd059 | |
1941 | 3118 | * lang/python/pyme/core.py (Context.op_keylist_all): Add missing |
1942 | 3119 | 'op_keylist_end'. |
1943 | 3120 | (Context.op_trustlist_all): Fix function. Add missing |
1948 | 3125 | * lang/python/tests/t-trustlist.py: Check alternate interface. |
1949 | 3126 | |
1950 | 3127 | python: Improve python packaging. |
3128 | + commit 57b51685528153f5a50ab0999feec25c83190501 | |
1951 | 3129 | * lang/python/Makefile.am: Sign source releases, and upload them. |
1952 | 3130 | * lang/python/setup.py.in: Add categories. |
1953 | 3131 | |
1954 | 3132 | 2016-07-12 Andre Heinecke <aheinecke@intevation.de> |
1955 | 3133 | |
1956 | 3134 | m4: Don't set fpic for qt on windows. |
3135 | + commit 938f7e9c8b466594d05c0347fe627b225263a6a6 | |
1957 | 3136 | * m4/qt.m4 (FIND_QT): Do not set fpic for windows. |
1958 | 3137 | |
1959 | 3138 | m4: Use LIBS instead of LDFLAGS for Qt libs. |
3139 | + commit 744978cce8f9dfb2363b9d274ee99f25cfcf0e40 | |
1960 | 3140 | * m4/qt.m4: Modify LIBS instead of LDFLAGS for link test. |
1961 | 3141 | |
1962 | 3142 | Bump version to 1.7.0. |
3143 | + commit bf742fb88545689addfca18192baf2f56a1895e1 | |
1963 | 3144 | * configure.ac(mym4_version_minor), |
1964 | 3145 | (mym4_version_micro): Next release will be 1.7.0 |
1965 | 3146 | |
1966 | 3147 | Qt: Install CamelCase forward includes. |
3148 | + commit fd87c4679c4bfe19390fa2047dff23bb213a4b18 | |
1967 | 3149 | * lang/qt/src/Makefile.am (camelcase_headers): New. Create and install |
1968 | 3150 | CamelCase headers. |
1969 | 3151 | |
1970 | 3152 | Qt: Export VerifyDetachedJob. |
3153 | + commit 86ab2ee2d603111d24500b8d64a9a1dd82f8bdc0 | |
1971 | 3154 | * lang/qt/src/verifydetachedjob.h (VerifyDetachedJob): Export it. |
1972 | 3155 | |
1973 | 3156 | Qt/Cpp: Add version headers. |
3157 | + commit b03c48cfb06faae7d7033a0532f319cbcf13f18a | |
1974 | 3158 | * lang/cpp/src/gpgmepp_version.h.in, |
1975 | 3159 | lang/qt/src/qgpgme_version.h.in: New. Version information. |
1976 | 3160 | * lang/qt/src/Makefile.am, lang/cpp/src/Makefile.am: Add them. |
1977 | 3161 | * configure.ac: Configure them. |
1978 | 3162 | |
1979 | 3163 | Qt/Cpp: Add license blurb to export headers. |
3164 | + commit 362b8cdf4e0d5cd54ec2b325508dcdefac686f2c | |
1980 | 3165 | * lang/cpp/src/gpgmepp_export.h, |
1981 | 3166 | lang/qt/src/qgpgme_export.h: Add license blurb. |
1982 | 3167 | |
1983 | 3168 | 2016-07-11 Justus Winter <justus@g10code.com> |
1984 | 3169 | |
1985 | 3170 | python: Fix distcheck. |
3171 | + commit ce662891373eba6cce1cf8df516cb2370970737e | |
1986 | 3172 | * lang/python/Makefile.am (EXTRA_DIST): Add missing files. |
1987 | 3173 | |
1988 | 3174 | 2016-07-11 Andre Heinecke <aheinecke@intevation.de> |
1989 | 3175 | |
1990 | 3176 | m4: Add compile / link check for qt. |
3177 | + commit ed070313155a1c79a57ba69f4299f2aefc65fad7 | |
1991 | 3178 | * m4/qt.m4 (FIND_QT): Check if a qt application can be compiled and |
1992 | 3179 | linked. |
1993 | 3180 | |
1994 | 3181 | 2016-07-11 Justus Winter <justus@g10code.com> |
1995 | 3182 | |
1996 | 3183 | python: Enable out-of-tree build of pyme bindings. |
3184 | + commit 007382ce94a6318557370c440f7d609a030a119e | |
1997 | 3185 | * lang/python/MANIFEST.in: Update manifest template. |
1998 | 3186 | * lang/python/Makefile.am: Copy more files, move generation of files |
1999 | 3187 | to Python build script, add 'sdist' target to build a Python source |
2002 | 3190 | * lang/python/setup.py.in: Generate files, enable out-of-tree builds. |
2003 | 3191 | |
2004 | 3192 | python: Do not depend on access to internal data structures. |
3193 | + commit 98cba522c906115efcba1f8cc0bec7e5edb51ecd | |
2005 | 3194 | * lang/python/gpgme.i (gpgme_data_t): Rework so that it works without |
2006 | 3195 | access to the definition of 'struct gpgme_data'. |
2007 | 3196 | * lang/python/helpers.c (object_to_gpgme_data_t): Add assertion. |
2008 | 3197 | |
2009 | 3198 | python: Make result wrapping backwards compatible. |
3199 | + commit c53f87c5f9ca63119152f41dcebfb175d4df2cef | |
2010 | 3200 | * lang/python/pyme/results.py (Result.__init__): Skip missing fields. |
2011 | 3201 | |
2012 | 3202 | 2016-07-11 Andre Heinecke <aheinecke@intevation.de> |
2013 | 3203 | |
2014 | 3204 | Qt: Fix memleaks in tests. |
3205 | + commit bfa8ac7e02c16790ee5bd3b42c26699f4821d72e | |
2015 | 3206 | * lang/qt/tests/t-keylist.cpp(cleanupTestCase): Ensure that |
2016 | 3207 | posted events are handled for autodeletion. |
2017 | 3208 | (testSingleKeylistSync): delete job. |
2021 | 3212 | * lang/qt/tests/t-keylocate.cpp(cleanupTestCase): Ditto |
2022 | 3213 | |
2023 | 3214 | Qt: Add some general Protocol documentation. |
3215 | + commit b1f42e8f25ada220ec8e4762cfebc3a49b1f7d56 | |
2024 | 3216 | * lang/qt/src/protocol.h (Protocol): Add doc. |
2025 | 3217 | |
2026 | 3218 | Qt: Disable t-tofuinfo tests. |
3219 | + commit 02babb29612d554c37b63a49f78acc45653b557e | |
2027 | 3220 | * lang/qt/tests/t-tofuinfo.cpp: Disable tests. |
2028 | 3221 | |
2029 | 3222 | 2016-07-08 Justus Winter <justus@g10code.com> |
2030 | 3223 | |
2031 | 3224 | src: Fix error handling. |
3225 | + commit de74fe59feef9adc858ac04004880bfd44315d0d | |
2032 | 3226 | * src/encrypt.c (encrypt_status_handler): Fix error handling, || |
2033 | 3227 | conflates errors. |
2034 | 3228 | |
2035 | 3229 | python: Fix raising stashed exceptions. |
3230 | + commit 8a93f345b701332270c9829a4d0a93537f98a8d8 | |
2036 | 3231 | Fixes an issue with newer versions of Python. |
2037 | 3232 | |
2038 | 3233 | * lang/python/helpers.c (pygpgme_raise_callback_exception): Be more |
2041 | 3236 | 2016-07-07 Justus Winter <justus@g10code.com> |
2042 | 3237 | |
2043 | 3238 | python: Fix distcheck. |
3239 | + commit 52efcf1ee9fc8ba4c6bd23d8fe4f5f7993ba9fb1 | |
2044 | 3240 | * lang/python/INSTALL: Drop obsolete file. |
2045 | 3241 | * lang/python/Makefile.am (EXTRA_DIST): Add missing files. |
2046 | 3242 | (CLEANFILES): Remove generated files. |
2052 | 3248 | * lang/python/tests/initial.py: Likewise. |
2053 | 3249 | |
2054 | 3250 | qt: Fix distcheck. |
3251 | + commit 38c408560c6ebc3ea5eeeade01d38750bf5799e5 | |
2055 | 3252 | * lang/qt/src/Makefile.am (qgpgme_headers): Add missing file. |
2056 | 3253 | (CLEANFILES): Add generated file. |
2057 | 3254 | * lang/qt/tests/Makefile.am (clean-local): Remove private keys. |
2058 | 3255 | |
2059 | 3256 | cpp: Fix distcheck. |
3257 | + commit 49286ac1c82c480e2c718f828c57da9778ccd0b9 | |
2060 | 3258 | * lang/cpp/src/Makefile.am (CLEANFILES): Remove generated file. |
2061 | 3259 | |
2062 | 3260 | 2016-07-06 Andre Heinecke <aheinecke@intevation.de> |
2063 | 3261 | |
2064 | 3262 | Qt: Add test for publicKeyAlgorithmAsString. |
3263 | + commit fc0267233239b42e9fb74a8acd7511503e287a9e | |
2065 | 3264 | * lang/qt/tests/t-keylist.cpp (testPubkeyAlgoAsString): New. |
2066 | 3265 | |
2067 | 3266 | Cpp: Expose gpgme_pubkey_algo_name. |
3267 | + commit e41ae4db9e70d9aebf80ebbd4ce03977435c2ccf | |
2068 | 3268 | * lang/cpp/src/key.cpp (Subkey::publicKeyAlgorithmAsString): New |
2069 | 3269 | static variant. |
2070 | 3270 | * lang/cpp/src/key.h: Declare function. Clarify comment about name |
2071 | 3271 | mismatch. |
2072 | 3272 | |
2073 | 3273 | Qt: Add check for pubkeyAlgo in t-keylist. |
3274 | + commit 9f93346d21271b916f15d80420669f5d659a40de | |
2074 | 3275 | * lang/qt/tests/t-keylist.cpp (testSingleKeyListSync): Check |
2075 | 3276 | pubkeyAlgo. |
2076 | 3277 | |
2077 | 3278 | Cpp: Add PubkeyAlgo enum. |
3279 | + commit c28007d0407bcc3621b8266d6d77eb0d069aec35 | |
2078 | 3280 | * lang/cpp/src/key.h (Subkey::PubkeyAlgo): New enum. |
2079 | 3281 | (Subkey::publicKeyAlgorithm): Change return type. |
2080 | 3282 | * lang/cpp/src/key.cpp (Subkey::publicKeyAlgorithm): Use enum. |
2081 | 3283 | |
2082 | 3284 | Qt: Fix include order when buildin test. |
3285 | + commit 4934893e27a50f5715dcd4d2907ecbe629921b32 | |
2083 | 3286 | * lang/qt/tests/Makefile.am (AM_CPPFLAGS): Include cpp before |
2084 | 3287 | gpgme src directory. |
2085 | 3288 | |
2086 | 3289 | Revert "Qt: More robust lookup of Cpp's context.h" |
3290 | + commit 7a8c04f66d382dc49d962ad18c46d7ad332ccc0f | |
2087 | 3291 | * lang/qt/src/threadedjobmixin.h: Revert using full path |
2088 | 3292 | for context.h |
2089 | 3293 | |
2090 | 3294 | 2016-07-05 Andre Heinecke <aheinecke@intevation.de> |
2091 | 3295 | |
2092 | 3296 | Qt: Fix test build with Qt < 5.4.0. |
3297 | + commit 49a6ee50587c9d4b6f07e60ce1a939c863e7f15c | |
2093 | 3298 | * lang/qt/tests/t-keylist.cpp, |
2094 | 3299 | lang/qt/tests/t-keylocate.cpp, |
2095 | 3300 | lang/qt/tests/t-ownertrust.cpp: Use old style SIGNAl syntax for |
2096 | 3301 | QSignalSpy |
2097 | 3302 | |
2098 | 3303 | Qt: More robust lookup of Cpp's context.h. |
3304 | + commit 47bfbc9026b49b9918359af5fcc1621aab0d1065 | |
2099 | 3305 | * lang/qt/src/threadedjobmixin.h: When building qgpgme look for |
2100 | 3306 | context.h in the full cpp subdirectory. |
2101 | 3307 | |
2102 | 3308 | w32: Fallback to 2.1 reg key for gpgconf search. |
3309 | + commit 72b83ffc4d7581f4efef3bd7c261d7d7424bcf0e | |
2103 | 3310 | * src/w32-util.c (_gpgme_get_gpgconf_path): Fallback to 2.1 installer |
2104 | 3311 | registry key. |
2105 | 3312 | |
2106 | 3313 | 2016-07-04 Andre Heinecke <aheinecke@intevation.de> |
2107 | 3314 | |
2108 | 3315 | Doc: Document pinentry mode. |
3316 | + commit 329ab93f7ed862d7f4c0501fca5355936a74ac52 | |
2109 | 3317 | * doc/gpgme.texi (Passphrase Callback): Document as context |
2110 | 3318 | attribute. |
2111 | 3319 | (gpgme_set_passphrase_cb): Note that this requires LOOPBACK mode |
2112 | 3320 | with GnuPG 2.1. |
2113 | 3321 | |
2114 | 3322 | Qt: Add testTofuSignCount. |
3323 | + commit 8fa9b5696ca9f8386971e6f36646536f9579ceaa | |
2115 | 3324 | * src/lang/qt/tests/t-tofuinfo.cpp(testTofuSignCount): New. |
2116 | 3325 | (initTestCase): Set gpg-agent loopback pinentry config. |
2117 | 3326 | (signAndVerify): Helper for tofuTestSignCount. |
2118 | 3327 | |
2119 | 3328 | Qt: Add test passphrase provider. |
3329 | + commit efb5059b9b6e81db7b0c016aa9fb70abe98308ea | |
2120 | 3330 | * lang/qt/tests/t-support.h (TestPassphraseProvider): New. |
2121 | 3331 | * lang/qt/tests/Makefile.am (t_tofuinfo_SOURCES): Add t-support.h |
2122 | 3332 | |
2123 | 3333 | Cpp: Add support for TOFU_CONFLICT sigsum. |
3334 | + commit 80498ab662238a31325e78c0037ea6752f680a37 | |
2124 | 3335 | * lang/cpp/src/verificationresult.cpp (GpgME::Signature::Summary): |
2125 | 3336 | Handle TOFU_CONFLICT. |
2126 | 3337 | * lang/cpp/src/verificationresult.h (Summary): Add TofuConflict. |
2127 | 3338 | |
2128 | 3339 | Cpp: Add support for pinentry_mode. |
3340 | + commit d75c118aae18e20f08dbbb69c7998e1f3694ccd0 | |
2129 | 3341 | * lang/cpp/src/context.cpp (Context::pinentryMode): Return mode. |
2130 | 3342 | (Context::setPinentryMode): Set mode. |
2131 | 3343 | * lang/cpp/src/context.h (PinentryMode): Add enum. |
2133 | 3345 | 2016-07-01 Andre Heinecke <aheinecke@intevation.de> |
2134 | 3346 | |
2135 | 3347 | Qt: Add test for TofuInfo. |
3348 | + commit fbd6ac4655ebf56d91ebd9a4ff499c8319fcd087 | |
2136 | 3349 | * lang/qt/tests/t-tofuinfo.cpp: New. |
2137 | 3350 | * lang/qt/tests/Makefile.am: Update accordingly. |
2138 | 3351 | |
2139 | 3352 | Cpp: Add TofuInfo to signatures. |
3353 | + commit 93c5d420fcfe275aeff2b3d5ce99629edbe6625d | |
2140 | 3354 | * lang/cpp/src/tofuinfo.cpp, lang/cpp/src/tofuinfo.h: New class. |
2141 | 3355 | * lang/cpp/src/verificationresult.cpp (Signature::tofuInfo): New. |
2142 | 3356 | (VerificationResult::Private): Handle tofu info. |
2148 | 3362 | * configure.ac (LIBGPGMEPP_LT_REVISION): Bump for new API. |
2149 | 3363 | |
2150 | 3364 | core: Clarify documentation of tofu_stats address. |
3365 | + commit 948ce7d1edf12ecb5080a4816ca15f495d6393f5 | |
2151 | 3366 | * src/gpgme.h.in: Mention that Address is not always in addr-spec. |
2152 | 3367 | |
2153 | 3368 | core: Fix identify for armored detached sigs. |
3369 | + commit 570bf2a648f14b34c4c45d3890b7300529a82d37 | |
2154 | 3370 | * src/data-identify.c (basic_detection): Return signature for |
2155 | 3371 | signature. |
2156 | 3372 | |
2157 | 3373 | 2016-06-27 Andre Heinecke <aheinecke@intevation.de> |
2158 | 3374 | |
2159 | 3375 | Cpp: Expose new data_identify values. |
3376 | + commit 15fc5c34c88ecbb61272705af60f7054b41c57f7 | |
2160 | 3377 | * lang/cpp/src/data.cpp (GpgME::Data::type): Handle PGP Encrypted |
2161 | 3378 | and Signature. |
2162 | 3379 | * lang/cpp/src/data.h: Add values accordingly. |
2163 | 3380 | |
2164 | 3381 | Cpp: Do not treat KEYEXPIRED as error. |
3382 | + commit 82d484c852d07958ac93efb3d2d7b7726fbb5231 | |
2165 | 3383 | * lang/cpp/src/editinteractor.cpp (status_to_error): No error |
2166 | 3384 | for KEYEXPIRED. |
2167 | 3385 | |
2168 | 3386 | 2016-06-24 Andre Heinecke <aheinecke@intevation.de> |
2169 | 3387 | |
2170 | 3388 | tests: Add new test tool run-decrypt. |
3389 | + commit 3364549c19682f56d4d9c52ab7f76862c5a456cf | |
2171 | 3390 | * tests/run-decrypt.c: New. |
2172 | 3391 | * tests/Makefile.am (noinst_PROGRAMS): Add run-decrypt. |
2173 | 3392 | |
2174 | 3393 | 2016-06-23 Werner Koch <wk@gnupg.org> |
2175 | 3394 | |
2176 | 3395 | core: Add closer inspection of "PGP MESSAGE". |
3396 | + commit cf37a57d28c43ec36277e84ca44458b7287b940b | |
2177 | 3397 | * src/data-identify.c (inspect_pgp_message): New. |
2178 | 3398 | (basic_detection): Un-const arg DATA. Call inspect_pgp_message. |
2179 | 3399 | |
2180 | 3400 | core: Add a base 64 decoder. |
3401 | + commit f8b8027ae63c957557ed6bdc7e5a30ef1bdd8e77 | |
2181 | 3402 | * src/b64dec.c: New. Taken from gnupg. Prefix function names with |
2182 | 3403 | _gpgme_ and change to use standard C malloc functions. |
2183 | 3404 | * src/util.h.h (struct b64state): New. |
2186 | 3407 | 2016-06-22 Werner Koch <wk@gnupg.org> |
2187 | 3408 | |
2188 | 3409 | core: Detect compressed signed OpenPGP data. |
3410 | + commit bb8cf6236582fc9eb6564046599989af52779a26 | |
2189 | 3411 | * src/data-identify.c (next_openpgp_packet): Allow partial encoding. |
2190 | 3412 | (pgp_binary_detection): Handle compressed packets. |
2191 | 3413 | |
2192 | 3414 | 2016-06-21 Werner Koch <wk@gnupg.org> |
2193 | 3415 | |
2194 | 3416 | tests: Add new test tool run-identify. |
3417 | + commit 5905e8bbd809c1408edad4fa4eb0527fa51cbea3 | |
2195 | 3418 | * src/gpgme-tool.c (gt_identify): Add new strings. |
2196 | 3419 | * tests/run-identify.c: New. |
2197 | 3420 | * tests/Makefile.am (noinst_PROGRAMS): Add run-identify. |
2198 | 3421 | |
2199 | 3422 | core: Enhance gpgme_data_identify to detect binary PGP messages. |
3423 | + commit 32d4bbf5e3e5f88e4a6852d72a35ee30df9d5279 | |
2200 | 3424 | * src/gpgme.h.in (GPGME_DATA_TYPE_PGP_ENCRYPTED): New. |
2201 | 3425 | (GPGME_DATA_TYPE_PGP_SIGNATURE): New. |
2202 | 3426 | * src/data-identify.c: Add enum for OpenPGP packet types. |
2210 | 3434 | 2016-06-16 Justus Winter <justus@g10code.com> |
2211 | 3435 | |
2212 | 3436 | python: Improve autmatically generated docstrings. |
3437 | + commit 8997d88bf97d1784706becbf8e9dc74e4656e311 | |
2213 | 3438 | * lang/python/gpgme.i: Add comment. |
2214 | 3439 | * lang/python/pyme/core.py (__getattr__): Rewrite automatically |
2215 | 3440 | generated doctrings for the wrapper methods. |
2216 | 3441 | |
2217 | 3442 | python: Make result objects more robust. |
3443 | + commit a324d0cffe93cab955698c2c065b2f2227e379e4 | |
2218 | 3444 | Results returned by the GPGME are fragile, i.e. they are only valid |
2219 | 3445 | until the next operation is performed in the context. |
2220 | 3446 | |
2228 | 3454 | * lang/python/pyme/results.py: New file. |
2229 | 3455 | |
2230 | 3456 | python: Avoid creating SWIG proxy classes. |
3457 | + commit 856bcfe2934237011984fab0bc69800a7c25c34b | |
2231 | 3458 | * lang/python/Makefile.am (gpgme_wrap.c): Use '-builtin' to make SWIG |
2232 | 3459 | generate builtin types for c types. |
2233 | 3460 | * lang/python/gpgme.i (pygpgme_wrap_gpgme_data_t): Adapt slightly. |
2234 | 3461 | |
2235 | 3462 | python: Simplify wrapping glue. |
3463 | + commit 6641c7814b30e3e8f18105b2636545cc1bd07552 | |
2236 | 3464 | * lang/python/pyme/core.py: Rename '_getctype' to '_ctype' and turn it |
2237 | 3465 | into a string. Likewise rename '_getnameprepend' to '_cprefix'. |
2238 | 3466 | * lang/python/helpers.c: Adapt accordingly. |
2239 | 3467 | |
2240 | 3468 | python: Rework callbacks. |
3469 | + commit f3618bc615e3eff1f52fb5849cbf0f0b95515a61 | |
2241 | 3470 | Simplify how the lifetime of callback arguments is managed. |
2242 | 3471 | |
2243 | 3472 | * lang/python/gpgme.i (gpgme_edit_cb_t): Check arguments. |
2261 | 3490 | * lang/python/pyme/core.py (Context, Data): Update callsites. |
2262 | 3491 | |
2263 | 3492 | python: Wrap objects implementing the buffer protocol. |
3493 | + commit 616929b6edf00b4a774b727385d39b785a112b90 | |
2264 | 3494 | * lang/python/Makefile.am: Add the toplevel source directory to CFLAGS |
2265 | 3495 | when compiling the bindings so that we can use private header files. |
2266 | 3496 | * lang/python/gpgme.i (gpgme_data_t): Rework the object wrapping. Do |
2275 | 3505 | * lang/python/tests/t-idiomatic.py: Demonstrate this. |
2276 | 3506 | |
2277 | 3507 | python: Add properties to wrapped object. |
3508 | + commit 5464060baef2da8f5ea377118758e451c55e3787 | |
2278 | 3509 | * lang/python/pyme/core.py (GpgmeWrapper.__repr__): Saner |
2279 | 3510 | representation. |
2280 | 3511 | (GpgmeWrapper.__str__): Construct a nicer human readable string. |
2289 | 3520 | them. |
2290 | 3521 | |
2291 | 3522 | python: Improve the documentation. |
3523 | + commit 5492853d7b84b4e1d0b11b234e32252ba8d1608d | |
2292 | 3524 | * lang/python/Makefile.am: Copy the README file. |
2293 | 3525 | * lang/python/README: Rename, convert to org, and update. |
2294 | 3526 | * lang/python/pyme/__init__.py: Move license out of the docstring, |
2296 | 3528 | * lang/python/pyme/core.py: Add and update docstrings. |
2297 | 3529 | |
2298 | 3530 | python: Get version information from the build system. |
3531 | + commit 7eef399d89d4c3877cb795ed5ba45ecb241e67be | |
2299 | 3532 | * configure.ac: Generate 'setup.py' and 'version.py'. |
2300 | 3533 | * lang/python/Makefile.am: Use generated setup script. |
2301 | 3534 | * lang/python/pyme/version.py: Turn it into a template, and get |
2304 | 3537 | version module, which is frowned upon and actually caused a problem. |
2305 | 3538 | |
2306 | 3539 | python: Fix exception leak. |
3540 | + commit a852f99a0ac9dc7f7493b403f811f5f7518fae40 | |
2307 | 3541 | * lang/python/helpers.c (pygpgme_stash_callback_exception): Fix leak. |
2308 | 3542 | |
2309 | 3543 | python: Fix license. |
3544 | + commit 3bacce03e60dc45cc2da99a2f5c504612202e802 | |
2310 | 3545 | Other parts of the build system are also LGPLed. |
2311 | 3546 | |
2312 | 3547 | * lang/python/Makefile.am: Fix license. |
2314 | 3549 | 2016-06-14 Werner Koch <wk@gnupg.org> |
2315 | 3550 | |
2316 | 3551 | core: Make sure FD_SET is not used with an out of range fd. |
3552 | + commit 8173c4f1f8a145c4b1d454f6f05e26950e23d675 | |
2317 | 3553 | * src/posix-io.c (_gpgme_io_select): Check for FD out of range. |
2318 | 3554 | |
2319 | 3555 | 2016-06-08 Justus Winter <justus@g10code.com> |
2320 | 3556 | |
2321 | 3557 | python: Improve error handling. |
3558 | + commit 77d149e8614c381458e07808a7930ce3fb92cdc3 | |
2322 | 3559 | * lang/python/helpers.c (pyPassphraseCb): Handle write errors. |
2323 | 3560 | (pyEditCb): Likewise. |
2324 | 3561 | |
2325 | 3562 | python: Add function to raise exceptions from c. |
3563 | + commit 5ebc205439cac266685d2532466df8b3457dea23 | |
2326 | 3564 | * lang/python/helpers.c (pygpgme_raise_exception): New function. |
2327 | 3565 | |
2328 | 3566 | python: Fix stripping deprecated functionality. |
3567 | + commit 8426304b67a0b0a5630db500abf740b0e0b9e43c | |
2329 | 3568 | * lang/python/Makefile.am (gpgme.h): Add script as input. |
2330 | 3569 | * lang/python/gpgme-h-clean.py (deprec_func): Also match struct |
2331 | 3570 | members. |
2332 | 3571 | (line_break): Fix matching on struct members. |
2333 | 3572 | |
2334 | 3573 | python: Fix type. |
3574 | + commit 990492ea4f7dafbb75de15ea91c30cbf090034b5 | |
2335 | 3575 | * lang/python/gpgme.i: Use correct Python type for size. |
2336 | 3576 | |
2337 | 3577 | python: Implement the context manager protocol. |
3578 | + commit e3c5913a33edcbd7329b8d154c669f95ce782038 | |
2338 | 3579 | * lang/python/pyme/core.py (Context.__del__): Make function |
2339 | 3580 | idemptotent. |
2340 | 3581 | (Context.{__enter__,__exit__}): Implement the context manager |
2347 | 3588 | 2016-06-07 Justus Winter <justus@g10code.com> |
2348 | 3589 | |
2349 | 3590 | python: Fix error handling. |
3591 | + commit f8f9bf06bc3190968ba6613032d60a3bf2c8a6d9 | |
2350 | 3592 | * lang/python/gpgme.i: Fix freeing an uninitialized pointer in the |
2351 | 3593 | error handling of generated wrapper functions by explicitly storing |
2352 | 3594 | the pointer in a local variable which can be initialized. |
2354 | 3596 | 2016-06-06 Justus Winter <justus@g10code.com> |
2355 | 3597 | |
2356 | 3598 | python: Wrap file-like objects on demand. |
3599 | + commit 8196edf9ca5c8f2f02553e7f22d9c79dbd229882 | |
2357 | 3600 | * lang/python/gpgme.i (gpgme_data_t): Use new function to create |
2358 | 3601 | wrapper objects if necessary, and deallocate them after the function |
2359 | 3602 | call. |
2363 | 3606 | * lang/python/tests/t-idiomatic.py: New file. |
2364 | 3607 | |
2365 | 3608 | python: Move helper function. |
3609 | + commit 26c3accc95ab77ddbe60db822e2938ad5f480d41 | |
2366 | 3610 | * lang/python/gpgme.i (object_to_gpgme_t): Move... |
2367 | 3611 | * lang/python/helpers.c: ... here. |
2368 | 3612 | * lang/python/helpers.h (object_to_gpgme_t): New prototype. |
2369 | 3613 | |
2370 | 3614 | python: Fix error handling. |
3615 | + commit 89eb0cd4d65bc033ed6342810b26232797482d64 | |
2371 | 3616 | * lang/python/gpgme.i (object_to_gpgme_t): Properly propagate |
2372 | 3617 | exceptions. |
2373 | 3618 | |
2374 | 3619 | python: Initialize GPGME for the user. |
3620 | + commit ae06f7c2fe0e49baeab5a827dc38ba8c57a6404c | |
2375 | 3621 | * lang/python/pyme/core.py: Call 'check_version' and explain why. |
2376 | 3622 | * lang/python/tests/support.py (init_gpgme): Drop call here. |
2377 | 3623 | |
2378 | 3624 | 2016-06-01 Justus Winter <justus@g10code.com> |
2379 | 3625 | |
2380 | 3626 | python: Fix test suite with GnuPG prior to 2.1.12. |
3627 | + commit bbf19124bbec9eb6298cef2914baae7ac74382fe | |
2381 | 3628 | * lang/python/tests/Makefile.am (gpg-agent.conf): Use |
2382 | 3629 | 'allow-loopback-pinentry'. |
2383 | 3630 | |
2384 | 3631 | python: Make Python detection more robust. |
3632 | + commit 1607aa7fe5dd686ba3bfb6de4a2b602d6a458c86 | |
2385 | 3633 | Previously, missing Python development packages made configure fail |
2386 | 3634 | instead of merely disabling the bindings. |
2387 | 3635 | |
2389 | 3637 | * m4/ax_python_devel.m4: Make test non-fatal. |
2390 | 3638 | |
2391 | 3639 | python: Improve build system integration, fix warnings. |
3640 | + commit 73c47535b631a55687ecc5eff1d1d9a9fd71021e | |
2392 | 3641 | * lang/python/Makefile.am: Pass CFLAGS to python build system. |
2393 | 3642 | * lang/python/helpers.c (pyPassphraseCb): Use correct type for length. |
2394 | 3643 | (pygpgme_data_new_from_cbs): Drop unused variable. |
2396 | 3645 | 2016-06-01 Andre Heinecke <aheinecke@intevation.de> |
2397 | 3646 | |
2398 | 3647 | Cpp: Use whitelist for status messages. |
3648 | + commit 54314a9c7d7ad52981c836ca742644a1fa69b518 | |
2399 | 3649 | * lang/cpp/src/editinteractor.cpp (EditInteractor::needsNoResponse): |
2400 | 3650 | Use whitelist instead of blacklist. |
2401 | 3651 | |
2402 | 3652 | Qt: Fix debug output in t-ownertrust. |
3653 | + commit 9d6f85bd25e51445f1776b498875e77b529311b1 | |
2403 | 3654 | * lang/qt/tests/t-ownertrust.cpp (testChangeOwnerTrust): Remove |
2404 | 3655 | general debug of trust level. Add debug output for error. |
2405 | 3656 | |
2406 | 3657 | 2016-06-01 Justus Winter <justus@gnupg.org> |
2407 | 3658 | |
2408 | 3659 | tests: Fix notation tests. |
3660 | + commit c88c9ef384b6f7bda9a61b58f26c2f89ae25f684 | |
2409 | 3661 | * lang/python/tests/t-sig-notation.py (check_result): Check critical |
2410 | 3662 | flag. |
2411 | 3663 | * tests/gpg/t-sig-notation.c (check_result): Likewise. |
2412 | 3664 | |
2413 | Fixes-commit: 1cacd7d0 | |
2414 | ||
2415 | 3665 | 2016-06-01 Werner Koch <wk@gnupg.org> |
2416 | 3666 | |
2417 | 3667 | core: Set notation flags for verify. |
3668 | + commit 1cacd7d00a7b3de4a5e11ccce5ee6c50e0a5516d | |
2418 | 3669 | * src/gpgme.h.in (GPGME_STATUS_NOTATION_FLAGS): New. |
2419 | 3670 | * src/status-table.c (status_table): Add new status. |
2420 | 3671 | * src/verify.c (parse_notation): Handle flags. Also fix NOTATION_DATA |
2425 | 3676 | 2016-05-31 Tobias Mueller <muelli@cryptobitch.de> |
2426 | 3677 | |
2427 | 3678 | python: use GPG_ERROR_CONFIG variable. |
3679 | + commit 8ad17f402f6420880dcf06a13a54feadb52c0208 | |
2428 | 3680 | instead of calling gpg-error-config. |
2429 | 3681 | This is useful when configuring with --with-gpgerror-prefix |
2430 | 3682 | because then GPG_ERROR_CONFIG contains the correct |
2435 | 3687 | 2016-05-31 Justus Winter <justus@gnupg.org> |
2436 | 3688 | |
2437 | 3689 | python: Port more tests. |
3690 | + commit afa0dd56e1cce64fe08bff3c64b12aecce54fd2d | |
2438 | 3691 | * lang/python/gpgme.i: Hide length fields of notations. |
2439 | 3692 | * lang/python/tests/Makefile.am (pytests): Add new tests. |
2440 | 3693 | * lang/python/tests/t-decrypt-verify.py: New file. |
2444 | 3697 | 2016-05-27 Werner Koch <wk@gnupg.org> |
2445 | 3698 | |
2446 | 3699 | Speedup closing of fds before exec. |
3700 | + commit 89d22f9229f2ecd559ac6ea91dae60eeff940fa5 | |
2447 | 3701 | * src/posix-io.c [__linux__]: Include dirent.h. |
2448 | 3702 | (get_max_fds) [__linux__]: Try to figure out the highest used fd. |
2449 | 3703 | |
2450 | 3704 | 2016-05-27 Justus Winter <justus@gnupg.org> |
2451 | 3705 | |
2452 | 3706 | python: Port more tests. |
3707 | + commit 3915842657f0849a038752fd7445f96081a89dd9 | |
2453 | 3708 | * lang/python/pyme/core.py (Data._error_check): Add |
2454 | 3709 | 'gpgme_data_get_file_name' to the list of functions not returning an |
2455 | 3710 | error code. |
2461 | 3716 | * lang/python/tests/t-trustlist.py: Likewise. |
2462 | 3717 | |
2463 | 3718 | python: Implement data callbacks. |
3719 | + commit 2ae847c02731994d99e69d3d025ff01f41406452 | |
2464 | 3720 | * lang/python/gpgme.i (object_to_gpgme_t): Set exception on error. |
2465 | 3721 | * lang/python/helpers.c (pyDataReadCb): New function. |
2466 | 3722 | (pyDataWriteCb): Likewise. |
2480 | 3736 | * lang/python/tests/t-data.py: Likewise. |
2481 | 3737 | |
2482 | 3738 | python: Fix object deallocation. |
3739 | + commit ebfe2300c33a3bad311e9ac1530e6c92636a08a4 | |
2483 | 3740 | Handing a reference to the wrapper object created a non-trivial |
2484 | 3741 | circular reference that Pythons garbage collector is unable to break. |
2485 | 3742 | Explicitly break it by using a weak reference. |
2493 | 3750 | (Context.op_edit): Likewise. |
2494 | 3751 | |
2495 | 3752 | Improve comments. |
3753 | + commit e74cd9fb80f12b764d5e4561e73d55644147e9e7 | |
2496 | 3754 | * src/gpgme.h.in (gpgme_data_seek_cb_t, gpgme_data_seek): Clarify that |
2497 | 3755 | these functions return the new offset. |
2498 | 3756 | (gpgme_data_release_cb_t): Fix name of parameter. |
2499 | 3757 | |
2500 | 3758 | python: Fix reading data from existing files. |
3759 | + commit bf188e280b8b4fc775f33c47e2e1e275ed044004 | |
2501 | 3760 | * lang/python/pyme/core.py (Data.__init__): Add 'copy' kwargument, and |
2502 | 3761 | pass it to functions supporting it. PEP8 fix. |
2503 | 3762 | (Data.new_from_fd): PEP8 fix. |
2510 | 3769 | 2016-05-25 Justus Winter <justus@gnupg.org> |
2511 | 3770 | |
2512 | 3771 | src: Fix trace string. |
3772 | + commit ce73ae9d0cbf782cd3a1949fc4f568f0d1da60d9 | |
2513 | 3773 | * src/data-compat.c (gpgme_data_new_from_file): Fix trace string. |
2514 | 3774 | |
2515 | 3775 | 2016-05-24 Justus Winter <justus@gnupg.org> |
2516 | 3776 | |
2517 | 3777 | python: Improve and test Context.wait. |
3778 | + commit 00ff6d07330028da370c869e3ec442eb76f8cbb8 | |
2518 | 3779 | * lang/python/pyme/core.py (Context.wait): Improve docstring. As the |
2519 | 3780 | context passed to 'gpgme_wait' is never NULL, it is pointless to look |
2520 | 3781 | at the returned context. Always raise exceptions. |
2522 | 3783 | * lang/python/tests/t-wait.py: New file. |
2523 | 3784 | |
2524 | 3785 | python: Make all GnuPG errors available. |
3786 | + commit 7bc9cc717e428f48d4b27016f44c9f3900b1fba6 | |
2525 | 3787 | * lang/python/Makefile.am (errors.i): Generate file. |
2526 | 3788 | * lang/python/gpgme.i: Include generated file. |
2527 | 3789 | * lang/python/pyme/errors.py: Pull in all errors and error sources. |
2528 | 3790 | |
2529 | 3791 | python: Move the base wrapper class. |
3792 | + commit 0ebd6a1b43a96bffa78da89dc8629edac0a74d35 | |
2530 | 3793 | * python/lang/pyme/util.py (GpgmeWrapper): Move... |
2531 | 3794 | * python/lang/pyme/core.py: ... here. |
2532 | 3795 | |
2533 | 3796 | python: Support status callbacks. |
3797 | + commit 8b57f06e0c04f5c9b87a3c76618230d757412076 | |
2534 | 3798 | * lang/python/helpers.c (pyStatusCb): New function. |
2535 | 3799 | (pygpgme_set_status_cb): Likewise. |
2536 | 3800 | * lang/python/helpers.h (pygpgme_set_status_cb): New prototype. |
2541 | 3805 | * lang/python/tests/t-callbacks.py: Test status callbacks. |
2542 | 3806 | |
2543 | 3807 | python: Improve docstring. |
3808 | + commit 72afb68f8c2f0cb326f20b289215402fd849339d | |
2544 | 3809 | * lang/python/pyme/core.py (Context.set_progress_cb): Improve |
2545 | 3810 | docstring. |
2546 | 3811 | |
2547 | 3812 | 2016-05-24 Andre Heinecke <aheinecke@intevation.de> |
2548 | 3813 | |
2549 | 3814 | Qt: Fix test build with clang. |
3815 | + commit 00e93b2cae0585ff10425421d9097a846943b21c | |
2550 | 3816 | * lang/qt/tests/Makefile.am (LDADD): Explicitly add -lstdc++ |
2551 | 3817 | |
2552 | 3818 | Cpp: Set -std=c++11 also if CXXCPP is already set. |
3819 | + commit b107fc8a92bd16bc0d868c771b6334d6594e6395 | |
2553 | 3820 | * m4/ax_cxx_compile_stdxx.m4 (AX_CXX_COMPILE_STDCXX): Set CXXCPP if |
2554 | 3821 | neccessary. |
2555 | 3822 | |
2556 | 3823 | 2016-05-24 Justus Winter <justus@gnupg.org> |
2557 | 3824 | |
2558 | 3825 | python: Improve support for edit callbacks. |
3826 | + commit 09803c4a81b9431fd4c8f30abb1c60c4c735f0cb | |
2559 | 3827 | * lang/python/helpers.c (pyEditCb): Stash exceptions. |
2560 | 3828 | * lang/python/pyme/core.py (Context.op_edit): Hand in 'self'. |
2561 | 3829 | * lang/python/tests/Makefile.am (py_tests): Add new test. |
2565 | 3833 | 2016-05-23 Justus Winter <justus@gnupg.org> |
2566 | 3834 | |
2567 | 3835 | python: Fix hook. |
3836 | + commit 283f0bdc3d32624dac93d02ba3df516e69d8d4ba | |
2568 | 3837 | * lang/python/helpers.c (pyProgressCb): Fix getting hook data. |
2569 | 3838 | * lang/python/tests/t-callbacks.py: Show that this works. |
2570 | 3839 | |
2571 | 3840 | python: Move edit callback function. |
3841 | + commit 5476ca6813fc9d8833d5224f19d4bb7515380ab5 | |
2572 | 3842 | * lang/python/gpgme.i (pyEditCb): Move... |
2573 | 3843 | * lang/python/helpers.c: ... here. |
2574 | 3844 | * lang/python/helpers.h (pyEditCb): New prototype. |
2575 | 3845 | |
2576 | 3846 | python: Port more tests. |
3847 | + commit a42d814a65fdc29a3be6efa97433997495696a88 | |
2577 | 3848 | * lang/python/tests/Makefile.am (TESTS_ENVIRONMENT): Set |
2578 | 3849 | LD_LIBRARY_PATH. |
2579 | 3850 | (pytests): Add new tests. |
2583 | 3854 | * lang/python/tests/t-signers.py: Likewise. |
2584 | 3855 | |
2585 | 3856 | python: Translate list of strings. |
3857 | + commit c9cc0412e940c78c3e9bacb6ff1459b5bb5bb9ad | |
2586 | 3858 | * lang/python/gpgme.i: Add typemap translating list of strings. |
2587 | 3859 | |
2588 | 3860 | 2016-05-21 Werner Koch <wk@gnupg.org> |
2589 | 3861 | |
2590 | 3862 | api: Return Tofu info for signatures. |
3863 | + commit 10df06ee8f9192309bf124872438f7c32457e1c6 | |
2591 | 3864 | * src/gpgme.h.in (gpgme_tofu_policy_t): New. |
2592 | 3865 | (gpgme_status_code_t): Add status codes for TOFU. |
2593 | 3866 | (struct _gpgme_tofu_info, gpgme_tofu_info_t): New. |
2605 | 3878 | (print_result): print tofu info. |
2606 | 3879 | |
2607 | 3880 | api: Add new context flag "raw-description". |
3881 | + commit dac2c5441d418536632f014c8b0e1359580279d1 | |
2608 | 3882 | * src/context.h (struct gpgme_context): Add field raw_description. |
2609 | 3883 | * src/gpgme.c (gpgme_set_ctx_flag): New flag. |
2610 | 3884 | |
2611 | 3885 | core: New functions to help parsing of status lines. |
3886 | + commit a92946a8cacc44f655249d84b316deae59e62671 | |
2612 | 3887 | * src/conversion.c (_gpgme_split_fields): New. |
2613 | 3888 | (_gpgme_strtoul_field): New. |
2614 | 3889 | |
2615 | 3890 | 2016-05-20 Andre Heinecke <aheinecke@intevation.de> |
2616 | 3891 | |
2617 | 3892 | Qt: Add test for changeownertrust. |
3893 | + commit eaf2d018e63c15cd9a81e5c1fd2fedbf8829f7b9 | |
2618 | 3894 | * lang/qt/tests/t-ownertrust.cpp: New test. |
2619 | 3895 | * lang/qt/tests/Makefile.am: Add test. |
2620 | 3896 | |
2621 | 3897 | Cpp: Ignore STATUS_KEY_CONSIDERED when editing. |
3898 | + commit 5df858cbf196b2a53d600b7f45655f7b35c1fe93 | |
2622 | 3899 | * lang/cpp/src/editinteractor.cpp (EditInteractor::needsNoResponse): |
2623 | 3900 | Handle GPGME_STATUS_KEY_CONSIDERED. |
2624 | 3901 | |
2625 | 3902 | 2016-05-19 Werner Koch <wk@gnupg.org> |
2626 | 3903 | |
2627 | 3904 | api: Add new function gpgme_set_ctx_flag. |
3905 | + commit 88f2c1c0d16eee6bb36a901623ea65ac69499f03 | |
2628 | 3906 | * src/gpgme.h.in (gpgme_set_ctx_flag): New prototype. |
2629 | 3907 | * src/gpgme.c (gpgme_set_ctx_flag): New. |
2630 | 3908 | * src/gpgme.def, src/libgpgme.vers: Add new function. |
2663 | 3941 | (main): Add option --status. |
2664 | 3942 | |
2665 | 3943 | api: Remove arbitrary restriction from gpgme_op_verify. |
3944 | + commit 5aa8e588e166abeef2e3d677ab6830f2d7af1b5d | |
2666 | 3945 | * src/verify.c (verify_start): Do not return GPG_ERR_INV_VALUES when |
2667 | 3946 | when SIGNED_TEXT is not given. |
2668 | 3947 | |
2669 | 3948 | 2016-05-19 Justus Winter <justus@gnupg.org> |
2670 | 3949 | |
2671 | 3950 | python: Improve progress callbacks. |
3951 | + commit 0d4e95621e05d50cd454049a424bb9ee098a5db6 | |
2672 | 3952 | * lang/python/helpers.c (pyProgressCb): Stash python errors, convert |
2673 | 3953 | 'what' to Unicode object. |
2674 | 3954 | * lang/python/pyme/core.py (Context.set_progress_cb): Hand in 'self'. |
2675 | 3955 | * lang/python/tests/t-callbacks.py: Test progress callbacks. |
2676 | 3956 | |
2677 | 3957 | python: Robust exception handling in callbacks. |
3958 | + commit d90857a08c4fe5b73b6d6d46fd6200efdd72db44 | |
2678 | 3959 | * lang/python/helpers.c (pygpgme_stash_callback_exception): New |
2679 | 3960 | function. |
2680 | 3961 | (pygpgme_raise_callback_exception): Likewise. |
2692 | 3973 | 2016-05-19 Andre Heinecke <aheinecke@intevation.de> |
2693 | 3974 | |
2694 | 3975 | Qt: Check for graphviz and set HAVE_DOT correctly. |
3976 | + commit 2f748b5a2d162be4f23b18782219771ead54cb51 | |
2695 | 3977 | * configure.ac: Check for graphviz and define HAVE_DOT. |
2696 | 3978 | * lang/qt/doc/Doxyfile.in (HAVE_DOT): Use variable. |
2697 | 3979 | |
2698 | 3980 | 2016-05-19 Justus Winter <justus@gnupg.org> |
2699 | 3981 | |
2700 | 3982 | python: Add more tests. |
3983 | + commit 464d404c8816fc93baf945816c93e86bdeb0ea39 | |
2701 | 3984 | * lang/python/tests/Makefile.am (py_tests): Add new tests. |
2702 | 3985 | * lang/python/tests/support.py (print_data): New function. |
2703 | 3986 | * lang/python/tests/t-decrypt.py: Use new function. |
2706 | 3989 | * lang/python/tests/t-encrypt-sym.py: Likewise. |
2707 | 3990 | |
2708 | 3991 | python: More type conversion fixes. |
3992 | + commit c1c893e3384a07ff864507902fbac4a7fee4d6f1 | |
2709 | 3993 | * lang/python/helpers.c (pyPassphraseCb): Cope with 'uid_hint' being |
2710 | 3994 | NULL, convert it to an Unicode object, and cope with the callback |
2711 | 3995 | returning both Unicode and bytes objects. |
2712 | 3996 | |
2713 | 3997 | python: Fix import. |
3998 | + commit 07f71cd17706093ca6b1507c41609356d479ae9f | |
2714 | 3999 | * lang/python/helpers.c (pygpgme_exception_init): Make module import |
2715 | 4000 | relative. |
2716 | 4001 | |
2717 | 4002 | 2016-05-19 Andre Heinecke <aheinecke@intevation.de> |
2718 | 4003 | |
2719 | 4004 | Qt: Fix compilation of unit tests. |
4005 | + commit 375523ead3a749d77d286c56f10d403c07f2b014 | |
2720 | 4006 | * lang/qt/tests/Makefile.am (AM_CPPFLAGS): Add -DBUILDING_QGPGME. |
2721 | 4007 | |
2722 | 4008 | 2016-05-18 Justus Winter <justus@gnupg.org> |
2723 | 4009 | |
2724 | 4010 | python: Various fixes. |
4011 | + commit 2c3a5d93e78cfca22785e51c5a65184a47da4bff | |
2725 | 4012 | * configure.ac: Fix SWIG detection, bump required Python version. |
2726 | 4013 | * lang/python/Makefile.am: Portability fix. |
2727 | 4014 | |
2728 | 4015 | 2016-05-18 Andre Heinecke <aheinecke@intevation.de> |
2729 | 4016 | |
2730 | 4017 | Fix typo in compatibility declaration. |
4018 | + commit f0dca0ab92ed18d80e30d7d39db1596b4112794f | |
2731 | 4019 | * src/op-support.c (GPG_ERR_SUBKEYS_EXP_REV): Change to |
2732 | 4020 | GPG_ERR_SUBKEYS_EXP_OR_REV. |
2733 | 4021 | |
2734 | 4022 | 2016-05-17 Werner Koch <wk@gnupg.org> |
2735 | 4023 | |
2736 | 4024 | tests: New maintenance helper run-encrypt. |
4025 | + commit 30b447fcfe0e4f362c2575e1b9388e8144b5b2fd | |
2737 | 4026 | * tests/run-encrypt.c: New. |
2738 | 4027 | |
2739 | 4028 | Return dedicated error code for all subkeys expired or revoked. |
4029 | + commit 315fb73d4a774e2c699ac1804f5377559b4d0027 | |
2740 | 4030 | * src/gpgme.h.in (GPGME_STATUS_KEY_CONSIDERED): New. |
2741 | 4031 | (GPGME_SIGSUM_TOFU_CONFLICT): New. |
2742 | 4032 | * src/status-table.c (KEY_CONSIDERED): New. |
2753 | 4043 | 2016-05-17 Andre Heinecke <aheinecke@intevation.de> |
2754 | 4044 | |
2755 | 4045 | Qt / Cpp: Port auto_ptr to unique_ptr. |
4046 | + commit 9b36ebf37a3b889c955ba68038bd5b3d9c5cde4e | |
2756 | 4047 | * lang/cpp/src/context.cpp, |
2757 | 4048 | lang/cpp/src/context.h, |
2758 | 4049 | lang/cpp/src/context_p.h (Context::createForEngine), |
2770 | 4061 | 2016-05-17 Justus Winter <justus@gnupg.org> |
2771 | 4062 | |
2772 | 4063 | build: Add python autoconf macro. |
4064 | + commit 4711a1e181153a2395e5f523047595abd47965db | |
2773 | 4065 | * m4/ax_python_devel.m4: New file. |
2774 | 4066 | |
2775 | 4067 | python: Clean up examples. |
4068 | + commit 10328324c8fc9725cd0c885eaebfc80dc32c1ff6 | |
2776 | 4069 | * lang/python/examples/delkey.py: Clean up example. |
2777 | 4070 | * lang/python/examples/encrypt-to-all.py: Likewise. |
2778 | 4071 | * lang/python/examples/genkey.py: Likewise. |
2785 | 4078 | * lang/python/pyme/__init__.py: Likewise. |
2786 | 4079 | |
2787 | 4080 | python: Import GPGMEError. |
4081 | + commit 64e5fe767f45e9ccb0fb3fe919171c222132a54c | |
2788 | 4082 | * pyme/core.py: Import GPGMEError. |
2789 | 4083 | |
2790 | 4084 | Fixes c5d118b2. |
2791 | 4085 | |
2792 | 4086 | python: Port more tests. |
4087 | + commit 9ceaec25918c6c5f2dfafe4e20181b83ce78f6ce | |
2793 | 4088 | * lang/python/Makefile.am: Add bits from the c test suite. |
2794 | 4089 | * lang/python/support.py: New file. |
2795 | 4090 | * lang/python/t-decrypt.py: Likewise. |
2798 | 4093 | 2016-05-13 Andre Heinecke <aheinecke@intevation.de> |
2799 | 4094 | |
2800 | 4095 | Qt: Add keyLocateJob and test for it. |
4096 | + commit 52f2295d528029a36a3e0a89c777297762b3fc9b | |
2801 | 4097 | * configure.ac (LIBQGPGME_LT_REVISION): Bump. |
2802 | 4098 | * lang/qt/src/protocol.h (locateKeysJob): Add Job. |
2803 | 4099 | * lang/qt/src/protocol_p.h (locateKeysJob): Implement. |
2805 | 4101 | * lang/qt/tests/t-keylocate.cpp: New. |
2806 | 4102 | |
2807 | 4103 | Qt: Add missing copyright header in test. |
4104 | + commit 66ded1a5ce7236254f8541addecd4c3bc7b2878e | |
2808 | 4105 | * lang/qt/tests/t-keylist.cpp: Add copyright header. |
2809 | 4106 | |
2810 | 4107 | 2016-05-12 Justus Winter <justus@gnupg.org> |
2811 | 4108 | |
2812 | 4109 | python: Share generated methods between objects. |
4110 | + commit 11314f0db6e57597e3f56351a86fdb36a7a17dd7 | |
2813 | 4111 | * lang/python/pyme/util.py (GpgmeWrapper.__getattr__): Monkey-patch |
2814 | 4112 | the class. |
2815 | 4113 | * lang/python/tests/t-wrapper.py: Demonstrate the sharing. |
2816 | 4114 | |
2817 | 4115 | python: Raise exceptions on write errors. |
4116 | + commit c5d118b2a76e9528df780d11da9566ff7c22e4f5 | |
2818 | 4117 | * lang/python/pyme/core.py (Data.write): Handle errors. |
2819 | 4118 | * lang/python/pyme/errors.py (GPGMEError.fromSyserror): New function. |
2820 | 4119 | |
2821 | 4120 | python: Fix writing to data buffers. |
4121 | + commit f7094d8358e933f3ce074eade7a40b2a7d291180 | |
2822 | 4122 | * lang/python/gpgme.i: Add typemap for buffers. |
2823 | 4123 | * lang/python/pyme/core.py (Data.write): Fix function. |
2824 | 4124 | * lang/python/tests/Makefile.am: Add new test. |
2825 | 4125 | * lang/python/tests/t-data.py: New file. |
2826 | 4126 | |
2827 | 4127 | python: Add a test suite. |
4128 | + commit e64bffe0307d14204b00a177a472cd4f99c07561 | |
2828 | 4129 | * configure.ac: Add new Makefile. |
2829 | 4130 | * lang/python/Makefile.am: Add subdirectory. |
2830 | 4131 | * lang/python/tests/Makefile.am: New file. |
2831 | 4132 | * lang/python/tests/t-wrapper.py: Likewise. |
2832 | 4133 | |
2833 | 4134 | python: Cache generated wrapper functions. |
4135 | + commit ed0ce84fbd2904bf59ac66ae7422716db3624efa | |
2834 | 4136 | * lang/python/util.py (GpgmeWrap.__getattr__): Cache generated wrapper |
2835 | 4137 | functions. |
2836 | 4138 | |
2837 | 4139 | python: Fix function invocation. |
4140 | + commit e3d3d366bd1a1aea8a38ae5dcbf71ea3c784e920 | |
2838 | 4141 | * lang/python/pyme/core.py (Data.new_from_fd): Fix function |
2839 | 4142 | invocation. |
2840 | 4143 | |
2841 | 4144 | python: Fix name of exception, make slot methods explicit. |
4145 | + commit af9371eb63664c92fb67e8e7e03cc984e7d38a7f | |
2842 | 4146 | * lang/python/pyme/util.py (GpgmeWrapper._getctype): Fix exception, |
2843 | 4147 | add docstring. |
2844 | 4148 | (GpgmeWrapper._getnameprepend): New function. |
2845 | 4149 | (GpgmeWrapper._errorcheck): Likewise. |
2846 | 4150 | |
2847 | 4151 | python: Handle interpreter shutdown. |
4152 | + commit ce5121ad53b0e17fbf9150b354c80da73f7fe190 | |
2848 | 4153 | * lang/python/pyme/core.py: Avoid races at interpreter shutdown. This |
2849 | 4154 | silences the most annoying occurrences, however this problem also |
2850 | 4155 | affects the SWIG generated code, which might indicate that the real |
2851 | 4156 | problem is somewhere else. If so, this change can be easily reverted. |
2852 | 4157 | |
2853 | 4158 | python: Make test case more robust. |
4159 | + commit c89d3a71ad20ff02755539a44f254b1e59054c4a | |
2854 | 4160 | * lang/python/examples/t-edit.py: Check if key is found. |
2855 | 4161 | |
2856 | 4162 | python: Fix type translation. |
4163 | + commit d60deb8a127fb35c01acc729f33b014840af0e7b | |
2857 | 4164 | * lang/python/gpgme.i: Adjust to Python3's string type being |
2858 | 4165 | 'Unicode', not 'bytes'. Fix type checking. |
2859 | 4166 | * lang/python/core.py (Data.write): Add docstring mentioning the |
2865 | 4172 | 2016-05-11 Andre Heinecke <aheinecke@intevation.de> |
2866 | 4173 | |
2867 | 4174 | Cpp: Ensure gpgme.h is taken from current build. |
4175 | + commit b8de79160b2e05ac84d8feb61ff7ed1f7015a623 | |
2868 | 4176 | * lang/cpp/src/Makefile.am (AM_CPPFLAGS): Add gpgme.h location. |
2869 | 4177 | |
2870 | 4178 | 2016-05-11 Justus Winter <justus@gnupg.org> |
2871 | 4179 | |
2872 | 4180 | python: Fix simple example. |
4181 | + commit bbeee5e1a060f2d1e37a08220eb552cf4673a058 | |
2873 | 4182 | * lang/python/examples/simple.py: Flush stdout, encode name as |
2874 | 4183 | UTF-8 before passing it to GPGME. |
2875 | 4184 | |
2876 | 4185 | python: Integrate into the build system. |
4186 | + commit a29babd07cf9f9625d2b5aa2eb6b7bc9d1828359 | |
2877 | 4187 | * configure.ac: Make Python bindings configurable, add new Makefile. |
2878 | 4188 | * lang/python/Makefile.am: New file. |
2879 | 4189 | * lang/python/setup.py: Integrate into the build system. |
2883 | 4193 | 2016-05-10 Andre Heinecke <aheinecke@intevation.de> |
2884 | 4194 | |
2885 | 4195 | Qt / Cpp: Fix make dist. |
4196 | + commit c303292aca26c43b6efe98719edb3ff7b2d6665d | |
2886 | 4197 | * lang/cpp/src/Makefile.am (EXTRA_DIST): Fix typo. |
2887 | 4198 | (private_gpgmepp_headers): New. Private headers. |
2888 | 4199 | (libgpgmepp_la_SOURCES): Add private headers. |
2892 | 4203 | 2016-05-10 Justus Winter <justus@gnupg.org> |
2893 | 4204 | |
2894 | 4205 | python: PEP8 fixes. |
4206 | + commit 11392a80d9a85bcd8718b105e6d58038e61beaac | |
2895 | 4207 | Cherry picked from 0267c151. |
2896 | 4208 | |
2897 | 4209 | 2016-05-10 Andre Heinecke <aheinecke@intevation.de> |
2898 | 4210 | |
2899 | 4211 | Qt: Make Protocol class public API. |
4212 | + commit 56c4d9ea9520c95612e525b2fa1359db6fa88f4a | |
2900 | 4213 | * lang/qt/src/Makefile.am (qgpgme_headers): Add protocol.h |
2901 | 4214 | (private_qgpgme_headers): Add protocol_p.h |
2902 | 4215 | * lang/qt/src/protocol.h: New. From QGpgMEBackend. |
2905 | 4218 | lang/qt/src/qgpgmebackend.cpp (Protocol): Removed. |
2906 | 4219 | |
2907 | 4220 | Qt: Make doxygen quieter. |
4221 | + commit 97225bb01cd2ffa1d84c7fedbc577275de4a4893 | |
2908 | 4222 | * lang/qt/doc/Doxyfile.in: Quiet and no undocumented warnings. |
2909 | 4223 | |
2910 | 4224 | Qt: Only install public headers. |
4225 | + commit 740f92a7b83389ee9bde98b7bd25556793500b8b | |
2911 | 4226 | * lang/qt/src/Makefile.am: Do not install all headers. |
2912 | 4227 | |
2913 | 4228 | Qt: Add test for async keylisting. |
4229 | + commit 0e3195948ddaba3af07d2415bb496491076edc17 | |
2914 | 4230 | * src/lang/qt/tests/t-keylist.cpp(KeyListTest::testKeyListAsync): New. |
2915 | 4231 | |
2916 | 4232 | 2016-05-10 Werner Koch <wk@gnupg.org> |
2917 | 4233 | |
2918 | 4234 | Allow cc to detect missing cases in a switch. |
4235 | + commit fc38c15136c87ce971a8381fa87399088dd5a3cc | |
2919 | 4236 | * src/delete.c (delete_status_handler): Remove default case from a |
2920 | 4237 | switch so that cc can check the use of all enum values. |
2921 | 4238 | |
2922 | 4239 | 2016-05-06 Andre Heinecke <aheinecke@intevation.de> |
2923 | 4240 | |
2924 | 4241 | Use common error message style for qt lang checks. |
4242 | + commit a579be82c84f0b9732ee3d52ff2142a3decf95d7 | |
2925 | 4243 | * configure.ac: Use common error highliting for qt lang options. |
2926 | 4244 | |
2927 | 4245 | Qt: Fix license mentioned in README. |
4246 | + commit 11ff8d5964bf66f905818514f6a51fc881ea1a56 | |
2928 | 4247 | * lang/qt/README: License is GPLv2+ and not LGPL. |
2929 | 4248 | |
2930 | 4249 | Add maybe mode for langs and default to it. |
4250 | + commit cd267791e9bd73505a2a1ea90c85df988e153c19 | |
2931 | 4251 | * configure.ac (languages): Warn and disable langs for which |
2932 | 4252 | requirements are not met. |
2933 | 4253 | |
2934 | 4254 | Cpp: Handle PINENTRY_LAUNCHED status line. |
4255 | + commit 3fad1216770f446a89801d842aa8667356a5ec95 | |
2935 | 4256 | * lang/cpp/src/editinteractor.cpp (EditInteractor::needsNoResponse): |
2936 | 4257 | Add GPGME_STATUS_PINENTRY_LAUNCHED. |
2937 | 4258 | |
2938 | 4259 | 2016-04-12 Andre Heinecke <aheinecke@intevation.de> |
2939 | 4260 | |
2940 | 4261 | Cpp: Add support for pubkey_algo_name. |
4262 | + commit 5489532ad6ccf3a9b59405686b8a17352f1ecf06 | |
2941 | 4263 | * lang/cpp/src/key.cpp (Subkey::algoName): New. |
2942 | 4264 | * lang/cpp/src/key.h: Declare. |
2943 | 4265 | |
2944 | 4266 | Cpp: Add support for gpgme_data_identify. |
4267 | + commit d949d711dc1d944a9d627d39a89af74943a5a8c1 | |
2945 | 4268 | * lang/cpp/src/data.cpp (Data::type): New. |
2946 | 4269 | * lang/cpp/src/data.h (Data::Type): New enum mapping. |
2947 | 4270 | |
2948 | 4271 | Fix configuration without Qt language. |
4272 | + commit 6dba47c3a2c32d7c1e1d91a96030f99f606433ea | |
2949 | 4273 | * configure.ac: Define HAVE_DOXYGEN also if qt should not be built. |
2950 | 4274 | |
2951 | 4275 | 2016-04-11 Andre Heinecke <aheinecke@intevation.de> |
2952 | 4276 | |
2953 | 4277 | Qt/Cpp: Bump so version to 6. |
4278 | + commit 8e7074dbb8093cc342e330bcd6b172b4f769a0c6 | |
2954 | 4279 | * configure.ac (LIBGPGMEPP_LT_CURRENT, LIBQGPGME_LT_CURRENT): Bump. |
2955 | 4280 | |
2956 | 4281 | Qt / Cpp: Mention coding style in READMES. |
4282 | + commit d2b55101195efe9702e855a48fc6e21839fb98cc | |
2957 | 4283 | * src/lang/cpp/README, src/lang/qt/README: Add hacking note. |
2958 | 4284 | |
2959 | 4285 | Qt: Add doc generation with doxygen. |
4286 | + commit a1e95f36ce1895cd9894f6d3ca76640c42c2f9fc | |
2960 | 4287 | * configure.ac: Look for doxygen if qt is built. |
2961 | 4288 | Configure new files. |
2962 | 4289 | * lang/qt/doc/Doxyfile.in: New. |
2964 | 4291 | * lang/qt/README: Update. |
2965 | 4292 | |
2966 | 4293 | Qt: Fix unit test by adding initial.test dep. |
4294 | + commit d9f7a18ed88127e7f05d770d55118d1e928f3b3f | |
2967 | 4295 | * lang/qt/tests/t-keylist.cpp: Verify that GNUPGHOME is set. |
2968 | 4296 | * lang/qt/tests/initial.test: New dummy test. |
2969 | 4297 | * lang/qt/tests/Makefile.am: Add dependency to initial.test |
2970 | 4298 | |
2971 | 4299 | Qt: Remove remaining boost usage. |
4300 | + commit afd8fad6e275e2f74b2ad045dce05d826986e2ec | |
2972 | 4301 | * lang/qt/src/dataprovider.h, |
2973 | 4302 | lang/qt/src/decryptjob.h, |
2974 | 4303 | lang/qt/src/decryptverifyjob.h, |
3002 | 4331 | lang/qt/src/verifyopaquejob.h: Remove boost usage. |
3003 | 4332 | |
3004 | 4333 | Qt: Remove predicates.h and stl_util.h. |
4334 | + commit e18256fc5f613da9406da60c3ef2f84f2be04ef0 | |
3005 | 4335 | * src/lang/qt/predicates.h, src/lang/qt/stl_util.h: Removed. |
3006 | 4336 | |
3007 | 4337 | Qt: Remove usage of stl_util.h and predicates.h. |
4338 | + commit d293bd32293929eeb3f6ec35f916a4678fb51729 | |
3008 | 4339 | * src/lang/qt/qgpgmelistallkeysjob.cpp: Use comperators from |
3009 | 4340 | gpgmepp instead of detail. Remove boost usage. |
3010 | 4341 | |
3011 | 4342 | Cpp: Add string comparators for keys. |
4343 | + commit 1bb162a54ba480413c4da07f2578efe6860494c0 | |
3012 | 4344 | * lang/cpp/src/global.h (GPGMEPP_MAKE_STRCMP): New. |
3013 | 4345 | (_gpgmepp_strcmp): NULL save wrapper around std::strcmp. |
3014 | 4346 | * lang/cpp/src/key.h: Add comparators for various attributes. |
3015 | 4347 | |
3016 | 4348 | Cpp: Remove last usages of boost. |
4349 | + commit 691950e18cf08a3f9bbc2004501834cd47bea579 | |
3017 | 4350 | * lang/cpp/src/configuration.cpp: Use std::remove_pointer. |
3018 | 4351 | (Configuration::operator<<): std::for_each. |
3019 | 4352 | * lang/cpp/src/context.cpp: Delete manually instead of scoped ptr. |
3023 | 4356 | 2016-04-04 Andre Heinecke <aheinecke@intevation.de> |
3024 | 4357 | |
3025 | 4358 | Add pthread in gpgmepp config. |
4359 | + commit cc68ff5f7210ac879fbdf719fcd5944f9ae5602b | |
3026 | 4360 | * lang/cpp/src/GpgmeppConfig.cmake.in.in: Add pthread. |
3027 | 4361 | |
3028 | 4362 | 2016-04-03 Andre Heinecke <aheinecke@intevation.de> |
3029 | 4363 | |
3030 | 4364 | Cpp / Qt: Reduce boost usage (memory and tuple) |
4365 | + commit f98898ab1a6952e0c3a5d235963a27eba2e19e46 | |
3031 | 4366 | * cpp/src/assuanresult.h, |
3032 | 4367 | cpp/src/configuration.cpp, |
3033 | 4368 | cpp/src/configuration.h, |
3099 | 4434 | qt/src/verifyopaquejob.h: Reduce boost usage. |
3100 | 4435 | |
3101 | 4436 | Cpp: Require c++ 11 if cpp binding requested. |
4437 | + commit c07aaef6eb8a9b5e623479f27d562fd1570bf4bb | |
3102 | 4438 | * configure.ac: Call ax_cxx_compile_stdcxx |
3103 | 4439 | * m4/ax_cxx_compile_stdcxx.m4 |
3104 | 4440 | |
3105 | 4441 | Qt: Add static factor methods for protocol. |
4442 | + commit 0991485170ca4ef90fd566540522027d0fc59a72 | |
3106 | 4443 | * lang/qt/src/qgpgmebackend.cpp (QGpgME::openpgp, QGpgME::smime): New. |
3107 | 4444 | * lang/qt/src/qgpgmebackend.h: Declare. |
3108 | 4445 | * lang/qt/tests/t-keylist.cpp (KeyListTest::testSingleKeyListSync): |
3109 | 4446 | Use new functions. |
3110 | 4447 | |
3111 | 4448 | Qt: Add a unit test for qgpgme. |
4449 | + commit faf987dd62893955251378a2a715edd2892a540c | |
3112 | 4450 | * configure.ac: Configure test Makefile. |
3113 | 4451 | * m4/qt.m4: Look up Qt5Test flags. |
3114 | 4452 | * lang/qt/tests/t-keylist.cpp: New. Simple keylist check. |
3115 | 4453 | * lang/qt/tests/Makefile.am: New. General test framework. |
3116 | 4454 | |
3117 | 4455 | Qt: Add missing MOC includes. |
4456 | + commit b7b9e38399a572cb61a297db552026eac5b2a5e1 | |
3118 | 4457 | * qgpgmeadduseridjob.cpp, |
3119 | 4458 | qgpgmechangeexpiryjob.cpp, |
3120 | 4459 | qgpgmechangeownertrustjob.cpp, |
3139 | 4478 | qgpgmeverifyopaquejob.cpp: Add missing MOC includes. |
3140 | 4479 | |
3141 | 4480 | Qt: Declare pure virtuals as such. |
4481 | + commit 0cc9006dbc59d87c6bcda88b36d59dcb69ac35cb | |
3142 | 4482 | * lang/qt/src/qgpgmebackend.h (Protocol): Make all functions |
3143 | 4483 | pure virtual. |
3144 | 4484 | |
3145 | 4485 | Qt: Don't declare showErrorDialog anymore. |
4486 | + commit 3e38cc6fc67c420dec3e9e8afd072b4c8a157c85 | |
3146 | 4487 | * cpp/qt/src/job.h: Remove showErrorDialog. |
3147 | 4488 | |
3148 | 4489 | Qt: Only use GpgME based config class. |
4490 | + commit 7071b2a9c00b85d434d01b6166269ebf48b01b81 | |
3149 | 4491 | * lang/qt/src/qgpgmecryptoconfig.cpp, |
3150 | 4492 | lang/qt/src/qgpgmecryptoconfig.h: Removed. |
3151 | 4493 | * lang/qt/src/qgpgmebackend.cpp: Return newcryptoconfig. |
3153 | 4495 | 2016-04-02 Andre Heinecke <aheinecke@intevation.de> |
3154 | 4496 | |
3155 | 4497 | Add additional include path in config files. |
4498 | + commit 63c115b067400e1b02c7d849c99f54dc9f394d68 | |
3156 | 4499 | * lang/cpp/src/GpgmeppConfig.cmake.in.in |
3157 | 4500 | lang/qt/src/QGpgmeConfig.cmake.in.in: Include directory above headers. |
3158 | 4501 | |
3159 | 4502 | Qt: Fix library name in nodist variable. |
4503 | + commit 576be46f34b42e896a5e3be65560a4b518a758be | |
3160 | 4504 | * lang/qt/Makefile.am (nodist_qgpgme_SOURCES): Change to real name. |
3161 | 4505 | |
3162 | 4506 | Add missing files to QGpgME. |
4507 | + commit a440050fc2c11e4867da9d4707616fa23ac52141 | |
3163 | 4508 | * lang/qt/src/gpgme_backend_debug.cpp, |
3164 | 4509 | lang/qt/src/gpgme_backend_debug.h, |
3165 | 4510 | lang/qt/src/predicates.h, |
3166 | 4511 | lang/qt/src/stl_util.h: New. |
3167 | 4512 | |
3168 | 4513 | Add QGpgME code from libkleo. |
4514 | + commit 226e51052ae73efa8d9f30729b28de68d35231af | |
3169 | 4515 | * lang/qt/src/Makefile.am, |
3170 | 4516 | lang/qt/src/abstractimportjob.h, |
3171 | 4517 | lang/qt/src/adduseridjob.h, |
3252 | 4598 | 2016-03-08 Andre Heinecke <aheinecke@intevation.de> |
3253 | 4599 | |
3254 | 4600 | Add qgpgme as qt language binding. |
4601 | + commit 8347f3d5fc3e476aa767fbbaf09a1310a6154280 | |
3255 | 4602 | * configure.ac: Add version defines. Check for qt if neccessary. |
3256 | 4603 | * lang/README: Mention qt |
3257 | 4604 | * lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove comment. Find qgpgme. |
3268 | 4615 | lang/cpp/src/Makefile.am: Fix generated config file. |
3269 | 4616 | |
3270 | 4617 | Remove obsolete w32-qt code. |
4618 | + commit 58ed9c17f00f420035ecc6973a6c6ed948757a9a | |
3271 | 4619 | * configure.ac (w32-qt): Remove option and Qt checks. |
3272 | 4620 | * src/Makefile.am: Remove BUILD_W32_QT handling. |
3273 | 4621 | * src/kdpipeiodevice.cpp, |
3278 | 4626 | 2016-03-02 Andre Heinecke <aheinecke@intevation.de> |
3279 | 4627 | |
3280 | 4628 | Add version info for gpgmepp. |
4629 | + commit a06603d75e80aba58df58f9a41770c56b6a1f0b8 | |
3281 | 4630 | * lang/cpp/src/Makefile.am (libgpgmepp_la_LDFLAGS): Add version info. |
3282 | 4631 | |
3283 | 4632 | Add cmake configuration files. |
4633 | + commit 77c3fb450c7adf36804a55d76ff49a06a71d22a0 | |
3284 | 4634 | * configure.ac: Add libgpgmepp version. Configure cmake files. |
3285 | 4635 | * lang/cpp/src/Makefile.am: Add targets for cmake files. |
3286 | 4636 | (EXTRA_DIST): Add cmake files. |
3287 | 4637 | |
3288 | 4638 | Fix export header and windows export macros. |
4639 | + commit 98e5b672422ca1e38ca38ff0357cee6cc936aee0 | |
3289 | 4640 | * lang/cpp/src/gpgme_export.h: Fix variable name. Add Windows ifdefs. |
3290 | 4641 | |
3291 | 4642 | Add header installation. |
4643 | + commit c5291a88913ace8f2115021b69c7aeb59b4f79d4 | |
3292 | 4644 | * lang/cpp/src/Makefile.am: Add headers as deps and install them. |
3293 | 4645 | (AM_CPPFLAGS): Add BUILDING_GPGMEPP to be used in export macros. |
3294 | 4646 | |
3295 | 4647 | Add enable-languages build option. |
4648 | + commit a313b3e28cc42785365822519b25d6a87dfdf0c9 | |
3296 | 4649 | * acinclude.m4 (LIST_MEMBER): New macro. |
3297 | 4650 | * configure.ac (enable-languages): New option. Add info output. |
3298 | 4651 | * lang/Makefile.am: Only add enabled language subdirs. |
3300 | 4653 | 2016-02-22 Andre Heinecke <aheinecke@intevation.de> |
3301 | 4654 | |
3302 | 4655 | Add README for gpgmepp. |
4656 | + commit 7286fc7f3d51d475f82c7c9821d031290f5b0066 | |
3303 | 4657 | * lang/README: Note down cpp. |
3304 | 4658 | * cpp/README: Add README based on original repo version. |
3305 | 4659 | |
3306 | 4660 | Add buildsystem for Gpgmepp. |
4661 | + commit f5fd787b5b45cb14d539b5c26f44066eb9ac0f75 | |
3307 | 4662 | * configure.ac: Configure Makefiles. |
3308 | 4663 | * lang/Makefile.am: Add cpp subdir |
3309 | 4664 | * lang/cpp/Makefile.am: New. Add src subdir. |
3310 | 4665 | * lang/cpp/src/Makefile.am: New. Basic buildsystem. |
3311 | 4666 | |
3312 | 4667 | Remove feature check ifdefs. |
4668 | + commit 433bb8e84b2d1e50b5c5b9f7f2006b60cd7d7785 | |
3313 | 4669 | * lang/cpp/src/assuanresult.cpp, |
3314 | 4670 | lang/cpp/src/callbacks.cpp, |
3315 | 4671 | lang/cpp/src/configuration.cpp, |
3339 | 4695 | lang/cpp/src/vfsmountresult.cpp: Remove feature checks. |
3340 | 4696 | |
3341 | 4697 | Initial checkin of gpgmepp sources. |
4698 | + commit 0855a1296a1908016f011eb5e6552854ac53e63a | |
3342 | 4699 | Based on git.kde.org/pim/gpgmepp rev. 0e3ebc02 |
3343 | 4700 | |
3344 | 4701 | * lang/cpp/src/assuanresult.cpp, |
3414 | 4771 | 2016-01-15 Werner Koch <wk@gnupg.org> |
3415 | 4772 | |
3416 | 4773 | Fix possible _SC_OPEN_MAX max problem on AIX. |
4774 | + commit e79199468ac54ce4fe919603ff7bada97267174f | |
3417 | 4775 | * src/posix-io.c [HAVE_STDINT_H]: Include stdint.h. |
3418 | 4776 | (get_max_fds): Limit returned value for too high values. |
3419 | 4777 | |
3420 | 4778 | 2015-12-09 Werner Koch <wk@gnupg.org> |
3421 | 4779 | |
3422 | 4780 | w32: Avoid conflict with Mingw-w64 version 4.0.4-1. |
4781 | + commit 83415dffaea53611dbce77b50d8ddfb2a50aed2e | |
3423 | 4782 | * src/w32-util.c (mkstemp): Rename to my_mkstemp. Change caller. |
3424 | 4783 | |
3425 | 4784 | 2015-12-04 Daiki Ueno <ueno@gnu.org> |
3426 | 4785 | |
3427 | 4786 | Return on user cancellation of delete operation. |
4787 | + commit 67d7f7a9383763b01daf877c846bf3e32f647fa5 | |
3428 | 4788 | * src/delete.c (delete_status_handler): Return on ERROR status, if the |
3429 | 4789 | error location is set to "delete_key.secret" and the code is either |
3430 | 4790 | CANCELED or FULLY_CANCELED, which indicates a situation that the user |
3431 | 4791 | selected "No" on the confirmation dialog. |
3432 | 4792 | |
3433 | 4793 | doc: Fix minor errors. |
4794 | + commit 3b6e9a3d0afcdd3c2f1de19f15924c3404c7140a | |
3434 | 4795 | * doc/gpgme.texi: Fix errors and typos in the cancellation and |
3435 | 4796 | gpgme_import_result_t documentation. |
3436 | 4797 | |
3437 | 4798 | 2015-10-29 Ben Kibbey <bjk@luxsci.net> |
3438 | 4799 | |
3439 | 4800 | Make use of user passphrase handler during passwd. |
4801 | + commit dfa79f9300b837b0f7f2ea44afa589bfcda1dbd9 | |
3440 | 4802 | * src/passwd.c (passwd_start): set engine passphrase command handler. |
3441 | 4803 | |
3442 | 4804 | 2015-10-28 Werner Koch <wk@gnupg.org> |
3443 | 4805 | |
3444 | 4806 | w32: Add extra diagnostic about possible missing gpgme-w32spawn.exe. |
4807 | + commit bb2d11c1eebd4bcfb0f2cfce728026a7420dca47 | |
3445 | 4808 | * src/w32-io.c (_gpgme_io_spawn): Add a new diagnostic. |
3446 | 4809 | |
3447 | 4810 | w32: Improve locating gpgconf on 64 bit systems. |
4811 | + commit a82e9b182f62966207cad0972be6fa284329a5a1 | |
3448 | 4812 | * src/w32-util.c (find_program_at_standard_place): Fallback to |
3449 | 4813 | CSIDL_PROGRAM_FILESX86. |
3450 | 4814 | |
3451 | 4815 | w32: Add new global flag "w32-inst-dir". |
4816 | + commit bb600aa8fd2f9575ee7afc64c978e3e7523b1173 | |
3452 | 4817 | * src/gpgme.c (gpgme_set_global_flag): Add flag "w32-inst-dir"; |
3453 | 4818 | * src/posix-util.c (_gpgme_set_override_inst_dir): New stub. |
3454 | 4819 | * src/w32-util.c (override_inst_dir): New var. |
3458 | 4823 | 2015-10-16 NIIBE Yutaka <gniibe@fsij.org> |
3459 | 4824 | |
3460 | 4825 | cleanup: Fix type mismatch around gpgme_error_t. |
4826 | + commit 0d9d0a6b5b0c6f474a079bbaef11078c5df5f3b5 | |
3461 | 4827 | * src/data-compat.c (gpgme_error_to_errno): Use gpg_err_code |
3462 | 4828 | to get error code from gpgme_error_t. |
3463 | 4829 | * src/gpgme.c (gpgme_new): Don't use gpgme_error. |
3465 | 4831 | 2015-08-31 Werner Koch <wk@gnupg.org> |
3466 | 4832 | |
3467 | 4833 | gpgme-tool: Switch to argparse.c for option parsing. |
4834 | + commit f0ccce855bd99fca7cfbbcafe3544e3113fedc67 | |
3468 | 4835 | * src/argparse.c, src/argparse.h: New. Taken from current gnupg. |
3469 | 4836 | * src/Makefile.am (gpgme_tool_SOURCES): New. |
3470 | 4837 | * src/gpgme-tool.c: Remove all argp.h stuff. |
3474 | 4841 | 2015-08-30 Werner Koch <wk@gnupg.org> |
3475 | 4842 | |
3476 | 4843 | Add gpgme_pubkey_algo_string. |
4844 | + commit c4b6b35bfa98e478f1d13f4ce3e664771f2604c2 | |
3477 | 4845 | * src/gpgme.h.in (GPGME_PK_EDDSA): New. |
3478 | 4846 | (gpgme_pubkey_algo_string): New. |
3479 | 4847 | * src/conversion.c (_gpgme_map_pk_algo): Add new algo. |
3483 | 4851 | 2015-08-26 Werner Koch <wk@gnupg.org> |
3484 | 4852 | |
3485 | 4853 | Release 1.6.0. |
4854 | + commit 107bff70edb611309f627058dd4777a5da084b1a | |
3486 | 4855 | * configure.ac: Set LT version to C25/A14/R0. |
3487 | 4856 | |
3488 | 4857 | Make use of GPGRT macros is available. |
4858 | + commit c4f4b5c0a6fc172f7ceedc1a0021169e7f31b941 | |
3489 | 4859 | * src/gpgme.h.in (_GPGME_INLINE): Define using GPGRT_INLINE if |
3490 | 4860 | possible. Fix problem with -Wundef by adding an extra "defined()". |
3491 | 4861 | (_GPGME_GCC_VERSION): Define using GPGRT_ macro if possible. |
3493 | 4863 | 2015-08-25 Werner Koch <wk@gnupg.org> |
3494 | 4864 | |
3495 | 4865 | Avoid -Wundef warnings if gpgme.h is used by g++. |
4866 | + commit 3f53d3d5d9e73a053b1e89073ef8f7cf01bfc8e6 | |
3496 | 4867 | * src/gpgme.h.in (_GPGME_INLINE): Move definition into the |
3497 | 4868 | extern-C-scope. |
3498 | 4869 | |
3499 | 4870 | Add configure option --enable-build-timestamp. |
4871 | + commit ff91e699f7c14ea6cbc27b487cb40e9f6bd58901 | |
3500 | 4872 | * configure.ac (BUILD_TIMESTAMP): Set to "<none>" by default. |
3501 | 4873 | |
3502 | 4874 | 2015-08-25 Daiki Ueno <ueno@gnu.org> |
3503 | 4875 | |
3504 | 4876 | Relax ttyname_r error checks. |
4877 | + commit 028a0ef3336c5180797fb247448683195376c007 | |
3505 | 4878 | * src/engine-assuan.c (llass_new): Don't treat ttyname_r error as |
3506 | 4879 | fatal. |
3507 | 4880 | * src/engine-g13.c (g13_new): Likewise. |
3512 | 4885 | 2015-08-25 Werner Koch <wk@gnupg.org> |
3513 | 4886 | |
3514 | 4887 | Cleanup layout of gpgme.h. |
4888 | + commit 97f1f3e883808743da5ee144abab25de062f34ac | |
3515 | 4889 | * src/gpgme.h.in: Reorder prototypes. Chnage some comments. |
3516 | 4890 | |
3517 | 4891 | Improve error return by checking the FAILURE status. |
4892 | + commit 8ddc5801ade02297924447df5745c8877a96e5e3 | |
3518 | 4893 | * src/gpgme.h.in (GPGME_STATUS_FAILURE): New. |
3519 | 4894 | * src/status-table.c (FAILURE): New. |
3520 | 4895 | * src/op-support.c (_gpgme_parse_failure): New. |
3535 | 4910 | (_gpgme_verify_status_handler): Parse that code and act upon it on EOF. |
3536 | 4911 | |
3537 | 4912 | tests: Allow using run-sign to test loopback pinentry problems. |
4913 | + commit 491fcd91b84564232d5d061942baa50b99e166c0 | |
3538 | 4914 | * tests/run-sign.c: Add options --status and --loopback. |
3539 | 4915 | |
3540 | 4916 | 2015-08-24 Werner Koch <wk@gnupg.org> |
3541 | 4917 | |
3542 | 4918 | Call status_cb for an ERROR status seen in the passphrase handler. |
4919 | + commit ad46f4f655e653580343c15f1b0b365b7d307d1b | |
3543 | 4920 | * src/passphrase.c (_gpgme_passphrase_status_handler): Call status_cb. |
3544 | 4921 | |
3545 | 4922 | w32: Look for gpgconf in the new GnuPG 2.1 install dir. |
4923 | + commit a7dbab23ea4976d106d649aa515ffb2968a085ed | |
3546 | 4924 | * src/w32-util.c (_gpgme_get_gpgconf_path): Try another location of |
3547 | 4925 | gpgconf.exe. |
3548 | 4926 | |
3549 | 4927 | w32: Expect gpgme-w32spawn.exe only in the gpgme installation dir. |
4928 | + commit 06d6fd8ca01354c8f7cfc847c4ac1b868268cbaa | |
3550 | 4929 | * src/w32-util.c (find_program_at_standard_place): Remove. |
3551 | 4930 | (_gpgme_get_gpg_path): Make the search order more explicit. |
3552 | 4931 | (_gpgme_get_gpgconf_path): Ditto. |
3553 | 4932 | (_gpgme_get_w32spawn_path): Search only in the inst_dir. |
3554 | 4933 | |
3555 | 4934 | w32: Print the installation directory in debug mode. |
4935 | + commit df098d6a437109c57516db75addf3764a6dfda81 | |
3556 | 4936 | * src/debug.c (debug_init) [W32]: Show libgpgme installation dir. |
3557 | 4937 | |
3558 | 4938 | Add an export secret key feature. |
4939 | + commit 2b632bbb78eee2b94c122f66d171a7c80e9c4fb0 | |
3559 | 4940 | * src/gpgme.h.in (GPGME_EXPORT_MODE_SECRET): New. |
3560 | 4941 | (GPGME_EXPORT_MODE_RAW): New. |
3561 | 4942 | (GPGME_EXPORT_MODE_PKCS12): New. |
3570 | 4951 | 2015-08-16 Ben Kibbey <bjk@luxsci.net> |
3571 | 4952 | |
3572 | 4953 | Parse INQUIRE_MAXLEN in the passphrase callback. |
4954 | + commit ccbaccbf2e0ba582d181b9ee4d8543d7c1248b2c | |
3573 | 4955 | * src/passphrase.c (_gpgme_passphrase_status_handler): Parse |
3574 | 4956 | GPGME_STATUS_INQUIRE_MAXLEN. |
3575 | 4957 | * src/passphrase.c (_gpgme_passphrase_command_handler): Send the |
3576 | 4958 | INQUIRE_MAXLEN status message. |
3577 | 4959 | |
3578 | 4960 | Fix gpgme_{get,set}_status_cb to match documentation. |
4961 | + commit 70b3e5964ea0592bd09d1877d720b2c63f501970 | |
3579 | 4962 | * doc/gpgme.texi: Minor fixes. |
3580 | 4963 | * src/gpgme.c (gpgme_get_status_cb): Set return variables to NULL and |
3581 | 4964 | check for a valid ctx pointer. |
3582 | 4965 | |
3583 | 4966 | Parse the INQUIRE_MAXLEN status message. |
4967 | + commit 6dd24c3c6133ec54f75abd056191a8027fe01de0 | |
3584 | 4968 | * src/gpgme.h.in: (gpgme_status_code_t): Add INQUIRE_MAXLEN. |
3585 | 4969 | * src/status-table.c (status_table_s): Ditto. |
3586 | 4970 | * src/genkey.c (genkey_status_handler): Parse INQUIRE_MAXLEN. |
3592 | 4976 | gpgme_status_cb_t. |
3593 | 4977 | |
3594 | 4978 | Add gpgme_set/get_status_cb(). |
4979 | + commit 4fadcf06ec8b0ebfb05c7622dbc3b73fd3c1bad9 | |
3595 | 4980 | * src/gpgme.h.in (gpgme_set_status_cb): New. |
3596 | 4981 | (gpgme_get_status_cb): New. |
3597 | 4982 | (gpgme_status_cb_t): New. |
3604 | 4989 | * doc/gpgme.texi: Document these new functions. |
3605 | 4990 | |
3606 | 4991 | Make use of user passphrase handler during genkey. |
4992 | + commit 2b6ae3dadf4432f7a72fd119144b835f7b1adcc4 | |
3607 | 4993 | * src/genkey.c (genkey_start): set engine passphrase command handler. |
3608 | 4994 | |
3609 | 4995 | 2015-08-12 Ben Kibbey <bjk@luxsci.net> |
3610 | 4996 | |
3611 | 4997 | Also check the return code in gpg_sign(). |
4998 | + commit e07d38f5f9f3b94e403f1265ff7fd3d7009dd557 | |
3612 | 4999 | * src/engine-gpg.c (gpg_sign): Check return value from start(). |
3613 | 5000 | |
3614 | 5001 | 2015-08-11 Ben Kibbey <bjk@luxsci.net> |
3615 | 5002 | |
3616 | 5003 | Check the return value when starting gpg. |
5004 | + commit 8f28e3caf95d7bc99e9271bfc2b44080166af31f | |
3617 | 5005 | * src/engine-gpg.c (gpg_decrypt, gpg_delete, gpg_passwd): Check return |
3618 | 5006 | value of start(). |
3619 | 5007 | |
3620 | 5008 | 2015-08-02 Ben McGinnes <ben@adversary.org> |
3621 | 5009 | |
3622 | 5010 | More GTK2 removal. |
5011 | + commit a7fbd5293ed0ba2c179837a4a2b859376d30e35e | |
3623 | 5012 | * Missed a couple of files, these 2 go for the same reason as the |
3624 | 5013 | previous 3. |
3625 | 5014 | |
3626 | 5015 | Removed GUI examples. |
5016 | + commit 1cd0aef0afb196094d90673002d4c210a04911c9 | |
3627 | 5017 | * GUI examples written with pygtk, which has not been ported to Python |
3628 | 5018 | 3 and won't be as it is for GTK2 and GNOME is moving to GTK3. |
3629 | 5019 | * New GUI examples may be required in future using any of several GUI |
3632 | 5022 | 2015-07-31 Andre Heinecke <aheinecke@intevation.de> |
3633 | 5023 | |
3634 | 5024 | Add offline mode support for CMS keylisting. |
5025 | + commit 08086dd6901740e155e4361212b4e9cff8a47296 | |
3635 | 5026 | * doc/gpgme.texi: Document offline mode. |
3636 | 5027 | * src/context.h (gpgme_context): Add offline. |
3637 | 5028 | * src/engine-backend.h (keylist, keylist_ext): Add engine_flags. |
3652 | 5043 | 2015-07-23 Peter Wu <peter@lekensteyn.nl> |
3653 | 5044 | |
3654 | 5045 | build: ignore scissor line for the commit-msg hook. |
5046 | + commit 157c8be183153ff588f98874a3205aa483d0fd23 | |
3655 | 5047 | * build-aux/git-hooks/commit-msg: Stop processing more lines when the |
3656 | 5048 | scissor line is encountered. |
3657 | 5049 | |
3658 | 5050 | 2015-07-23 Werner Koch <wk@gnupg.org> |
3659 | 5051 | |
3660 | 5052 | Add option --lib-version to gpgme-tool. |
5053 | + commit c23f8897105ce2bb6e62d9c44ca0779fcc08a919 | |
3661 | 5054 | * src/gpgme-tool.c (options, parse_options): Add --lib-version |
3662 | 5055 | (CMD_LIBVERSION): New. |
3663 | 5056 | (main): Implement. |
3665 | 5058 | 2015-06-08 Werner Koch <wk@gnupg.org> |
3666 | 5059 | |
3667 | 5060 | Release 1.5.5. |
5061 | + commit 052a9e3c5671d1ab69551f7b0abd0bbf859d4aba | |
5062 | ||
3668 | 5063 | |
3669 | 5064 | Fix regression with gpgsm 2.0 due to "OPTION with-secret". |
5065 | + commit ddbd54ef881bd2c3481d62b89bef7241667b64ee | |
3670 | 5066 | * src/engine-gpgsm.c (gpgsm_assuan_simple_command): Do not terminate |
3671 | 5067 | on a status lines. |
3672 | 5068 | |
3673 | 5069 | tests: Add option --secret to run-keylist. |
5070 | + commit 7addffc0826e7f36afcc7f66268e9ee2a37e2042 | |
5071 | ||
3674 | 5072 | |
3675 | 5073 | Fix compiler warnings about unused value in TRACE macros. |
5074 | + commit 8b9f84828cd04a7dab37e219123edc1905da8e6b | |
3676 | 5075 | * src/debug.h: Change macros to not have a literal 0 as last |
3677 | 5076 | expression of the comma operator. |
3678 | 5077 | * src/debug.c (_gpgme_debug_frame_end): Return 0. |
3679 | 5078 | (_gpgme_debug): Return 0. |
3680 | 5079 | |
3681 | 5080 | Fix test suite for GnuPG 2.1 which uses pubring.kbx. |
5081 | + commit a5b040cc57c65b3d105666b90c7eb59ee6ff3882 | |
3682 | 5082 | * tests/gpgsm/final.test: New. |
3683 | 5083 | * tests/gpgsm/initial.test: New. |
3684 | 5084 | * tests/gpg/start-stop-agent: Move to ../. |
3696 | 5096 | 2015-06-05 Matthew Barnes <mbarnes@redhat.com> |
3697 | 5097 | |
3698 | 5098 | Set GPGME_SIGSUM_KEY_REVOKED also for gpg. |
5099 | + commit 87d713ff41454bd08a345c63605f6fc7ac854dd4 | |
3699 | 5100 | * src/verify.c (calc_sig_summary): Handle GPG_ERR_CERT_REVOKED. |
3700 | 5101 | |
3701 | 5102 | 2015-06-05 Werner Koch <wk@gnupg.org> |
3702 | 5103 | |
3703 | 5104 | Fix segv for userids with a backslash. |
5105 | + commit 0d28a696163677d6b34a802b6beddecd805d0fc7 | |
3704 | 5106 | * src/engine-gpg.c (gpg_keylist_preprocess): Increment SRC for a |
3705 | 5107 | backslash. |
3706 | 5108 | |
3707 | 5109 | 2015-05-16 Ben McGinnes <ben@adversary.org> |
3708 | 5110 | |
3709 | 5111 | Python 3 port of PyME. |
5112 | + commit 90405ac84b78ba7e5458ea09986749594a01195a | |
3710 | 5113 | * Port of PyME 0.9.0 for Python 2 to Python 3 along with most of the |
3711 | 5114 | example scripts. |
3712 | 5115 | * Intended to be developed in parallel with the original Python 2 |
3719 | 5122 | reference with git commit signatures. |
3720 | 5123 | |
3721 | 5124 | Explaining why not all scripts work. |
5125 | + commit 29887c9b28c0db14bf75e227a8082d23a2c151d2 | |
3722 | 5126 | * Some of them cannot be properly tested on OS X, especially with GTK in |
3723 | 5127 | the mix (it works on OS X, but is unlikely to be as easily accessible |
3724 | 5128 | as Cocoa or Qt). |
3726 | 5130 | false positives of error messages, at least on OS X. |
3727 | 5131 | |
3728 | 5132 | Byte encoding. |
5133 | + commit c39cea7a07cec9ab34cd2026f47b6fba80fea3c8 | |
3729 | 5134 | * More string updates. |
3730 | 5135 | * verifydetails.py still fails, but as Bernhard is still contactable, it |
3731 | 5136 | might be worth him checking on it instead. |
3732 | 5137 | |
3733 | 5138 | No change, note added to explain why. |
5139 | + commit 0e6e6689ef1aea36c1cb3cb47e94f1f2ebbd97cb | |
5140 | ||
3734 | 5141 | |
3735 | 5142 | Strings vs. Bytes. |
5143 | + commit 40290507bcdc63ab9023393d071167d455d70737 | |
3736 | 5144 | * CLI input must be byte encoded. |
3737 | 5145 | |
3738 | 5146 | More byte changes and passphrase changes. |
5147 | + commit 325b0ca341ae3ac8c3232f557ea2c381b4843969 | |
3739 | 5148 | * exportimport works, but will still segfault for an as yet unknown |
3740 | 5149 | reason. |
3741 | 5150 | * genkey produces a traceback error, but does create the key as |
3743 | 5152 | * matched passphrase in signverify. |
3744 | 5153 | |
3745 | 5154 | More bytes good. |
5155 | + commit ba3c9f2617955dc828309a4800e4f5b3f1c3a949 | |
3746 | 5156 | * Another string to byte change. |
3747 | 5157 | |
3748 | 5158 | Updated encrypt-to-all. |
5159 | + commit 1c87ecb86ae364b18f69bca726021271fefaa1c1 | |
3749 | 5160 | * Changed plaintext string to byte literal. |
3750 | 5161 | * Nested key selection in a try/except statement in case of |
3751 | 5162 | UnicodeEncodeError instances. |
3752 | 5163 | * Tested successfully on over 9,000 keys. |
3753 | 5164 | |
3754 | 5165 | Passphrase update. |
5166 | + commit 24c738f5bb5c253a17962c62867d6c847250b41e | |
3755 | 5167 | * Changed example passphrase to something that meets the current minimum |
3756 | 5168 | requirements. |
3757 | 5169 | |
3758 | 5170 | example email. |
5171 | + commit 8345bf6f43c4f671124eaa1b713a7f5ac5780cbd | |
3759 | 5172 | * changed joe@foo.bar to joe@example.org as it is only a matter of time |
3760 | 5173 | before ICANN actually creates bar as a gTLD, if they haven't already. |
3761 | 5174 | |
3762 | 5175 | Updated string and key data. |
5176 | + commit 4fc123981514c7087114e08ee8ca63de1a1db59f | |
3763 | 5177 | * Text changed to byte literals. |
3764 | 5178 | * Changed key type to RSA/RSA. |
3765 | 5179 | * Changed expiry to the future (2020). |
3767 | 5181 | 2015-05-08 Ben McGinnes <ben@adversary.org> |
3768 | 5182 | |
3769 | 5183 | String type. |
5184 | + commit 90079786c5cde4dd8ceb2e0fcda7605b08ccd021 | |
3770 | 5185 | * the plain text string must be bytes and not unicode. |
3771 | 5186 | * Expect most of the example code to have similar issues at present. |
3772 | 5187 | |
3773 | 5188 | 2015-05-05 Ben McGinnes <ben@adversary.org> |
3774 | 5189 | |
3775 | 5190 | Python 3 port of PyME. |
5191 | + commit ebd8734ad705afa4edc409787a00d4968d25e018 | |
3776 | 5192 | * The entirety of the Python 3 port of PyME up to commit |
3777 | 5193 | 2145348ec54c6027f2ea20f695de0277e2871405 |
3778 | 5194 | * The old commit log has been saved as |
3786 | 5202 | 2015-04-13 Werner Koch <wk@gnupg.org> |
3787 | 5203 | |
3788 | 5204 | Release 1.5.4. |
5205 | + commit d2712d9f6f086911184453219a096c61f6829d3b | |
5206 | ||
3789 | 5207 | |
3790 | 5208 | w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll. |
5209 | + commit 524dacfbb6bb131f05a4ecab3d7bcd91c1b43d33 | |
3791 | 5210 | * src/Makefile.am (extra_ltoptions): New. |
3792 | 5211 | (libgpgme_la_LDFLAGS): Use it. |
3793 | 5212 | (libgpgme_pthread_la_LDFLAGS): Ditto. |
3796 | 5215 | 2015-03-16 Werner Koch <wk@gnupg.org> |
3797 | 5216 | |
3798 | 5217 | Fix potential crash in trace macro. |
5218 | + commit 8cfcdfe5564f87362e5ec1bfdca5c14aed9c45f0 | |
3799 | 5219 | * src/signers.c (gpgme_signers_add): Avoid deref of a NULL KEY in the |
3800 | 5220 | trace macro. |
3801 | 5221 | * src/engine-spawn.c (engspawn_release): Remove always true condition. |
3802 | 5222 | * src/engine-gpg.c (gpg_release): Ditto. |
3803 | 5223 | |
3804 | 5224 | Fix one byte too short malloc. |
5225 | + commit 119f27032b822ace8c012b96f9e41bcf23251a54 | |
3805 | 5226 | * src/engine-spawn.c (add_data): Fix malloc |
3806 | 5227 | |
3807 | 5228 | 2015-01-30 Werner Koch <wk@gnupg.org> |
3808 | 5229 | |
3809 | 5230 | Switch to automake 1.14 and update build-aux files. |
5231 | + commit 428ea7696585bc24d127b903840554ca659069b6 | |
5232 | ||
3810 | 5233 | |
3811 | 5234 | 2014-12-11 Werner Koch <wk@gnupg.org> |
3812 | 5235 | |
3813 | 5236 | Release 1.5.3. |
5237 | + commit 37d927a9706fff6d8ef8d45073984ea2f92afb31 | |
3814 | 5238 | * configure.ac: Set LT version to C24/A13/R2. |
3815 | 5239 | |
3816 | 5240 | 2014-12-08 Werner Koch <wk@gnupg.org> |
3817 | 5241 | |
3818 | 5242 | Return an error for some export key operations. |
5243 | + commit 05258d427513a933f01d4df13aca834d797f91e7 | |
3819 | 5244 | * src/context.h (OPDATA_EXPORT): New. |
3820 | 5245 | * src/export.c (op_data_t): New. |
3821 | 5246 | (release_op_data): New. |
3828 | 5253 | 2014-11-21 Werner Koch <wk@gnupg.org> |
3829 | 5254 | |
3830 | 5255 | Release 1.5.2. |
5256 | + commit c62ce32b9c01ee9ceb1d69e7344fb79a9162d232 | |
3831 | 5257 | * configure.ac: Set LT version to C24/A13/R1. |
3832 | 5258 | |
3833 | 5259 | Update the previous commit. |
5260 | + commit 81ce87111f5a3f966188629abb07a4d0702e6db0 | |
3834 | 5261 | * src/sign.c (gpgme_op_sign_result): Reformat and take care of failed |
3835 | 5262 | malloc. |
3836 | 5263 | |
3837 | 5264 | 2014-11-21 Ben Kibbey <bjk@luxsci.net> |
3838 | 5265 | |
3839 | 5266 | Fix returning new signatures when there are none. |
5267 | + commit 5942b0c7e0593b82b4c4a142c214d7a2649de104 | |
3840 | 5268 | * src/sign.c (gpgme_op_sign_result): Test that invalid and valid |
3841 | 5269 | signatures add up to gpgme_signers_count(). |
3842 | 5270 | |
3843 | 5271 | 2014-11-06 Werner Koch <wk@gnupg.org> |
3844 | 5272 | |
3845 | 5273 | Improve the debug output a bit. |
5274 | + commit 8031341283f4fcb1f226aa6f66bc5a6042586815 | |
3846 | 5275 | * src/debug.h (TRACE_ERR): Include the line number in the output. |
3847 | 5276 | |
3848 | 5277 | 2014-10-02 Werner Koch <wk@gnupg.org> |
3849 | 5278 | |
3850 | 5279 | build: Implement SYSROOT feature. |
5280 | + commit 4027a0a89724df3aeef8a964c529548d724b6a5a | |
3851 | 5281 | * configure.ac: Document SYSROOT. |
3852 | 5282 | * m4/gpg-error.m4: Update from libgpg-error master. |
3853 | 5283 | * src/gpgme.m4: Implement SYSROOT stuff. |
3855 | 5285 | 2014-09-24 Werner Koch <wk@gnupg.org> |
3856 | 5286 | |
3857 | 5287 | tests: Delay some test file extraction until "make check". |
5288 | + commit 2e8ecc24cf74f918c303c315da3bb18636a5e288 | |
3858 | 5289 | * tests/gpg/Makefile.am (all-local): Change to check-local. |
3859 | 5290 | * tests/gpgsm/Makefile.am (all-local): Ditto. |
3860 | 5291 | |
3861 | 5292 | 2014-09-24 Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
3862 | 5293 | |
3863 | 5294 | Clean up gpgme's tests/gpg when gpg2.1 is available. |
5295 | + commit 36997e0f746ce2d38de997055141542583cc0f52 | |
3864 | 5296 | * tests/gpg/Makefile.am: Clean up .gpg-v21-migrated |
3865 | 5297 | |
3866 | 5298 | 2014-08-12 Werner Koch <wk@gnupg.org> |
3867 | 5299 | |
3868 | 5300 | gpgme-tool: Print fingerprint and keyid with keyservers. |
5301 | + commit 4160ef90a1b1b778c735f31f98a6966ba3b3ea90 | |
3869 | 5302 | * src/gpgme-tool.c (cmd_keylist): Print keyid. Print FPR only if |
3870 | 5303 | available. |
3871 | 5304 | |
3872 | 5305 | Handle modern keyserver output which may emit the fingerprint. |
5306 | + commit 3450bff52baef2c14118958cf79ead46940d58f0 | |
3873 | 5307 | * src/engine-gpg.c (read_colon_line): Split preprocessed lines. |
3874 | 5308 | (gpg_keylist_preprocess): Limit keyid field and print fingerprint. |
3875 | 5309 | |
3876 | 5310 | gpgme-tool: Install gpgme-tool. |
5311 | + commit 488e44cdb531035fa8813b95b212f9728abc7e62 | |
3877 | 5312 | * src/Makefile.am (bin_PROGRAMS): New. Add gpgme-tools. |
3878 | 5313 | (noinst_PROGRAMS): Remove. |
3879 | 5314 | |
3880 | 5315 | gpgme-tool: Fix segv for external key listing. |
5316 | + commit e5ab11607281b9838da2728268a8f9f0daa2b04d | |
3881 | 5317 | * src/gpgme-tool.c (result_xml_escape): Allow for DATA being NULL. |
3882 | 5318 | |
3883 | 5319 | 2014-07-30 Werner Koch <wk@gnupg.org> |
3884 | 5320 | |
3885 | 5321 | Release 1.5.1. |
5322 | + commit 16835c3b5d1cea18512b2c93e884d8ca513a2ee7 | |
3886 | 5323 | * configure.ac: Change LT version to C24/A13/R0. |
3887 | 5324 | |
3888 | 5325 | Fix possible realloc overflow for gpgsm and uiserver engines. |
5326 | + commit 2cbd76f7911fc215845e89b50d6af5ff4a83dd77 | |
3889 | 5327 | * src/engine-gpgsm.c (status_handler): |
3890 | 5328 | * src/engine-uiserver.c (status_handler): |
3891 | 5329 | |
3892 | 5330 | 2014-06-26 Werner Koch <wk@gnupg.org> |
3893 | 5331 | |
3894 | 5332 | w32: Get IOSPAWN flag back in sync with spawn helper. |
5333 | + commit 68116fa5f67238a60bb8be375cc959262fa021d3 | |
3895 | 5334 | * src/gpgme-w32spawn.c: Include priv-io.h. |
3896 | 5335 | |
3897 | 5336 | 2014-06-10 Werner Koch <wk@gnupg.org> |
3898 | 5337 | |
3899 | 5338 | Add new reason codes to the INV_RECP status code. |
5339 | + commit 86260b47c9e306e325103d1af767842357647e60 | |
3900 | 5340 | * src/op-support.c (_gpgme_parse_inv_recp): Add codes 13 and 14. |
3901 | 5341 | |
3902 | 5342 | 2014-06-04 Werner Koch <wk@gnupg.org> |
3903 | 5343 | |
3904 | 5344 | Add new keylist mode GPGME_KEYLIST_MODE_WITH_SECRET. |
5345 | + commit 4dc9af24156b4fd52c7b76e7522b9b7a64e5386a | |
3905 | 5346 | * src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_SECRET): New. |
3906 | 5347 | * src/engine-gpg.c (gpg_keylist_build_options): Handle new mode. |
3907 | 5348 | * src/engine-gpgsm.c (gpgsm_keylist, gpgsm_keylist_ext): Ditto. |
3914 | 5355 | 2014-05-21 Werner Koch <wk@gnupg.org> |
3915 | 5356 | |
3916 | 5357 | Release 1.5.0. |
5358 | + commit 0eca21113c1d1ab2aea58e1ea21075f472f99c23 | |
3917 | 5359 | * configure.ac: Change LT version to C22/A11/R0. |
3918 | 5360 | |
3919 | 5361 | 2014-05-13 Werner Koch <wk@gnupg.org> |
3920 | 5362 | |
3921 | 5363 | Add 6 new GPGME_STATUS_ codes. |
5364 | + commit de6caeed6d6432101c673c35717f152d5facf823 | |
3922 | 5365 | * src/status-table.c: Also add missing DECRYPTION_INFO entry. |
3923 | 5366 | |
3924 | 5367 | 2014-05-08 Werner Koch <wk@gnupg.org> |
3925 | 5368 | |
3926 | 5369 | Add field CURVE to the key info. |
5370 | + commit 88f15336ec0eadde68ff2618349efb9006b8e801 | |
3927 | 5371 | * src/gpgme.h.in (struct _gpgme_subkey): Add field CURVE. |
3928 | 5372 | * src/key.c (gpgme_key_unref): Free CURVE. |
3929 | 5373 | * src/keylist.c (keylist_colon_handler): Set CURVE. |
3932 | 5376 | engine info after freeing. |
3933 | 5377 | |
3934 | 5378 | Fix a memory access and a double slash bug. |
5379 | + commit de4a1ea684e1591975feb801e7651309e1ee2c49 | |
3935 | 5380 | * src/engine-spawn.c (engspawn_start): Allocate space for list |
3936 | 5381 | terminator. |
3937 | 5382 | * src/posix-util.c (walk_path): Fix trailing slash detection. |
3938 | 5383 | |
3939 | 5384 | Map public key algos returned by gpg to gpgme values. |
5385 | + commit d5fb92cdaed21eea2f1a921e4f11df72635a8462 | |
3940 | 5386 | * src/conversion.c (_gpgme_map_pk_algo): New. |
3941 | 5387 | * src/decrypt.c (parse_enc_to): Add arg PROTOCOL and map pubkey algo. |
3942 | 5388 | (_gpgme_decrypt_status_handler): Map pubkey algo. |
3952 | 5398 | (gpgme_hash_algo_name): Add GPGME_MD_SHA224. |
3953 | 5399 | |
3954 | 5400 | Add GPGME_ENCRYPT_NO_COMPRESS flag. |
5401 | + commit 991cde9e79fec70aad093ded383c5574d30f9388 | |
3955 | 5402 | * src/gpgme.h.in (GPGME_ENCRYPT_NO_COMPRESS): New. |
3956 | 5403 | * src/engine-gpg.c (gpg_encrypt, gpg_encrypt_sign): Implement it. |
3957 | 5404 | * src/gpgme-tool.c (_cmd_sign_encrypt): Add option --no-compress. |
3959 | 5406 | 2014-04-16 Werner Koch <wk@gnupg.org> |
3960 | 5407 | |
3961 | 5408 | w32: Fix another memleak on error. |
5409 | + commit 62711e5614e44e65a7c7bb7d21493d09d3081271 | |
3962 | 5410 | * src/w32-io.c (create_reader): free CTX. |
3963 | 5411 | |
3964 | 5412 | 2014-04-15 Werner Koch <wk@gnupg.org> |
3965 | 5413 | |
3966 | 5414 | w32: Fix memleak in an error code paths. |
5415 | + commit 85a07ca7e3dffdefc8ae74beebb59e47a6e6bd1b | |
3967 | 5416 | * src/w32-io.c (create_writer): Free CTX in cased of bad FD. |
3968 | 5417 | * src/w32-util.c (_gpgme_mkstemp): Free TMPNAME in case of a failed |
3969 | 5418 | mkstemp. |
3970 | 5419 | |
3971 | 5420 | Fix possible zombie processes. |
5421 | + commit 2bb26185e3b9a048033c559517d6ba7d2eb47066 | |
3972 | 5422 | * src/posix-io.c (_gpgme_io_waitpid): Protect waitpid agains EINTR. |
3973 | 5423 | (_gpgme_io_dup): Likewise. |
3974 | 5424 | (_gpgme_io_connect): Likewise. |
3976 | 5426 | 2014-04-10 Werner Koch <wk@gnupg.org> |
3977 | 5427 | |
3978 | 5428 | Actually implement flags for gpgme_op_spawn. |
5429 | + commit d3bd8fff863f62b6d0e228aea754efbbde861e9a | |
3979 | 5430 | * src/spawn.c (gpgme_op_spawn_start, gpgme_op_spawn): Pass FLAGS dow |
3980 | 5431 | to spawn_start and add FLAGS args along the call path. |
3981 | 5432 | * src/engine-spawn.c (engspawn_start): Hack to automagically provide |
3982 | 5433 | argv[0]. |
3983 | 5434 | |
3984 | 5435 | Add GPGME_PROTOCOL_SPAWN and gpgme_op_spawn. |
5436 | + commit 4f2d652e60700e03809307a10015ff9003ac3579 | |
3985 | 5437 | * src/gpgme.h.in (GPGME_PROTOCOL_SPAWN): New. |
3986 | 5438 | (GPGME_SPAWN_DETACHED, GPGME_SPAWN_ALLOW_SET_FG): New. |
3987 | 5439 | * src/gpgme.c (gpgme_set_protocol): Add new protocol. |
3999 | 5451 | (gt_spawn, cmd_spawn): New. |
4000 | 5452 | |
4001 | 5453 | Add gpgme_get_dirinfo. |
5454 | + commit 77931a9a1468b0cfbaafd4153867d90764a6d258 | |
4002 | 5455 | * src/dirinfo.c (gpgme_get_dirinfo): New. |
4003 | 5456 | * tests/t-engine-info.c (main): Print results from that function. |
4004 | 5457 | |
4005 | 5458 | Make use of internal iospawn flags more flexible. |
5459 | + commit 443f6b76a964b77e2e61c03592a83ffa0a6da4b1 | |
4006 | 5460 | * src/priv-io.h (IOSPAWN_FLAG_DETACHED): New. Renumber the others. |
4007 | 5461 | * src/w32-io.c (_gpgme_io_spawn): Use DETACHED_PROCESS process only if |
4008 | 5462 | IOSPAWN_FLAG_DETACHED is given. |
4015 | 5469 | * src/version.c (_gpgme_get_program_version): Ditto. |
4016 | 5470 | |
4017 | 5471 | Make sure a spawned process has all standard fds connected. |
5472 | + commit 617d3be629229cbebfdc2d26a4e854bc4fe38a68 | |
4018 | 5473 | * src/posix-io.c (_gpgme_io_spawn): dup /dev/null also to unsued |
4019 | 5474 | stdout. |
4020 | 5475 | |
4021 | 5476 | 2014-03-13 Werner Koch <wk@gnupg.org> |
4022 | 5477 | |
4023 | 5478 | Add configure option --enable-fixed-path. |
5479 | + commit 766355b5d4f63261c428531fdbdafb8b67de9369 | |
4024 | 5480 | * configure.ac: Add option --enable-fixed-path. |
4025 | 5481 | (FIXED_SEARCH_PATH): New ac_define. |
4026 | 5482 | * src/posix-util.c (walk_path): Make use of the option. Remove |
4029 | 5485 | 2014-03-11 Werner Koch <wk@gnupg.org> |
4030 | 5486 | |
4031 | 5487 | Avoid pointer arithmetic on void pointer. |
5488 | + commit dd9c8c56719db093b8daa23aa40b2be71bbd1526 | |
4032 | 5489 | * src/gpgme.c (gpgme_io_writen): Use new var buffer. |
4033 | 5490 | |
4034 | 5491 | Change implementation return type to match the definition. |
5492 | + commit 75a6255935f450d56f3637cbb2b6c8161ace57ab | |
4035 | 5493 | * src/gpgme.c (gpgme_get_sub_protocol): Change return type to |
4036 | 5494 | gpgme_protocol_t. |
4037 | 5495 | |
4038 | 5496 | 2014-03-05 Daiki Ueno <ueno@gnu.org> |
4039 | 5497 | |
4040 | 5498 | doc: Fix documentation of struct data types. |
5499 | + commit 40938feb3f3393b0cdc6ec61ca2e77ff0b82c69a | |
4041 | 5500 | * gpgme.texi (Key Management): Document is_cardkey and card_number |
4042 | 5501 | members of gpgme_subkey_t. |
4043 | 5502 | (Decrypt): Remove description of the non-existent wrong_key_usage |
4050 | 5509 | 2014-02-21 Werner Koch <wk@gnupg.org> |
4051 | 5510 | |
4052 | 5511 | Always pass correct name to argv[0]. Ignore GPG_AGENT_INFO for gpg2. |
5512 | + commit 651d9e1c6bc1cab248024c3850ef64698247588f | |
4053 | 5513 | * src/dirinfo.c (WANT_GPG_ONE_MODE): New. |
4054 | 5514 | (struct dirinfo): Add field "gpg_one_mode". |
4055 | 5515 | (get_gpgconf_item): Set that field and return it if requested. |
4066 | 5526 | 2014-02-12 Werner Koch <wk@gnupg.org> |
4067 | 5527 | |
4068 | 5528 | Fix type inconsistency between gpgme.h and gpgme.c. |
5529 | + commit f916ab753b7d17210cd455666870038949f72851 | |
4069 | 5530 | * src/gpgme.c (gpgme_set_pinentry_mode): Fix type of MODE. |
4070 | 5531 | |
4071 | 5532 | 2014-01-10 Werner Koch <wk@gnupg.org> |
4072 | 5533 | |
4073 | 5534 | Use the generic autogen.sh script. |
5535 | + commit 1a504aab384947c1a6e949affd14bc696297fc8d | |
4074 | 5536 | * autogen.rc: New. |
4075 | 5537 | * Makefile.am (EXTRA_DIST): Add it. |
4076 | 5538 | * autogen.sh: Update from GnuPG. |
4080 | 5542 | 2014-01-07 Werner Koch <wk@gnupg.org> |
4081 | 5543 | |
4082 | 5544 | Make gpgconf engine work again - fixes 02ba35c1. |
5545 | + commit ab6e718327451e418782990c5a0a4e72588e3f0b | |
4083 | 5546 | * src/gpgconf.c: Remove ENABLE_GPGCONF and move prototypes to ... |
4084 | 5547 | * src/engine-backend.h: ... here. |
4085 | 5548 | |
4086 | 5549 | Make gpgme_new return a proper error if no engines are installed. |
5550 | + commit 121efcc5618374a1b4450b1d6a18bb3c35edb1fd | |
4087 | 5551 | * src/engine.c (gpgme_get_engine_info): Improve error handling. |
4088 | 5552 | (_gpgme_engine_info_copy): Ditto. |
4089 | 5553 | * src/gpgme.c (gpgme_new): Return error GPG_ERR_NO_ENGINE. |
4090 | 5554 | |
4091 | 5555 | Print the full PATH in the log if gpg was not found. |
5556 | + commit d63058b852b83515e7715103c04a684ecf59838a | |
4092 | 5557 | * src/posix-util.c (walk_path): Keep a copy of PATH. |
4093 | 5558 | |
4094 | 5559 | 2014-01-06 Werner Koch <wk@gnupg.org> |
4095 | 5560 | |
4096 | 5561 | Add global flags disable-gpgconf, gpgconf-name, and gpg-name. |
5562 | + commit 6564e5e78e8c6e5a120675a5699b5b75248cfbc7 | |
4097 | 5563 | * src/gpgme.c (gpgme_set_global_flag): Add names "disable-gpgconf", |
4098 | 5564 | "gpgconf-name", and "gpg-name". |
4099 | 5565 | * src/dirinfo.c (_gpgme_dirinfo_disable_gpgconf): New. |
4116 | 5582 | 2013-12-27 Werner Koch <wk@gnupg.org> |
4117 | 5583 | |
4118 | 5584 | Locate engine names only at runtime and prefer GnuPG-2. |
5585 | + commit 02ba35c1b6a2cbb3361b2f2ad507c53564b2be0b | |
4119 | 5586 | * configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION) |
4120 | 5587 | (NEED_G13_VERSION, NEED_GPGCONF_VERSION): Remove vars and all related |
4121 | 5588 | checks. Do not check for any engine version. |
4150 | 5617 | 2013-08-19 Werner Koch <wk@gnupg.org> |
4151 | 5618 | |
4152 | 5619 | Document API change for GPGME_EVENT_DONE from 2009. |
5620 | + commit b0aaa3f9aef36634b5c391812362f016114f02ba | |
4153 | 5621 | * doc/gpgme.texi (I/O Callback Interface): Fix description for the |
4154 | 5622 | event arg. |
4155 | 5623 | |
4156 | 5624 | Fix possible segv in the gpgme_op_card_edit. |
5625 | + commit 372bd439834c69d502668007c8c683233d676bd5 | |
4157 | 5626 | * src/edit.c (gpgme_op_edit_start, gpgme_op_card_edit_start): Do not |
4158 | 5627 | deref a NULL KEY in TRACE_BEG. |
4159 | 5628 | |
4160 | 5629 | tests: Fix NULL ptr deref in gpgsm/t-verify. |
5630 | + commit eae9c32bd9c80ca4a4ecf794808211808f2ebbdd | |
4161 | 5631 | * tests/gpgsm/t-verify.c (check_result): Do not dereference a sig or |
4162 | 5632 | sig->fpr if NULL. |
4163 | 5633 | |
4164 | 5634 | 2013-08-12 Werner Koch <wk@gnupg.org> |
4165 | 5635 | |
4166 | 5636 | Release 1.4.3. |
5637 | + commit d788c35e19df9eade8eb0b880ca1dc47ae7928ad | |
4167 | 5638 | * configure.ac: Change LT version to C22/A11/R0. |
4168 | 5639 | |
4169 | 5640 | Make test suite workable with GnuPG 2.1. |
5641 | + commit 3ca7e96e384d5872c71ceb3b2e2a05b0c1b7e1a0 | |
4170 | 5642 | * tests/gpg/start-stop-agent: New. |
4171 | 5643 | * tests/gpg/initial.test: New. |
4172 | 5644 | * tests/gpg/final.test: New. |
4185 | 5657 | * tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD: New. |
4186 | 5658 | |
4187 | 5659 | Improve detection of default gpg by configure. |
5660 | + commit 069ac580373923f5635b7172ecff79eb189f6944 | |
4188 | 5661 | * configure.ac: Move test for gpgconf before test for gpg. |
4189 | 5662 | (GPG, GPGSM, G13): Use gpgconf instead of AC_PATH_PROG if possible. |
4190 | 5663 | |
4191 | 5664 | 2013-08-09 Werner Koch <wk@gnupg.org> |
4192 | 5665 | |
4193 | 5666 | Add function gpgme_data_identify. |
5667 | + commit 8579091c4f6a36e6bb06fcfbd147a776166fd3ea | |
4194 | 5668 | * src/gpgme.h.in (gpgme_data_type_t): New. |
4195 | 5669 | (gpgme_data_identify): New prototype. |
4196 | 5670 | * src/data-identify.c: New. |
4205 | 5679 | 2013-08-02 Werner Koch <wk@gnupg.org> |
4206 | 5680 | |
4207 | 5681 | Prefer GnuPG-2 engines over GnuPG-1. |
5682 | + commit a4c80126ae4754c8478c69a8a24a6ffd975485fc | |
4208 | 5683 | * src/util.h: Move some prototypes to ... |
4209 | 5684 | * src/sys-util.h: New. |
4210 | 5685 | * src/Makefile.am (main_sources): Add sys-util.h. |
4231 | 5706 | (_gpgme_get_uiserver_socket_path): Remove. |
4232 | 5707 | |
4233 | 5708 | w32: Try to locate gpg in the gpgme installation dir. |
5709 | + commit 3881ea4e83d1533ef497b7332398fc1850e29205 | |
4234 | 5710 | * src/w32-util.c (my_hmodule): New. |
4235 | 5711 | (wchar_to_utf8): New. |
4236 | 5712 | (DllMain): New. |
4245 | 5721 | 2013-07-31 Werner Koch <wk@gnupg.org> |
4246 | 5722 | |
4247 | 5723 | doc: Add --binary option for the OUTPUT command of an uiserver. |
5724 | + commit 393a9471f2f3ac0a5b14f3534a5bfc7ffe948567 | |
5725 | ||
4248 | 5726 | |
4249 | 5727 | 2013-06-18 Werner Koch <wk@gnupg.org> |
4250 | 5728 | |
4251 | 5729 | Add function gpgme_signers_count. |
5730 | + commit f2eeccbdfaf855a81abb92abe5ab4c702712bac7 | |
4252 | 5731 | * src/signers.c (gpgme_signers_count): New. |
4253 | 5732 | * src/libgpgme.vers, src/gpgme.def: Add as external symbol. |
4254 | 5733 | * src/gpgme.h.in: Add prototype. |
4256 | 5735 | 2013-05-28 Werner Koch <wk@gnupg.org> |
4257 | 5736 | |
4258 | 5737 | Release 1.4.2. |
5738 | + commit 009e26a989f8a251563303f155c51fe012af52a4 | |
4259 | 5739 | * configure.ac: Set LT version to C21/A10/R0. |
4260 | 5740 | |
4261 | 5741 | Add convenience macro GPGME_PROTOCOL_OPENPGP. |
5742 | + commit 2e8feb6016dede400053f76fc3a418e1dd567bef | |
4262 | 5743 | * src/gpgme.h.in (GPGME_PROTOCOL_OPENPGP): New. |
4263 | 5744 | |
4264 | 5745 | 2013-05-23 Werner Koch <wk@gnupg.org> |
4265 | 5746 | |
4266 | 5747 | w32: Fix installing of .def file. |
5748 | + commit c29dad2315406bed75b9547103650bef642e6aa7 | |
4267 | 5749 | * src/Makefile.am (install-def-file): Create libdir first. |
4268 | 5750 | |
4269 | 5751 | Fix libtool 2.4.2 to correctly detect .def files. |
5752 | + commit d739d4d8cf9c873b0f3bb7836aaf3d0ba31a7b7f | |
4270 | 5753 | * build-aux/ltmain.sh (sed_uncomment_deffile): New. |
4271 | 5754 | (orig_export_symbols): Uncomment def file before testing for EXPORTS. |
4272 | 5755 | * m4/libtool.m4: Do the same for the generated code. |
4274 | 5757 | 2013-05-22 Werner Koch <wk@gnupg.org> |
4275 | 5758 | |
4276 | 5759 | Support --no-encrypt-to also with gpgme_op_encrypt_sign. |
5760 | + commit d4371ed30da2e8b3d9f440613af299a952bde2b1 | |
4277 | 5761 | * src/engine-gpg.c (gpg_encrypt_sign): Support the |
4278 | 5762 | GPGME_ENCRYPT_NO_ENCRYPT_TO flag. |
4279 | 5763 | |
4281 | 5765 | Kyle L. Huff <g10bts@curetheitch.com> |
4282 | 5766 | |
4283 | 5767 | Allow symmetric encryption with gpgme_op_encrypt_sign. |
5768 | + commit 567e6481d767af60390d649897b897a8b0e7e9a5 | |
4284 | 5769 | * src/encrypt-sign.c (encrypt_sym_status_handler): New. |
4285 | 5770 | (encrypt_sign_start): Handle recp == NULL case. |
4286 | 5771 | * src/engine-gpg.c (gpg_encrypt_sign): Implement symmetric encryption. |
4289 | 5774 | 2013-05-22 Werner Koch <wk@gnupg.org> |
4290 | 5775 | |
4291 | 5776 | gpgme-tool: Allow for symmetric encryption. |
5777 | + commit 0c1de7abd57b677998792e6cd5df5ddfb6e451b7 | |
4292 | 5778 | * src/gpgme-tool.c (gt_sign_encrypt): Pass NULL for recp if no |
4293 | 5779 | recipients are given. |
4294 | 5780 | |
4295 | 5781 | tests: Print auditlog in plain text format. |
5782 | + commit 18254f88f82da7542a986dca60917fb48d5bccd3 | |
4296 | 5783 | * tests/gpgsm/t-verify.c (show_auditlog): Use plain text format. |
4297 | 5784 | |
4298 | 5785 | 2013-05-18 Werner Koch <wk@gnupg.org> |
4299 | 5786 | |
4300 | 5787 | Improve C++ compatibility of previous patch. |
5788 | + commit e99356306d7bda61802530ebeb07d9ba73c4dec0 | |
4301 | 5789 | * src/gpgme.h.in: Move gpgme_sssize_t and gpgme_off_t typedefs into |
4302 | 5790 | the extern "C" scope. |
4303 | 5791 | |
4304 | 5792 | 2013-05-16 Werner Koch <wk@gnupg.org> |
4305 | 5793 | |
4306 | 5794 | Make definition of off_t robust against misbehaving w32 toolchains. |
5795 | + commit 6d0d8e7ba0bb989c251545fa8af35b97d1a703ba | |
4307 | 5796 | * configure.ac (NEED__FILE_OFFSET_BITS): Change to define gpgme_off_t |
4308 | 5797 | and gpgme_ssize_t. |
4309 | 5798 | (API__OFF_T, API__SSIZE_T): New ac_subst. |
4318 | 5807 | 2013-05-11 Werner Koch <wk@gnupg.org> |
4319 | 5808 | |
4320 | 5809 | w32: Change the way the I/O threads are cleaned up. |
5810 | + commit 9e7df9aa6d81f0abbabb03a2346d80eb5d375f81 | |
4321 | 5811 | * src/w32-io.c (reader_context_s, create_reader) |
4322 | 5812 | (writer_context_s, create_writer): Rename STOPPED to CLOSE_EV. |
4323 | 5813 | (reader, writer): Remove setting of STOPPED. Wait for CLOSE_EV and |
4329 | 5819 | 2013-05-08 Werner Koch <wk@gnupg.org> |
4330 | 5820 | |
4331 | 5821 | Fix hang in socket closing. |
5822 | + commit 9f330be8210d2498fe93d4166b6f6c02fca76475 | |
4332 | 5823 | * src/w32-io.c (destroy_reader): Call shutdown. |
4333 | 5824 | (reader): Do not print an error in the shutdown case. |
4334 | 5825 | |
4335 | 5826 | Improve debug output of the I/O reader and writer. |
5827 | + commit 2118f497010a9a41c29d062a7605ff2e136f8f4e | |
4336 | 5828 | * src/w32-io.c (reader, writer): Also print file_sock. |
4337 | 5829 | |
4338 | 5830 | 2013-05-06 Werner Koch <wk@gnupg.org> |
4339 | 5831 | |
4340 | 5832 | Simplify a debug code function. |
5833 | + commit a7e5f1096f02af7bfb678b0bea8da6ccfc28cc79 | |
4341 | 5834 | * src/debug.c (_gpgme_debug): Remove static space string. |
4342 | 5835 | |
4343 | 5836 | 2013-05-01 Werner Koch <wk@gnupg.org> |
4344 | 5837 | |
4345 | 5838 | Release 1.4.1. |
5839 | + commit 5075c0da7c464af2a45cd36db134ed7e88f155af | |
4346 | 5840 | * configure.ac: Bump LT version to C20/A9/R1. |
4347 | 5841 | |
4348 | 5842 | Disable fd-passing for Apple. |
5843 | + commit ef5b4ae37d13142e89a051908dc080cda3d24baa | |
4349 | 5844 | * configure.ac: Disable fd-passing by default for Apple. |
4350 | 5845 | |
4351 | 5846 | 2013-04-30 Werner Koch <wk@gnupg.org> |
4352 | 5847 | |
4353 | 5848 | Allow reading of long gpgconf output lines. |
5849 | + commit f623a6b94c527795d0b6f7e66a3966e5d9e1c454 | |
4354 | 5850 | * src/engine-gpgconf.c (gpgconf_read): Rewrite to allow for line |
4355 | 5851 | lengths up to 64k. |
4356 | 5852 | |
4357 | 5853 | 2013-04-29 Werner Koch <wk@gnupg.org> |
4358 | 5854 | |
4359 | 5855 | Fix for i686-w64-mingw32. |
5856 | + commit 867b950b9306904a0ff522d0ef4a43789393cfc4 | |
4360 | 5857 | * configure.ac (NEED__FILE_OFFSET_BITS): Do not define under Windows. |
4361 | 5858 | |
4362 | 5859 | 2013-02-26 Werner Koch <wk@gnupg.org> |
4363 | 5860 | |
4364 | 5861 | Release 1.4.0. |
5862 | + commit ef5cd38123dfbef7843f374ee697b0b5e8730c46 | |
4365 | 5863 | * configure.ac: Bump LT version to C20/A9/R0. |
4366 | 5864 | |
4367 | 5865 | Enable FD passing and thus building of the UI-server. |
5866 | + commit 5090f6f246bfad2eb80f3cc222963f73996d8028 | |
4368 | 5867 | * configure.ac: Make --enable-fd-passing the default. |
4369 | 5868 | * src/engine-uiserver.c (_gpgme_engine_ops_uiserver): Syntax fix. |
4370 | 5869 | |
4371 | 5870 | w32: Hacks for building with 32 bit mingw64. |
5871 | + commit cdae524b282ef0ea67c3880b3e0f852c84c351ce | |
4372 | 5872 | * configure.ac (INSERT__TYPEDEFS_FOR_GPGME_H): Add hacks for 32 bit |
4373 | 5873 | mingw64. |
4374 | 5874 | * src/util.h [W32]: Include winsock2.h before windows to make mingw64 |
4376 | 5876 | * src/w32-util.c (_WIN32_IE): Need to use 5.1 for mingw64. |
4377 | 5877 | |
4378 | 5878 | Improve missing libgpg-error reporting in configure. |
5879 | + commit 787b5f14b933e5cee2624f79a23a60947f8134c8 | |
4379 | 5880 | * configure.ac (NEED_GPG_ERROR_VERSION): New. Improve reporting for |
4380 | 5881 | missing libgpg-error. |
4381 | 5882 | |
4382 | 5883 | Change the various version numbers to the new scheme. |
5884 | + commit d8b46c919f45666af0d541e00dcedf57e6c4b66f | |
4383 | 5885 | * configure.ac: Rename my_foo variables to mym4_foo variables to make |
4384 | 5886 | clear that they are processed by m4. |
4385 | 5887 | (VERSION_NUMBER): New ac_subst. |
4394 | 5896 | * tests/t-version.c (main): Add option --verbose. |
4395 | 5897 | |
4396 | 5898 | Update GnuPG related m4 files. |
5899 | + commit 863c0f2a3eaf2a5d46c5518e5ac3486cc1a49bd3 | |
4397 | 5900 | * m4/gpg-error.m4: Update from libgpg-error. |
4398 | 5901 | * m4/libassuan.m4: Update from libassuan. |
4399 | 5902 | |
4400 | 5903 | Update helper scripts. |
5904 | + commit fdcd5736e610cd64e47da73dcafe8bc4a6a67666 | |
4401 | 5905 | * configure.ac: Use AC_CONFIG_AUX_DIR. Remove args from |
4402 | 5906 | AM_INIT_AUTOMAKE. Replace AM_CONFIG_HEADER by AC_CONFIG_HEADER. |
4403 | 5907 | * compile, config.guess, config.sub, depcomp, install-sh, ltmain.sh |
4411 | 5915 | 2013-02-25 Werner Koch <wk@gnupg.org> |
4412 | 5916 | |
4413 | 5917 | Remove included gitlog-to-changelog. |
5918 | + commit 967e043ac42330ee692f23d05ce3a0dd457f2119 | |
4414 | 5919 | * build-aux/gitlog-to-changelog: Remove. |
4415 | 5920 | * configure.ac (GITLOG_TO_CHANGELOG): Default to just |
4416 | 5921 | gitlog-to-changelog. |
4418 | 5923 | 2013-02-12 Werner Koch <wk@gnupg.org> |
4419 | 5924 | |
4420 | 5925 | Add macro GPGME_VERSION_NUMBER. |
5926 | + commit f48f75b1e812d33b76e439412efffa8277ab9abe | |
4421 | 5927 | * src/gpgme.h.in (GPGME_VERSION_NUMBER): New. |
4422 | 5928 | * configure.ac (my_version_major, my_version_minor) |
4423 | 5929 | (my_version_micro): New m4 macros. |
4425 | 5931 | (VERSION_NUMBER): New ac_subst. |
4426 | 5932 | |
4427 | 5933 | Add public function gpgme_get_pinentry_mode. |
5934 | + commit 4f381554411ef019d79492f1751543f145604bcf | |
4428 | 5935 | * src/gpgme.c (gpgme_get_pinentry_mode): New. |
4429 | 5936 | |
4430 | 5937 | 2013-02-07 Werner Koch <wk@gnupg.org> |
4431 | 5938 | |
4432 | 5939 | gpgme_tool: Support GPG's new pinentry-mode. |
5940 | + commit 02a2cf0ccb4d01700adf6d18316d7705d519a048 | |
4433 | 5941 | * src/gpgme-tool.c (log_error): Do not always print the error source. |
4434 | 5942 | (gt_set_pinentry_mode): New. |
4435 | 5943 | (server_passphrase_cb): New. |
4440 | 5948 | (parse_options, main): Implement that option. |
4441 | 5949 | |
4442 | 5950 | Add public function gpgme_set_pinentry_mode. |
5951 | + commit 61a0d92b679f248505f1bf16386bc41a5bf2ba1d | |
4443 | 5952 | * src/gpgme.c (gpgme_set_pinentry_mode): New. |
4444 | 5953 | * src/gpgme.h.in (gpgme_pinentry_t): New. |
4445 | 5954 | (gpgme_set_pinentry_mode): New. |
4452 | 5961 | (_gpgme_engine_ops_gpg): Register gpg_set_pinentry_mode. |
4453 | 5962 | |
4454 | 5963 | Add public function gpgme_io_writen. |
5964 | + commit 29eced50687dd8a39dafe704102ae09ea8e8533a | |
4455 | 5965 | * src/gpgme.c (gpgme_io_read): New. |
4456 | 5966 | |
4457 | 5967 | 2012-11-16 Werner Koch <wk@gnupg.org> |
4458 | 5968 | |
4459 | 5969 | Improve parsing of the GIT revision number. |
5970 | + commit 322552a88db47896881e55c00ca301137cd160c6 | |
4460 | 5971 | * configure.ac (git_revision): Use git rev-parse. |
4461 | 5972 | |
4462 | 5973 | Fix non-portable use of chmod in autogen.sh. |
5974 | + commit cd6de92f42cb6e5b85bc376d5544496cb4d6a88a | |
4463 | 5975 | * autogen.sh: Remove option -c from chmod. |
4464 | 5976 | |
4465 | 5977 | 2012-11-15 Werner Koch <wk@gnupg.org> |
4466 | 5978 | |
4467 | 5979 | Make _gpgme_encode_percent_string work for memory buffers. |
5980 | + commit 1a17acd8e9b7c0ef924f98bfb1502fe12e83c363 | |
4468 | 5981 | * src/conversion.c (D_gpgme_encode_percent_string): Remove stray |
4469 | 5982 | semicolon. Reported by Xi Wang. |
4470 | 5983 | |
4471 | 5984 | 2012-10-24 Werner Koch <wk@gnupg.org> |
4472 | 5985 | |
4473 | 5986 | Make local variables configure hack more robust. |
5987 | + commit c97d067f27899d890a99036fcbed9263f4f68875 | |
4474 | 5988 | * configure.ac (emacs_local_vars_begin): Use extra m4 quoting so that |
4475 | 5989 | newer Emscasen won't take it up as Local Variables for this file. |
4476 | 5990 | |
4477 | 5991 | Fix ttyname problem on Android. |
5992 | + commit 12a0c93433a0b1d7e8019fc35a63476db39327fa | |
4478 | 5993 | * configure.ac: Define macro and conditional HAVE_ANDROID_SYSTEM. |
4479 | 5994 | * m4/gnupg-ttyname.m4: Force use of replacement on Android. |
4480 | 5995 | * src/ttyname_r.c: Ditto. |
4481 | 5996 | |
4482 | 5997 | tests: Adhere to the docs and call gpgme_check_version. |
5998 | + commit cc59b75b21516198b39a56950afbcec140d8ba48 | |
4483 | 5999 | * tests/t-engine-info.c: Call gpgme_check_version. |
4484 | 6000 | |
4485 | 6001 | 2012-10-19 Werner Koch <wk@gnupg.org> |
4486 | 6002 | |
4487 | 6003 | Trace the use of GPG_ERR_INV_ENGINE. |
6004 | + commit bd24feaa86f8154e550107990392ac9ac05e60d4 | |
4488 | 6005 | * src/debug.h: Include "gpgme.h" |
4489 | 6006 | (_gpgme_trace_gpgme_error): New. |
4490 | 6007 | (trace_gpg_error): New macro. Use it in all files where we return |
4491 | 6008 | GPG_ERR_INV_ENGINE; also "include debug.h" as needed. |
4492 | 6009 | |
4493 | 6010 | Avoid warning about initialized but not used variable. |
6011 | + commit 14a8fd4eec126cad282a85c5aa336a6b55229b52 | |
4494 | 6012 | * src/engine-gpgsm.c (gpgsm_set_fd): Do not set DIR if not needed. |
4495 | 6013 | |
4496 | 6014 | 2012-10-11 Werner Koch <wk@gnupg.org> |
4497 | 6015 | |
4498 | 6016 | gpgme-tool: Use membuf functions to build up strings. |
6017 | + commit e11e7fc5586613525035c3358e15ae24accb96ea | |
4499 | 6018 | * src/gpgme-tool.c (clear_membuf, init_membuf, put_membuf) |
4500 | 6019 | (put_membuf_str, get_membuf, peek_membuf): Add membuf functions. |
4501 | 6020 | Take from GnuPG master's common/membuf.[ch] and patch for our use. |
4502 | 6021 | (result_xml_escape): Rewrite using new functions. |
4503 | 6022 | |
4504 | 6023 | gpgme-tool: Change license from LPGLv2+ to GPLv3+ |
6024 | + commit aa30b47aa010bf46876f2335e288f8bd8718e396 | |
4505 | 6025 | * src/gpgme-tool.c: Change license notice. |
4506 | 6026 | |
4507 | 6027 | 2012-10-11 W. Trevor King <wking@tremily.us> |
4508 | 6028 | |
4509 | 6029 | gpgme-tool: escape special characters in output XML data (<, >, and &). |
6030 | + commit 3f1329e1c9b99b1632cc4c4eec2e4399676fd93d | |
4510 | 6031 | |
4511 | 6032 | src/gpgme-tool.c (result_xml_escape_replacement, result_xml_escape): |
4512 | 6033 | New. |
4514 | 6035 | (result_add_error): Use unescaped < and >. |
4515 | 6036 | |
4516 | 6037 | gpgme-tool: Fix chain_id -> chain-id in KEYLIST XML. |
6038 | + commit c28ebca9f2e21344d68e9fdcec60553f225c2e54 | |
4517 | 6039 | |
4518 | 6040 | src/gpgme-tool.c (cmd_keylist): Use <chain-id> instead of <chain_id>. |
4519 | 6041 | |
4520 | 6042 | 2012-09-28 W. Trevor King <wking@tremily.us> |
4521 | 6043 | |
4522 | 6044 | gpgme-tool: Return more detailed XML from KEYLIST. |
6045 | + commit 3d69b51f7f083193db28f364da4590c33b5e44e6 | |
4523 | 6046 | src/gpgme-tool.c (cmd_keylist): Convert output from a list of |
4524 | 6047 | to more detailed XML. |
4525 | 6048 | (xml_preamble1, xml_preamble2, xml_end): Make global. |
4530 | 6053 | value returned by gpgme_get_protocol_name directly. |
4531 | 6054 | |
4532 | 6055 | gpgme-tool: Initialize input_fd and output_fd. |
6056 | + commit dda3702a9024a08da7bb949e15b63a47d23d59f5 | |
4533 | 6057 | * src/gpgme-tool.c (gpgme_server): Initialize input_fd and output_fd. |
4534 | 6058 | |
4535 | 6059 | 2012-09-26 Werner Koch <wk@gnupg.org> |
4536 | 6060 | |
4537 | 6061 | gpgme-tool: Fix handling of file descriptors. |
6062 | + commit 193eb62538b9413e0dfbd04c075f871d5aa9130b | |
4538 | 6063 | * src/gpgme-tool.c (server_reset_fds): Use close/CloseHandle instead |
4539 | 6064 | of the assuan close functions. |
4540 | 6065 | (_cmd_decrypt_verify, _cmd_sign_encrypt, cmd_verify, cmd_import) |
4544 | 6069 | 2012-09-25 Werner Koch <wk@gnupg.org> |
4545 | 6070 | |
4546 | 6071 | Document contribution rules. |
6072 | + commit db33945ab3b8c173a3fc2dd1a0d22d7fc15d8730 | |
4547 | 6073 | * doc/HACKING (License policy): New. |
4548 | 6074 | * doc/DCO: New. |
4549 | 6075 | * AUTHORS: Change maintainer address. |
4550 | 6076 | |
4551 | 6077 | Add gpgme_set_global_flag to help debugging. |
6078 | + commit c62b79a1d6e576d94e08cb81c2f5dbcb42ecf8cf | |
4552 | 6079 | * src/gpgme.c (gpgme_set_global_flag): New. |
4553 | 6080 | * src/gpgme.h.in (gpgme_set_global_flag): New. |
4554 | 6081 | * src/gpgme.def, src/libgpgme.vers: Add new public function. |
4559 | 6086 | 2012-07-28 Marcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de> |
4560 | 6087 | |
4561 | 6088 | Add two recent contributors. |
6089 | + commit 83e74202cd7c4c975d149c49e2507fdb0e60ef32 | |
6090 | ||
4562 | 6091 | |
4563 | 6092 | Fix sign error in position calculation for mem_seek. |
6093 | + commit 8384ccbd1a51447dccbd608fc5df3c24cb8999b1 | |
4564 | 6094 | * data-mem.c (mem_seek): Fix sign error in position calculation. |
4565 | 6095 | |
4566 | 6096 | Allow null context on gpgme_set_locale. |
6097 | + commit 434735f71e6969248651ac01c6bd6f6789a6305d | |
4567 | 6098 | * gpgme.c (gpgme_set_locale): Allow CTX to be a null pointer. |
4568 | 6099 | |
4569 | 6100 | 2012-07-13 Werner Koch <wk@gnupg.org> |
4570 | 6101 | |
4571 | 6102 | Do not include the removed file status-table.h. |
6103 | + commit e7aeaebb01395b170c91f290bf3ff5021023420f | |
4572 | 6104 | * src/engine-uiserver.c: Remove status-table.h which is not anymore |
4573 | 6105 | built. Fixes bug#1412. |
4574 | 6106 | |
4575 | 6107 | Make handling of new conf values more robust (bug#1413). |
6108 | + commit 9f081da7356288a96e8ea4d81a74ff706c00b0cd | |
4576 | 6109 | * src/engine-gpgconf.c (arg_to_data): Allow for NULL as value.string. |
4577 | 6110 | |
4578 | 6111 | 2012-05-02 Werner Koch <wk@gnupg.org> |
4579 | 6112 | |
4580 | 6113 | Release 1.3.2. |
6114 | + commit 9c8608f702ec0f44ae55cd7f33bd8df0a2d48508 | |
4581 | 6115 | * configure.ac: Bump LT version to C19/A8/R1. |
4582 | 6116 | |
4583 | 6117 | * configure.ac (GITLOG_TO_CHANGELOG): Define. |
4584 | 6118 | * Makefile.am (gen-ChangeLog): Use it. |
4585 | 6119 | |
4586 | 6120 | Remove unused pth stuff from gpgme-config. |
6121 | + commit 295dd3f238fa656493d34e8a718958d62226b56c | |
4587 | 6122 | * src/gpgme-config.in: Remove unused pth stuff. |
4588 | 6123 | |
4589 | 6124 | Update signature summary for the case of missing X.509 keys. |
6125 | + commit d6402b888fd00b883bbfc00c91a2aa9706e4377e | |
4590 | 6126 | * src/verify.c (gpgme_op_verify_result): Update summary field. |
4591 | 6127 | |
4592 | 6128 | 2012-04-30 Werner Koch <wk@gnupg.org> |
4593 | 6129 | |
4594 | 6130 | Fix timestamp parsing for y2038 hack. |
6131 | + commit 1a21574b48ee91eedbf95251ee600648b377d1e7 | |
4595 | 6132 | * src/conversion.c (_gpgme_parse_timestamp): Set ENDP before year 2038 |
4596 | 6133 | check. |
4597 | 6134 | |
4598 | 6135 | 2012-04-20 W. Trevor King <wking@drexel.edu> |
4599 | 6136 | |
4600 | 6137 | .gitignore: flesh out rules and add subdirectory-.gitignores. |
6138 | + commit 4cb408d33efe80e7d102049dea244d22907d8395 | |
6139 | ||
4601 | 6140 | |
4602 | 6141 | 2012-04-13 W. Trevor King <wking@drexel.edu> |
4603 | 6142 | |
4604 | 6143 | status-table.c: include string.h for strcmp. |
6144 | + commit 62bbe58280737d73badbe518f140e40480205176 | |
4605 | 6145 | * status-table.c: include string.h to avoid `warning: implicit |
4606 | 6146 | declaration of function 'strcmp'`. |
4607 | 6147 | |
4608 | 6148 | 2012-04-03 W. Trevor King <wking@drexel.edu> |
4609 | 6149 | |
4610 | 6150 | gpgme-tool: add help messages for a number of commands. |
6151 | + commit c318e69d8fa5f9e92d4aac3dd44fae5adcaade72 | |
4611 | 6152 | * src/gpgme-tool.c (hlp_engine, hlp_sub_protocol, hlp_armor, hlp_textmode, |
4612 | 6153 | hlp_include_certs, hlp_keylist_mode, hlp_input, hlp_output, hlp_message, |
4613 | 6154 | hlp_recipient, hlp_signer, hlp_signers_clear, hlp_decrypt, hlp_decrypt_verify, |
4617 | 6158 | (doc): Mention Assuan. |
4618 | 6159 | |
4619 | 6160 | uiserver.texi: fix decryption -> encryption typo in PREP_ENCRYPT discussion. |
6161 | + commit bb62104adf78e8416b3c56b8b2621edd723b56cd | |
4620 | 6162 | * doc/uiserver.texi (PREP_ENCRYPT): Fix documentation. |
4621 | 6163 | |
4622 | 6164 | Update Werner Koch's distribution signing key in the README. |
6165 | + commit 6ec9e21dd1ea2f8509700bce018aef6ad7e9a927 | |
4623 | 6166 | * README: Update signing key. |
4624 | 6167 | |
4625 | 6168 | 2012-03-12 Marcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de> |
4626 | 6169 | |
4627 | 6170 | Do not rely on glibc name of syscall. |
6171 | + commit ff0a640a18e7b7457e6c2edfdc8307bf44628b60 | |
4628 | 6172 | * src/ath.c (ath_self): Use __NR_gettid, not SYS_gettid. |
4629 | 6173 | |
4630 | 6174 | Update config.guess and config.sub to latest version. |
6175 | + commit ced1ad01aed32d1e4c5000f3b901db018ef7bf1e | |
4631 | 6176 | * config.guess, config.sub: Update to latest version. |
4632 | 6177 | |
4633 | 6178 | 2012-02-14 Marcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de> |
4634 | 6179 | |
4635 | 6180 | Rework status table to be less dynamically generated. |
6181 | + commit 885243e05467e79e2375b3febe7904053ab45dfc | |
4636 | 6182 | * src/Makefile.am (EXTRA_DIST): Remove mkstatus. |
4637 | 6183 | (BUILT_SOURCE, MOSTLYCLEANFILES): Remove. |
4638 | 6184 | (main_sources): Remove status-table.h, extra-stati.h. |
4659 | 6205 | 2012-02-08 Marcus Brinkmann <mb@g10code.com> |
4660 | 6206 | |
4661 | 6207 | Use gpgme interface for error handling to avoid linking with gpg-error. |
6208 | + commit dae3073aaa8b7feb1c844fdaf711f79141b9cc65 | |
4662 | 6209 | * tests/t-data.c, tests/run-export.c, tests/run-keylist.c, |
4663 | 6210 | tests/run-support.h, tests/run-verify.c, tests/gpg/t-decrypt-verify.c, |
4664 | 6211 | tests/gpg/t-edit.c, tests/gpg/t-eventloop.c, tests/gpg/t-keylist-sig.c, |
4669 | 6216 | tests/opassuan/t-command.c: Use gpgme interface for gpg-error functions. |
4670 | 6217 | |
4671 | 6218 | Link the thread test to pthread. |
6219 | + commit 0052a72f89c6830818e354358fdd84702d3494c8 | |
4672 | 6220 | * tests/gpg/Makefile.am (t_thread1_LDADD): Add -lpthread. |
4673 | 6221 | |
4674 | 6222 | Link gpgme-tool directly to libassuan, as it uses its interface. |
6223 | + commit 3f03897cbd223d4a75eb62c3b7bdfeb800661641 | |
4675 | 6224 | * src/Makefile.am (gpgme_tool_LDADD): Add @LIBASSUAN_LIBS@. |
4676 | 6225 | |
4677 | 6226 | 2012-01-19 Werner Koch <wk@gnupg.org> |
4678 | 6227 | |
4679 | 6228 | Support the mingw-w64 toolchain. |
6229 | + commit 24a10a4af948ebb1c767b69a92fa5bbe933a417c | |
4680 | 6230 | * autogen.sh (build-w32): Add i686-w64-mingw32 to the toolprefix. |
4681 | 6231 | |
4682 | 6232 | Fix Solaris problems with ttyname_r. |
6233 | + commit 2f304957f5122a5d9da643dc9951ee67ece06eaf | |
4683 | 6234 | * m4/gnupg-ttyname.m4: New. Based on ttyname_r from gnulib. |
4684 | 6235 | * src/ttyname_r.c (_gpgme_ttyname_r): Rename from ttyname_r. |
4685 | 6236 | Implement hacks required for Solaris and possible other non-fully |
4688 | 6239 | REPLACE_TTYNAME_R and put it into the gpgme name space. |
4689 | 6240 | |
4690 | 6241 | Try to make configure.ac a bit smaller. |
6242 | + commit c96778297f5477448a676fcf0c61044bdbccc86d | |
4691 | 6243 | * configure.ac: Move header checks. |
4692 | 6244 | |
4693 | 6245 | For W32 use a build number instead of abbreviated commit id. |
6246 | + commit 574b087e84f5652cf9d8eba8aa16b8d6bb988035 | |
4694 | 6247 | We would need to use a shortened commit id so that it fits into an 16 |
4695 | 6248 | bit Windows variable. Further it is a random number and not something |
4696 | 6249 | increasing. Thus a build number made up from the day of the year and |
4700 | 6253 | * src/versioninfo.rc.in: Ditto. |
4701 | 6254 | |
4702 | 6255 | Adjust configure.ac for modern autoconf. |
6256 | + commit a0149630ce6d3e17a7475e20e8b2e31ed5ba57fd | |
4703 | 6257 | * configure.ac: Minor cleanups. |
4704 | 6258 | |
4705 | 6259 | Update to libtool 2.4.2. |
6260 | + commit 4cfddadcd0a569f0b204dccea3c975ce0bdfb232 | |
4706 | 6261 | * ltmain.sh, m4/libtool.m4, m4/ltoptions.m4, m4/ltversion.m4, |
4707 | 6262 | * m4/lt~obsolete.m4: Update. |
4708 | 6263 | |
4709 | 6264 | Add ttyname_r check macro from gnulib. |
6265 | + commit 3ef528b63679df912551d5d21fc36e465cf50c40 | |
4710 | 6266 | * m4/gnupg-ttyname.m4: New. Taken from current gnulib. |
4711 | 6267 | |
4712 | 6268 | 2011-12-02 Werner Koch <wk@gnupg.org> |
4713 | 6269 | |
4714 | 6270 | Generate the ChangeLog from commit logs. |
6271 | + commit a4c4ee1aaea4359432bdf60dd572f549ef8dee83 | |
4715 | 6272 | * build-aux/gitlog-to-changelog: New script. Taken from gnulib. |
4716 | 6273 | * build-aux/git-log-fix: New file. |
4717 | 6274 | * build-aux/git-log-footer: New file. |
0 | Noteworthy changes in version 1.9.0 (2017-03-28) | |
1 | ------------------------------------------------ | |
2 | ||
3 | * Clarified meaning of the 'expire' parameter of gpgme_op_createkey | |
4 | and gpgme_op_createsubkey. New flag to force a key without an | |
5 | expiration date. | |
6 | ||
7 | * New function gpgme_op_keylist_from_data_start to list keys from | |
8 | data objects without importing them. | |
9 | ||
10 | * New function gpgme_op_set_uid_flag to flag a key as primary. | |
11 | ||
12 | * New function gpgme_op_decrypt_ext to run decryption with special | |
13 | flags. This can for example be used to unwrap keys (remove only | |
14 | the encryption layer). | |
15 | ||
16 | * New encryption flags to wrap a key (adding an encryption layer to | |
17 | an OpenPGP message) or to create anonymously encrypted messages. | |
18 | ||
19 | * Support for adduid and revuid operations in the C++ bindings. | |
20 | ||
21 | * Support for smartcard key generation in the C++ bindings. | |
22 | ||
23 | * Several new functions for the Python binding. | |
24 | ||
25 | * Many smaller bug fixes. | |
26 | ||
27 | ||
28 | * Interface changes relative to the 1.8.0 release: | |
29 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
30 | gpgme_op_createkey CHANGED: Meaning of 'expire' parameter. | |
31 | gpgme_op_createsubkey CHANGED: Meaning of 'expire' parameter. | |
32 | GPGME_CREATE_NOEXPIRE NEW. | |
33 | gpgme_key_t EXTENDED: New field 'origin'. | |
34 | gpgme_key_t EXTENDED: New field 'last_update'. | |
35 | gpgme_subkey_t EXTENDED: New field 'is_de_vs'. | |
36 | gpgme_user_id_t EXTENDED: New field 'origin'. | |
37 | gpgme_user_id_t EXTENDED: New field 'last_update'. | |
38 | gpgme_op_keylist_from_data_start NEW. | |
39 | gpgme_op_set_uid_flag_start NEW. | |
40 | gpgme_op_set_uid_flag NEW. | |
41 | gpgme_op_decrypt_ext_start NEW. | |
42 | gpgme_op_decrypt_ext NEW. | |
43 | GPGME_ENCRYPT_THROW_KEYIDS NEW. | |
44 | GPGME_ENCRYPT_WRAP NEW. | |
45 | GPGME_DECRYPT_VERIFY NEW. | |
46 | GPGME_DECRYPT_UNWRAP NEW. | |
47 | gpgme_data_rewind UN-DEPRECATE. | |
48 | cpp: Context::revUid(const Key&, const char*) NEW. | |
49 | cpp: Context::startRevUid(const Key&, const char*) NEW. | |
50 | cpp: Context::addUid(const Key&, const char*) NEW. | |
51 | cpp: Context::startAddUid(const Key&, const char*) NEW. | |
52 | cpp: Key::UserID::revoke() NEW. | |
53 | cpp: Key::addUid() NEW. | |
54 | cpp: Key::isDeVs NEW. | |
55 | cpp: GpgGenCardKeyInteractor NEW. | |
56 | cpp: Subkey::keyGrip NEW. | |
57 | cpp: Subkey::isDeVs NEW. | |
58 | cpp: Data::toKeys NEW. | |
59 | cpp: Context::setDecryptFlags NEW. | |
60 | cpp: Context::decrypt EXTENDED: Flags added. | |
61 | cpp: Context::startDecrypt EXTENDED: Flags added. | |
62 | cpp: Context::decryptAndVerify EXTENDED: Flags added. | |
63 | cpp: Context::startCombinedDecryptionAndVerification EXTENDED: Flags. | |
64 | cpp: Context::encryptFlags EXTENDED: New flags. | |
65 | qt: CryptoConfig::stringValueList() NEW. | |
66 | py: Context.__init__ EXTENDED: New keyword arg home_dir. | |
67 | py: Context.home_dir NEW. | |
68 | py: Context.keylist EXTENDED: New keyword arg mode. | |
69 | py: Context.keylist EXTENDED: New keyword arg source. | |
70 | py: Context.create_key NEW. | |
71 | py: Context.create_subkey NEW. | |
72 | py: Context.key_add_uid NEW. | |
73 | py: Context.key_revoke_uid NEW. | |
74 | py: Context.key_sign NEW. | |
75 | py: Context.key_tofu_policy NEW. | |
76 | py: core.pubkey_algo_string NEW. | |
77 | py: core.addrspec_from_uid NEW. | |
78 | ||
79 | [c=C29/A18/R0 cpp=C10/A4/R0 qt=C9/A2/R0] | |
80 | ||
81 | ||
0 | 82 | Noteworthy changes in version 1.8.0 (2016-11-16) |
1 | 83 | ------------------------------------------------ |
2 | 84 |
0 | 0 | GPGME - GnuPG Made Easy |
1 | 1 | --------------------------- |
2 | 2 | |
3 | Copyright 2001-2016 g10 Code GmbH | |
3 | Copyright 2001-2017 g10 Code GmbH | |
4 | 4 | |
5 | 5 | This file is free software; as a special exception the author gives |
6 | 6 | unlimited permission to copy and/or distribute it, with or without |
69 | 69 | indeed a a signature of gpgme-x.y.z.tar.gz. The key used to create |
70 | 70 | this signature is either of: |
71 | 71 | |
72 | 2048R/4F25E3B6 2011-01-12 [expires: 2019-12-31] | |
72 | rsa2048/4F25E3B6 2011-01-12 [expires: 2019-12-31] | |
73 | 73 | Key fingerprint = D869 2123 C406 5DEA 5E0F 3AB5 249B 39D2 4F25 E3B6 |
74 | 74 | Werner Koch (dist sig) |
75 | 75 | |
85 | 85 | Key fingerprint = D238 EA65 D64C 67ED 4C30 73F2 8A86 1B1C 7EFD 60D9 |
86 | 86 | Werner Koch (Release Signing Key) |
87 | 87 | |
88 | rsa3072/4B092E28 2017-03-17 [expires: 2027-03-15] | |
89 | Key fingerprint = 5B80 C575 4298 F0CB 55D8 ED6A BCEF 7E29 4B09 2E28 | |
90 | Andre Heinecke (Release Signing Key) | |
91 | ||
88 | 92 | You may retrieve these files from the keyservers using this command |
89 | 93 | |
90 | 94 | gpg --recv-keys 249B39D24F25E3B6 04376F3EE0856959 \ |
91 | 2071B08A33BD3F06 8A861B1C7EFD60D9 | |
95 | 2071B08A33BD3F06 8A861B1C7EFD60D9 BCEF7E294B092E28 | |
92 | 96 | |
93 | 97 | The keys are also available at https://gnupg.org/signature_key.html |
94 | 98 | and in released GnuPG tarballs in the file g10/distsigkey.gpg . |
27 | 27 | # commit and push so that the git magic is able to work. See below |
28 | 28 | # for the LT versions. |
29 | 29 | m4_define(mym4_version_major, [1]) |
30 | m4_define(mym4_version_minor, [8]) | |
30 | m4_define(mym4_version_minor, [9]) | |
31 | 31 | m4_define(mym4_version_micro, [0]) |
32 | 32 | |
33 | 33 | # Below is m4 magic to extract and compute the revision number, the |
54 | 54 | # (Interfaces added: AGE++) |
55 | 55 | # (Interfaces removed/changed: AGE=0) |
56 | 56 | # |
57 | LIBGPGME_LT_CURRENT=28 | |
58 | LIBGPGME_LT_AGE=17 | |
57 | LIBGPGME_LT_CURRENT=29 | |
58 | LIBGPGME_LT_AGE=18 | |
59 | 59 | LIBGPGME_LT_REVISION=0 |
60 | 60 | |
61 | 61 | # If there is an ABI break in gpgmepp or qgpgme also bump the |
62 | 62 | # version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in |
63 | 63 | |
64 | LIBGPGMEPP_LT_CURRENT=9 | |
65 | LIBGPGMEPP_LT_AGE=3 | |
64 | LIBGPGMEPP_LT_CURRENT=10 | |
65 | LIBGPGMEPP_LT_AGE=4 | |
66 | 66 | LIBGPGMEPP_LT_REVISION=0 |
67 | 67 | |
68 | LIBQGPGME_LT_CURRENT=8 | |
69 | LIBQGPGME_LT_AGE=1 | |
68 | LIBQGPGME_LT_CURRENT=9 | |
69 | LIBQGPGME_LT_AGE=2 | |
70 | 70 | LIBQGPGME_LT_REVISION=0 |
71 | 71 | |
72 | 72 | # If the API is changed in an incompatible way: increment the next counter. |
166 | 166 | have_ld_version_script=yes |
167 | 167 | ;; |
168 | 168 | *-apple-darwin*) |
169 | AC_DEFINE(_DARWIN_C_SOURCE, 900000L, | |
170 | Expose all libc features (__DARWIN_C_FULL).) | |
169 | 171 | AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X) |
170 | 172 | ;; |
171 | 173 | esac |
181 | 183 | have_android_system=no |
182 | 184 | have_w32_system=no |
183 | 185 | have_w64_system=no |
186 | have_macos_system=no | |
184 | 187 | build_w32_glib=no |
185 | 188 | build_w32_qt=no |
186 | 189 | available_languages="cl cpp python python2 python3 qt" |
195 | 198 | *-linux-androideabi) |
196 | 199 | have_android_system=yes |
197 | 200 | ;; |
201 | *-apple-darwin*) | |
202 | have_macos_system=yes | |
203 | ;; | |
198 | 204 | esac |
199 | 205 | case "${host}" in |
200 | 206 | *-mingw32ce*|*-mingw32*) |
251 | 257 | AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system]) |
252 | 258 | fi |
253 | 259 | AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes) |
260 | ||
261 | if test "$have_macos_system" = yes; then | |
262 | AC_DEFINE(HAVE_MACOS_SYSTEM,1, | |
263 | [Defined if we build for an MacOS system]) | |
264 | fi | |
265 | AM_CONDITIONAL(HAVE_MACOS_SYSTEM, test "$have_macos_system" = yes) | |
254 | 266 | |
255 | 267 | AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes) |
256 | 268 | |
405 | 417 | unset am_cv_python_pyexecdir |
406 | 418 | |
407 | 419 | if test "$found_py" = "1" -o "$found_py2" = "1"; then |
408 | AM_PATH_PYTHON([2.7]) | |
409 | AX_PYTHON_DEVEL | |
410 | if test "$PYTHON_VERSION"; then | |
411 | PYTHONS="$(echo $PYTHONS $PYTHON)" | |
412 | PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)" | |
413 | fi | |
420 | AM_PATH_PYTHON([2.7], [ | |
421 | AX_PYTHON_DEVEL | |
422 | if test "$PYTHON_VERSION"; then | |
423 | PYTHONS="$(echo $PYTHONS $PYTHON)" | |
424 | PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)" | |
425 | fi | |
426 | ], :) | |
414 | 427 | fi |
415 | 428 | |
416 | 429 | if test "$found_py" = "1" -o "$found_py3" = "1"; then |
428 | 441 | unset am_cv_python_platform |
429 | 442 | unset am_cv_python_pythondir |
430 | 443 | unset am_cv_python_pyexecdir |
431 | AM_PATH_PYTHON([3.4]) | |
432 | AX_PYTHON_DEVEL | |
433 | if test "$PYTHON_VERSION"; then | |
434 | PYTHONS="$(echo $PYTHONS $PYTHON)" | |
435 | PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)" | |
436 | fi | |
444 | AM_PATH_PYTHON([3.4], [ | |
445 | AX_PYTHON_DEVEL | |
446 | if test "$PYTHON_VERSION"; then | |
447 | PYTHONS="$(echo $PYTHONS $PYTHON)" | |
448 | PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)" | |
449 | fi | |
450 | ], :) | |
437 | 451 | fi |
438 | 452 | |
453 | # Recover some values lost in the second attempt to find Python. | |
454 | PYTHON="$(echo $PYTHONS | cut -d ' ' -f 1)" | |
455 | PYTHON_VERSION="$(echo $PYTHON_VERSIONS | cut -d ' ' -f 1)" | |
456 | ||
457 | # Remove duplicates. | |
458 | PYTHONS="$(echo $PYTHONS | tr '[[:space:]]' '\n' | sort | uniq | tr '\n' ' ' | sed -e 's/ $//')" | |
459 | PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS | tr '[[:space:]]' '\n' | sort | uniq | tr '\n' ' ' | sed -e 's/ $//')" | |
460 | ||
439 | 461 | if test "$PYTHON_VERSIONS"; then |
440 | enabled_languages_v=$(echo $enabled_languages | sed "s/python\([[23]]\)\?/python ($PYTHON_VERSIONS)/") | |
441 | enabled_languages=$(echo $enabled_languages | sed "s/python\([[23]]\)\?/python/") | |
462 | enabled_languages_v=$(echo $enabled_languages | sed -Ee "s/python[[23]]?/python ($PYTHON_VERSIONS)/") | |
463 | enabled_languages=$(echo $enabled_languages | sed -Ee "s/python[[23]]?/python/") | |
442 | 464 | else |
443 | 465 | if test "$explicit_languages" = "1"; then |
444 | 466 | AC_MSG_ERROR([[ |
621 | 643 | |
622 | 644 | AC_FUNC_FSEEKO |
623 | 645 | |
624 | AC_REPLACE_FUNCS(vasprintf) | |
625 | if test "$ac_cv_func_vasprintf" != yes; then | |
626 | GNUPG_CHECK_VA_COPY | |
627 | fi | |
628 | ||
629 | 646 | # Try to find a thread-safe version of ttyname(). |
630 | 647 | gnupg_REPLACE_TTYNAME_R |
631 | 648 | if test "$ac_cv_func_ttyname_r" != yes; then |
687 | 704 | # Other checks |
688 | 705 | # |
689 | 706 | |
690 | # Check for funopen | |
691 | AC_CHECK_FUNCS(funopen) | |
692 | if test $ac_cv_func_funopen != yes; then | |
693 | # No funopen but we can implement that in terms of fopencookie. | |
694 | AC_CHECK_FUNCS(fopencookie) | |
695 | if test $ac_cv_func_fopencookie = yes; then | |
696 | AC_REPLACE_FUNCS(funopen) | |
697 | else | |
698 | AC_MSG_WARN([ | |
699 | *** | |
700 | *** No implementation of fopencookie or funopen available | |
701 | ***]) | |
702 | fi | |
703 | fi | |
704 | ||
705 | 707 | # Check for getgid etc |
706 | AC_CHECK_FUNCS(getgid getegid) | |
708 | AC_CHECK_FUNCS(getgid getegid closefrom) | |
707 | 709 | |
708 | 710 | |
709 | 711 | # Replacement functions. |
731 | 733 | #include <unistd.h> |
732 | 734 | ]) |
733 | 735 | |
734 | ||
735 | dnl There seems to be a problem with Apple and decriptor passing. | |
736 | dnl Until we found a solution we change the default to no. | |
737 | dnl See bug 1483. | |
738 | case "${host}" in | |
739 | *-apple-darwin*) | |
740 | use_descriptor_passing=no | |
741 | ;; | |
742 | *) | |
743 | use_descriptor_passing=yes | |
744 | ;; | |
745 | esac | |
736 | use_descriptor_passing=yes | |
746 | 737 | AC_ARG_ENABLE(fd-passing, |
747 | 738 | AC_HELP_STRING([--disable-fd-passing], [do not use FD passing]), |
748 | 739 | use_descriptor_passing=$enableval) |
797 | 788 | #define GPG_ERR_ENABLE_ERRNO_MACROS 1 |
798 | 789 | |
799 | 790 | #define CRIGHTBLURB "Copyright (C) 2000 Werner Koch\n" \ |
800 | "Copyright (C) 2001--2016 g10 Code GmbH\n" | |
791 | "Copyright (C) 2001--2017 g10 Code GmbH\n" | |
801 | 792 | ]) |
802 | 793 | |
803 | 794 |
13 | 13 | @syncodeindex pg fn |
14 | 14 | |
15 | 15 | @copying |
16 | Copyright @copyright{} 2002--2008, 2010, 2012--2016 g10 Code GmbH. | |
16 | Copyright @copyright{} 2002--2008, 2010, 2012--2017 g10 Code GmbH. | |
17 | 17 | |
18 | 18 | @quotation |
19 | 19 | Permission is granted to copy, distribute and/or modify this document |
977 | 977 | |
978 | 978 | @item g13-name |
979 | 979 | Return the name of the file container encryption engine. |
980 | ||
981 | @item gpg-wks-client-name | |
982 | Return the name of the Web Key Service tool. | |
980 | 983 | |
981 | 984 | @end table |
982 | 985 | |
2887 | 2890 | values for @var{name}: |
2888 | 2891 | |
2889 | 2892 | @table @code |
2893 | @item "redraw" | |
2894 | This flag is normally not changed by the caller because GPGME sets and | |
2895 | clears it automatically: The flag is cleared before an operation and | |
2896 | set if an operation noticed that the engine has launched a Pinentry. | |
2897 | A Curses based application may use this information to redraw the | |
2898 | screen; for example: | |
2899 | ||
2900 | @example | |
2901 | err = gpgme_op_keylist_start (ctx, "foo@@example.org", 0); | |
2902 | while (!err) | |
2903 | @{ | |
2904 | err = gpgme_op_keylist_next (ctx, &key); | |
2905 | if (err) | |
2906 | break; | |
2907 | show_key (key); | |
2908 | gpgme_key_release (key); | |
2909 | @} | |
2910 | if ((s = gpgme_get_ctx_flag (ctx, "redraw")) && *s) | |
2911 | redraw_screen (); | |
2912 | gpgme_release (ctx); | |
2913 | @end example | |
2914 | ||
2915 | ||
2890 | 2916 | @item "full-status" |
2891 | 2917 | Using a @var{value} of "1" the status callback set by |
2892 | 2918 | gpgme_set_status_cb returns all status lines with the exception of |
3051 | 3077 | (offline/stub keys). This is only set if a listing of secret keys has |
3052 | 3078 | been requested or if @code{GPGME_KEYLIST_MODE_WITH_SECRET} is active. |
3053 | 3079 | |
3080 | @item unsigned int origin : 5 | |
3081 | Reserved for the origin of this key. | |
3082 | ||
3054 | 3083 | @item gpgme_protocol_t protocol |
3055 | 3084 | This is the protocol supported by this key. |
3056 | 3085 | |
3083 | 3112 | this is a copy of the fingerprint of the first subkey. For an |
3084 | 3113 | incomplete key (for example from a verification result) a subkey may |
3085 | 3114 | be missing but this field may be set nevertheless. |
3115 | ||
3116 | @item unsigned long last_update | |
3117 | Reserved for the time of the last update of this key. | |
3086 | 3118 | |
3087 | 3119 | @end table |
3088 | 3120 | @end deftp |
3132 | 3164 | This is true if the subkey can be used for qualified signatures |
3133 | 3165 | according to local government regulations. |
3134 | 3166 | |
3167 | @item unsigned int is_de_vs : 1 | |
3168 | This is true if the subkey complies with the rules for classified | |
3169 | information in Germany at the restricted level (VS-NfD). This are | |
3170 | currently RSA keys of at least 2048 bits or ECDH/ECDSA keys using a | |
3171 | Brainpool curve. | |
3172 | ||
3135 | 3173 | @item unsigned int secret : 1 |
3136 | 3174 | This is true if the subkey is a secret key. Note that it will be |
3137 | 3175 | false if the key is actually a stub key; i.e. a secret key operation |
3222 | 3260 | |
3223 | 3261 | @item gpgme_key_sig_t signatures |
3224 | 3262 | This is a linked list with the signatures on this user ID. |
3263 | ||
3264 | @item unsigned int origin : 5 | |
3265 | Reserved for the origin of this user ID. | |
3266 | ||
3267 | @item unsigned long last_update | |
3268 | Reserved for the time of the last update of this user ID. | |
3269 | ||
3225 | 3270 | @end table |
3226 | 3271 | @end deftp |
3227 | 3272 | |
3312 | 3357 | @cindex key ring, search |
3313 | 3358 | |
3314 | 3359 | @deftypefun gpgme_error_t gpgme_op_keylist_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}}, @w{int @var{secret_only}}) |
3360 | ||
3315 | 3361 | The function @code{gpgme_op_keylist_start} initiates a key listing |
3316 | 3362 | operation inside the context @var{ctx}. It sets everything up so that |
3317 | 3363 | subsequent invocations of @code{gpgme_op_keylist_next} return the keys |
3339 | 3385 | @end deftypefun |
3340 | 3386 | |
3341 | 3387 | @deftypefun gpgme_error_t gpgme_op_keylist_ext_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{pattern}[]}, @w{int @var{secret_only}}, @w{int @var{reserved}}) |
3388 | ||
3342 | 3389 | The function @code{gpgme_op_keylist_ext_start} initiates an extended |
3343 | 3390 | key listing operation inside the context @var{ctx}. It sets |
3344 | 3391 | everything up so that subsequent invocations of |
3369 | 3416 | are reported by the crypto engine support routines. |
3370 | 3417 | @end deftypefun |
3371 | 3418 | |
3419 | @deftypefun gpgme_error_t gpgme_op_keylist_from_data @ | |
3420 | (@w{gpgme_ctx_t @var{ctx}}, @ | |
3421 | @w{gpgme_data_t @var{data}}, @ | |
3422 | @w{int @var{reserved}}) | |
3423 | ||
3424 | The function @code{gpgme_op_keylist_from_data_start} initiates a key | |
3425 | listing operation inside the context @var{ctx}. In contrast to the | |
3426 | other key listing operation the keys are read from the supplied | |
3427 | @var{data} and not from the local key database. The keys are also not | |
3428 | imported into the local key database. The function sets everything up | |
3429 | so that subsequent invocations of @code{gpgme_op_keylist_next} return | |
3430 | the keys from @var{data}. | |
3431 | ||
3432 | The value of @var{reserved} must be @code{0}. | |
3433 | ||
3434 | This function requires at least GnuPG version 2.1.14 and currently | |
3435 | works only with OpenPGP keys. | |
3436 | ||
3437 | The context will be busy until either all keys are received (and | |
3438 | @code{gpgme_op_keylist_next} returns @code{GPG_ERR_EOF}), or | |
3439 | @code{gpgme_op_keylist_end} is called to finish the operation. | |
3440 | While the context is busy @var{data} may not be released. | |
3441 | ||
3442 | The function returns the error code @code{GPG_ERR_INV_VALUE} if | |
3443 | @var{ctx} is not a valid pointer, and passes through any errors that | |
3444 | are reported by the crypto engine support routines. | |
3445 | @end deftypefun | |
3446 | ||
3372 | 3447 | @deftypefun gpgme_error_t gpgme_op_keylist_next (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t *@var{r_key}}) |
3448 | ||
3373 | 3449 | The function @code{gpgme_op_keylist_next} returns the next key in the |
3374 | 3450 | list created by a previous @code{gpgme_op_keylist_start} operation in |
3375 | 3451 | the context @var{ctx}. The key will have one reference for the user. |
3387 | 3463 | @end deftypefun |
3388 | 3464 | |
3389 | 3465 | @deftypefun gpgme_error_t gpgme_op_keylist_end (@w{gpgme_ctx_t @var{ctx}}) |
3466 | ||
3390 | 3467 | The function @code{gpgme_op_keylist_end} ends a pending key list |
3391 | 3468 | operation in the context @var{ctx}. |
3392 | 3469 | |
3401 | 3478 | |
3402 | 3479 | The following example illustrates how all keys containing a certain |
3403 | 3480 | string (@code{g10code}) can be listed with their key ID and the name |
3404 | and e-mail address of the main user ID: | |
3481 | and email address of the main user ID: | |
3405 | 3482 | |
3406 | 3483 | @example |
3407 | 3484 | gpgme_ctx_t ctx; |
3588 | 3665 | |
3589 | 3666 | @var{reserved} must be set to zero. |
3590 | 3667 | |
3591 | @var{expires} can be set to the number of seconds since Epoch of the | |
3592 | desired expiration date in UTC for the new key. Using 0 does not | |
3593 | set an expiration date. Note that this parameter takes an unsigned long | |
3594 | value and not a @code{time_t} to avoid problems on systems which use a | |
3595 | signed 32 bit @code{time_t}. Note further that the OpenPGP protocol | |
3596 | uses 32 bit values for timestamps and thus can only encode dates up to | |
3597 | the year 2106. | |
3668 | @var{expires} specifies the expiration time in seconds. If you supply | |
3669 | 0, a reasonable expiration time is chosen. Use the flag | |
3670 | @code{GPGME_CREATE_NOEXPIRE} to create keys that do not expire. Note | |
3671 | that this parameter takes an unsigned long value and not a | |
3672 | @code{time_t} to avoid problems on systems which use a signed 32 bit | |
3673 | @code{time_t}. Note further that the OpenPGP protocol uses 32 bit | |
3674 | values for timestamps and thus can only encode dates up to the year | |
3675 | 2106. | |
3598 | 3676 | |
3599 | 3677 | @var{extrakey} is currently not used and must be set to @code{NULL}. |
3600 | 3678 | A future version of GPGME may use this parameter to create X.509 keys. |
3635 | 3713 | The engine does not allow the creation of a key with a user ID |
3636 | 3714 | already existing in the local key database. This flag can be used to |
3637 | 3715 | override this check. |
3716 | ||
3717 | @item GPGME_CREATE_NOEXPIRE | |
3718 | Request generation of keys that do not expire. | |
3638 | 3719 | |
3639 | 3720 | @end table |
3640 | 3721 | |
3695 | 3776 | |
3696 | 3777 | @var{reserved} must be set to zero. |
3697 | 3778 | |
3698 | @var{expires} can be set to the number of seconds since Epoch of the | |
3699 | desired expiration date in UTC for the new subkey. Using 0 does not | |
3700 | set an expiration date. Note that this parameter takes an unsigned long | |
3701 | value and not a @code{time_t} to avoid problems on systems which use a | |
3702 | signed 32 bit @code{time_t}. Note further that the OpenPGP protocol | |
3703 | uses 32 bit values for timestamps and thus can only encode dates up to | |
3704 | the year 2106. | |
3779 | @var{expires} specifies the expiration time in seconds. If you supply | |
3780 | 0, a reasonable expiration time is chosen. Use the flag | |
3781 | @code{GPGME_CREATE_NOEXPIRE} to create keys that do not expire. Note | |
3782 | that this parameter takes an unsigned long value and not a | |
3783 | @code{time_t} to avoid problems on systems which use a signed 32 bit | |
3784 | @code{time_t}. Note further that the OpenPGP protocol uses 32 bit | |
3785 | values for timestamps and thus can only encode dates up to the year | |
3786 | 2106. | |
3705 | 3787 | |
3706 | 3788 | @var{flags} takes the same values as described above for |
3707 | 3789 | @code{gpgme_op_createkey}. |
3827 | 3909 | |
3828 | 3910 | |
3829 | 3911 | @c |
3912 | @c gpgme_op_set_uid_flag | |
3913 | @c | |
3914 | @deftypefun gpgme_error_t gpgme_op_set_ui_flag @ | |
3915 | (@w{gpgme_ctx_t @var{ctx}}, @ | |
3916 | @w{gpgme_key_t @var{key}}, @ | |
3917 | @w{const char *@var{userid}}, @ | |
3918 | @w{cons char * @var{name}}, @ | |
3919 | @w{cons char * @var{value}}); | |
3920 | ||
3921 | The function @code{gpgme_op_set_uid_flag} is used to set flags on a | |
3922 | user ID from the OpenPGP key given by @var{KEY}. Setting flags on | |
3923 | user IDs after key creation is a feature of the OpenPGP protocol and | |
3924 | thus the protocol for the context @var{ctx} must be set to OpenPGP. | |
3925 | ||
3926 | @var{key} specifies the key to operate on. This parameters is required. | |
3927 | ||
3928 | @var{userid} is the user ID of the key to be manipulated. This user ID | |
3929 | must be given verbatim because the engine does an exact and case | |
3930 | sensitive match. Thus the @code{uid} field from the user ID object | |
3931 | (@code{gpgme_user_id_t}) is to be used. This is a required parameter. | |
3932 | ||
3933 | @var{name} names the flag which is to be changed. The only currently | |
3934 | supported flag is: | |
3935 | ||
3936 | @table @code | |
3937 | @item primary | |
3938 | This sets the primary key flag on the given user ID. All other | |
3939 | primary key flag on other user IDs are removed. @var{value} must be | |
3940 | given as NULL. For technical reasons this functions bumps the | |
3941 | creation timestamp of all affected self-signatures up by one second. | |
3942 | At least GnuPG version 2.1.20 is required. | |
3943 | ||
3944 | @end table | |
3945 | ||
3946 | The function returns zero on success, @code{GPG_ERR_NOT_SUPPORTED} if | |
3947 | the engine does not support the command, or a bunch of other error | |
3948 | codes. | |
3949 | ||
3950 | @end deftypefun | |
3951 | ||
3952 | @deftypefun gpgme_error_t gpgme_op_set_uid_flag_start @ | |
3953 | (@w{gpgme_ctx_t @var{ctx}}, @ | |
3954 | @w{gpgme_key_t @var{key}}, @ | |
3955 | @w{const char *@var{userid}}, @ | |
3956 | @w{cons char * @var{name}}, @ | |
3957 | @w{cons char * @var{value}}); | |
3958 | ||
3959 | The function @code{gpgme_op_set_uid_flag_start} initiates a | |
3960 | @code{gpgme_op_set_uid_flag} operation; see there for details. It must | |
3961 | be completed by calling @code{gpgme_wait} on the context. | |
3962 | @xref{Waiting For Completion}. | |
3963 | ||
3964 | @end deftypefun | |
3965 | ||
3966 | @c | |
3830 | 3967 | @c gpgme_op_genkey |
3831 | 3968 | @c |
3832 | 3969 | @deftypefun gpgme_error_t gpgme_op_genkey @ |
3850 | 3987 | be signed by the certification authority and imported before it can be |
3851 | 3988 | used. GpgSM does not make the fingerprint available. |
3852 | 3989 | |
3853 | The argument @var{parms} specifies parameters for the key in an XML | |
3854 | string. The details about the format of @var{parms} are specific to | |
3855 | the crypto engine used by @var{ctx}. Here is an example for GnuPG as | |
3856 | the crypto engine (all parameters of OpenPGP key generation are | |
3857 | documented in the GPG manual): | |
3990 | The argument @var{parms} specifies parameters for the key in an string | |
3991 | that looks something like XML. The details about the format of | |
3992 | @var{parms} are specific to the crypto engine used by @var{ctx}. The | |
3993 | first line of the parameters must be @code{<GnupgKeyParams | |
3994 | format="internal">} and the last line must be | |
3995 | @code{</GnupgKeyParams>}. Every line in between the first and last | |
3996 | lines is treated as a Header: Value pair. In particular, no XML | |
3997 | escaping is necessary if you need to include the characters @code{<}, | |
3998 | @code{>}, or @code{&}. | |
3999 | ||
4000 | Here is an example for GnuPG as the crypto engine (all parameters of | |
4001 | OpenPGP key generation are documented in the GPG manual): | |
3858 | 4002 | |
3859 | 4003 | @example |
3860 | 4004 | <GnupgKeyParms format="internal"> |
3890 | 4034 | |
3891 | 4035 | The function returns the error code @code{GPG_ERR_NO_ERROR} if the |
3892 | 4036 | operation could be started successfully, @code{GPG_ERR_INV_VALUE} if |
3893 | @var{parms} is not a valid XML string, @code{GPG_ERR_NOT_SUPPORTED} if | |
3894 | @var{public} or @var{secret} is not valid, and @code{GPG_ERR_GENERAL} | |
3895 | if no key was created by the backend. | |
4037 | @var{parms} is not a well-formed string (e.g. does not have the | |
4038 | expected tag-like headers and footers), @code{GPG_ERR_NOT_SUPPORTED} | |
4039 | if @var{public} or @var{secret} is not valid, and | |
4040 | @code{GPG_ERR_GENERAL} if no key was created by the backend. | |
3896 | 4041 | @end deftypefun |
3897 | 4042 | |
3898 | 4043 | @deftypefun gpgme_error_t gpgme_op_genkey_start (@w{gpgme_ctx_t @var{ctx}}, @w{const char *@var{parms}}, @w{gpgme_data_t @var{public}}, @w{gpgme_data_t @var{secret}}) |
4007 | 4152 | one user ID put them all into one string separated by linefeeds |
4008 | 4153 | characters (@code{\n}) and set the flag @code{GPGME_KEYSIGN_LFSEP}. |
4009 | 4154 | |
4010 | @var{expires} can be set to the number of seconds since Epoch of the | |
4011 | desired expiration date in UTC for the new signature. The common case | |
4012 | is to use 0 to not set an expiration date. However, if the | |
4013 | configuration of the engine defines a default expiration for key | |
4014 | signatures, that is still used unless the flag | |
4155 | @var{expires} specifies the expiration time of the new signature in | |
4156 | seconds. The common case is to use 0 to not set an expiration date. | |
4157 | However, if the configuration of the engine defines a default | |
4158 | expiration for key signatures, that is still used unless the flag | |
4015 | 4159 | @code{GPGME_KEYSIGN_NOEXPIRE} is used. Note that this parameter takes |
4016 | 4160 | an unsigned long value and not a @code{time_t} to avoid problems on |
4017 | 4161 | systems which use a signed 32 bit @code{time_t}. Note further that |
4453 | 4597 | @cindex validity, TOFU |
4454 | 4598 | |
4455 | 4599 | The OpenPGP engine features a Trust-On-First-Use (TOFU) key validation |
4456 | model. For resolving clonflics it is necessary to declare the policy | |
4600 | model. For resolving conflicts it is necessary to declare the policy | |
4457 | 4601 | for a key. See the GnuPG manual for details on the TOFU |
4458 | 4602 | implementation. |
4459 | 4603 | |
4466 | 4610 | @item GPGME_TOFU_POLICY_AUTO |
4467 | 4611 | Set the policy to ``auto''. |
4468 | 4612 | @item GPGME_TOFU_POLICY_GOOD |
4469 | Set the policy to ``goog''. | |
4613 | Set the policy to ``good''. | |
4470 | 4614 | @item GPGME_TOFU_POLICY_BAD |
4471 | 4615 | Set the policy to ``bad''. |
4472 | 4616 | @item GPGME_TOFU_POLICY_ASK |
4758 | 4902 | if @var{cipher} or @var{plain} is not a valid pointer. |
4759 | 4903 | @end deftypefun |
4760 | 4904 | |
4905 | ||
4906 | @deftypefun gpgme_error_t gpgme_op_decrypt_ext ( @ | |
4907 | @w{gpgme_ctx_t @var{ctx}}, @ | |
4908 | @w{gpgme_decrypt_flags_t @var{flags}}, @ | |
4909 | @w{gpgme_data_t @var{cipher}}, @ | |
4910 | @w{gpgme_data_t @var{plain}}) | |
4911 | ||
4912 | The function @code{gpgme_op_decrypt_ext} is the same as | |
4913 | @code{gpgme_op_decrypt_ext} but has an additional argument | |
4914 | @var{flags}. If @var{flags} is 0 both function behave identically. | |
4915 | ||
4916 | The value in @var{flags} is a bitwise-or combination of one or | |
4917 | multiple of the following bit values: | |
4918 | ||
4919 | @table @code | |
4920 | @item GPGME_DECRYPT_VERIFY | |
4921 | The @code{GPGME_DECRYPT_VERIFY} symbol specifies that this function | |
4922 | shall exacty act as @code{gpgme_op_decrypt_verify}. | |
4923 | ||
4924 | @item GPGME_DECRYPT_UNWRAP | |
4925 | The @code{GPGME_DECRYPT_UNWRAP} symbol specifies that the output shall | |
4926 | be an OpenPGP message with only the encryption layer removed. This | |
4927 | requires GnuPG 2.1.12 and works only for OpenPGP. This is the | |
4928 | counterpart to @code{GPGME_ENCRYPT_WRAP}. | |
4929 | ||
4930 | @end table | |
4931 | ||
4932 | The function returns the error codes as descriped for | |
4933 | @code{gpgme_op_decrypt} respective @code{gpgme_op_encrypt}. | |
4934 | @end deftypefun | |
4935 | ||
4936 | @deftypefun gpgme_error_t gpgme_op_decrypt_ext_start ( @ | |
4937 | @w{gpgme_ctx_t @var{ctx}}, @ | |
4938 | @w{gpgme_decrypt_flags_t @var{flags}}, @ | |
4939 | @w{gpgme_data_t @var{cipher}}, @ | |
4940 | @w{gpgme_data_t @var{plain}}) | |
4941 | ||
4942 | The function @code{gpgme_op_decrypt_ext_start} initiates a | |
4943 | @code{gpgme_op_decrypt_ext} operation. It can be completed by calling | |
4944 | @code{gpgme_wait} on the context. @xref{Waiting For Completion}. | |
4945 | ||
4946 | The function returns the error code @code{GPG_ERR_NO_ERROR} if the | |
4947 | operation could be started successfully, and @code{GPG_ERR_INV_VALUE} | |
4948 | if @var{cipher} or @var{plain} is not a valid pointer. | |
4949 | @end deftypefun | |
4950 | ||
4951 | ||
4761 | 4952 | @deftp {Data type} {gpgme_recipient_t} |
4762 | 4953 | This is a pointer to a structure used to store information about the |
4763 | 4954 | recipient of an encrypted text which is decrypted in a |
4947 | 5138 | This is a bit vector giving a summary of the signature status. It |
4948 | 5139 | provides an easy interface to a defined semantic of the signature |
4949 | 5140 | status. Checking just one bit is sufficient to see whether a |
4950 | signature is valid without any restrictions. | |
5141 | signature is valid without any restrictions. This means that | |
5142 | you can check for GPGME_SIGSUM_VALID like this: | |
5143 | ||
5144 | @example | |
5145 | if ((sig.summary & GPGME_SIGSUM_VALID)) | |
5146 | @{ | |
5147 | ..do stuff if valid.. | |
5148 | @} | |
5149 | else | |
5150 | @{ | |
5151 | ..do stuff if not fully valid.. | |
5152 | @} | |
5153 | @end example | |
4951 | 5154 | |
4952 | 5155 | The defined bits are: |
4953 | 5156 | @table @code |
5479 | 5682 | |
5480 | 5683 | @item GPGME_ENCRYPT_SYMMETRIC |
5481 | 5684 | The @code{GPGME_ENCRYPT_SYMMETRIC} symbol specifies that the |
5482 | output should be additionally encrypted symmetically even | |
5685 | output should be additionally encrypted symmetrically even | |
5483 | 5686 | if recipients are provided. This feature is only supported for |
5484 | 5687 | for the OpenPGP crypto engine. |
5688 | ||
5689 | @item GPGME_ENCRYPT_THROW_KEYIDS | |
5690 | The @code{GPGME_ENCRYPT_THROW_KEYIDS} symbols requests that the | |
5691 | identifiers for the decrption keys are not included in the ciphertext. | |
5692 | On the receiving side, the use of this flag may slow down the | |
5693 | decryption process because all available secret keys must be tried. | |
5694 | This flag is only honored for OpenPGP encryption. | |
5695 | ||
5696 | @item GPGME_ENCRYPT_WRAP | |
5697 | The @code{GPGME_ENCRYPT_WRAP} symbol specifies that the input is an | |
5698 | OpenPGP message and not a plain data. This is the counterpart to | |
5699 | @code{GPGME_DECRYPT_UNWRAP}. | |
5485 | 5700 | |
5486 | 5701 | @end table |
5487 | 5702 | |
5561 | 5776 | for the OpenPGP crypto engine. |
5562 | 5777 | @end deftypefun |
5563 | 5778 | |
5564 | @deftypefun gpgme_error_t gpgme_op_encrypt_sign_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{recp}}, @w{gpgme_encrypt_flags_t @var{flags}}, @w{gpgme_data_t @var{plain}}, @w{gpgme_data_t @var{cipher}}) | |
5779 | @deftypefun gpgme_error_t gpgme_op_encrypt_sign_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_key_t @var{recp}[]}, @w{gpgme_encrypt_flags_t @var{flags}}, @w{gpgme_data_t @var{plain}}, @w{gpgme_data_t @var{cipher}}) | |
5565 | 5780 | The function @code{gpgme_op_encrypt_sign_start} initiates a |
5566 | 5781 | @code{gpgme_op_encrypt_sign} operation. It can be completed by |
5567 | 5782 | calling @code{gpgme_wait} on the context. @xref{Waiting For |
0 | 0 | # This is a template. The dist target uses it to create the real file. |
1 | 1 | Summary: GPGME - GnuPG Made Easy |
2 | 2 | Name: gpgme |
3 | Version: 1.8.0 | |
3 | Version: 1.9.0 | |
4 | 4 | Release: 1 |
5 | 5 | URL: https://gnupg.org/gpgme.html |
6 | 6 | Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz |
62 | 62 | |
63 | 63 | set_target_properties(Gpgmepp PROPERTIES |
64 | 64 | INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@" |
65 | INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme@libsuffix@;@LIBASSUAN_LIBS@" | |
66 | IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp.so" | |
65 | INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme.so;@LIBASSUAN_LIBS@" | |
66 | IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp@libsuffix@" | |
67 | 67 | ) |
68 | 68 | |
69 | 69 | if(CMAKE_VERSION VERSION_LESS 2.8.12) |
30 | 30 | signingresult.cpp encryptionresult.cpp \ |
31 | 31 | engineinfo.cpp gpgsetexpirytimeeditinteractor.cpp \ |
32 | 32 | gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \ |
33 | gpgadduserideditinteractor.cpp defaultassuantransaction.cpp \ | |
33 | gpgadduserideditinteractor.cpp gpggencardkeyinteractor.cpp \ | |
34 | defaultassuantransaction.cpp \ | |
34 | 35 | scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \ |
35 | 36 | vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp |
36 | 37 | |
41 | 42 | gpgadduserideditinteractor.h gpgagentgetinfoassuantransaction.h \ |
42 | 43 | gpgmefw.h gpgsetexpirytimeeditinteractor.h \ |
43 | 44 | gpgsetownertrusteditinteractor.h gpgsignkeyeditinteractor.h \ |
45 | gpggencardkeyinteractor.h \ | |
44 | 46 | importresult.h keygenerationresult.h key.h keylistresult.h \ |
45 | 47 | notation.h result.h scdgetinfoassuantransaction.h signingresult.h \ |
46 | 48 | trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \ |
68 | 70 | libgpgmepp_la_LDFLAGS = -no-undefined -version-info \ |
69 | 71 | @LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@ |
70 | 72 | |
73 | if HAVE_MACOS_SYSTEM | |
74 | libsuffix=.dylib | |
75 | else | |
76 | libsuffix=.so | |
77 | endif | |
78 | ||
71 | 79 | if HAVE_W32_SYSTEM |
72 | 80 | GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in |
73 | 81 | sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ |
76 | 84 | else |
77 | 85 | GpgmeppConfig.cmake: GpgmeppConfig.cmake.in |
78 | 86 | sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ |
87 | sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \ | |
79 | 88 | sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ |
80 | 89 | endif |
81 | 90 | install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake |
279 | 279 | return std::unique_ptr<Context>(new Context(ctx)); |
280 | 280 | } |
281 | 281 | |
282 | void Context::setDecryptionFlags(DecryptionFlags flags) | |
283 | { | |
284 | d->decryptFlags = flags; | |
285 | } | |
286 | ||
282 | 287 | // |
283 | 288 | // |
284 | 289 | // Context::Private |
293 | 298 | lastAssuanInquireData(Data::null), |
294 | 299 | lastAssuanTransaction(), |
295 | 300 | lastEditInteractor(), |
296 | lastCardEditInteractor() | |
301 | lastCardEditInteractor(), | |
302 | decryptFlags(DecryptNone) | |
297 | 303 | { |
298 | 304 | |
299 | 305 | } |
903 | 909 | return std::move(d->lastAssuanTransaction); |
904 | 910 | } |
905 | 911 | |
906 | DecryptionResult Context::decrypt(const Data &cipherText, Data &plainText) | |
912 | DecryptionResult Context::decrypt(const Data &cipherText, Data &plainText, const DecryptionFlags flags) | |
907 | 913 | { |
908 | 914 | d->lastop = Private::Decrypt; |
909 | 915 | const Data::Private *const cdp = cipherText.impl(); |
910 | 916 | Data::Private *const pdp = plainText.impl(); |
911 | d->lasterr = gpgme_op_decrypt(d->ctx, cdp ? cdp->data : 0, pdp ? pdp->data : 0); | |
917 | d->lasterr = gpgme_op_decrypt_ext(d->ctx, static_cast<gpgme_decrypt_flags_t> (d->decryptFlags | flags), cdp ? cdp->data : 0, pdp ? pdp->data : 0); | |
912 | 918 | return DecryptionResult(d->ctx, Error(d->lasterr)); |
913 | 919 | } |
914 | 920 | |
915 | Error Context::startDecryption(const Data &cipherText, Data &plainText) | |
921 | DecryptionResult Context::decrypt(const Data &cipherText, Data &plainText) | |
922 | { | |
923 | return decrypt(cipherText, plainText, DecryptNone); | |
924 | } | |
925 | ||
926 | Error Context::startDecryption(const Data &cipherText, Data &plainText, const DecryptionFlags flags) | |
916 | 927 | { |
917 | 928 | d->lastop = Private::Decrypt; |
918 | 929 | const Data::Private *const cdp = cipherText.impl(); |
919 | 930 | Data::Private *const pdp = plainText.impl(); |
920 | return Error(d->lasterr = gpgme_op_decrypt_start(d->ctx, cdp ? cdp->data : 0, pdp ? pdp->data : 0)); | |
931 | return Error(d->lasterr = gpgme_op_decrypt_ext_start(d->ctx, static_cast<gpgme_decrypt_flags_t> (d->decryptFlags | flags), | |
932 | cdp ? cdp->data : 0, pdp ? pdp->data : 0)); | |
933 | } | |
934 | ||
935 | Error Context::startDecryption(const Data &cipherText, Data &plainText) | |
936 | { | |
937 | return startDecryption(cipherText, plainText, DecryptNone); | |
921 | 938 | } |
922 | 939 | |
923 | 940 | DecryptionResult Context::decryptionResult() const |
972 | 989 | } |
973 | 990 | } |
974 | 991 | |
975 | std::pair<DecryptionResult, VerificationResult> Context::decryptAndVerify(const Data &cipherText, Data &plainText) | |
992 | std::pair<DecryptionResult, VerificationResult> Context::decryptAndVerify(const Data &cipherText, Data &plainText, DecryptionFlags flags) | |
976 | 993 | { |
977 | 994 | d->lastop = Private::DecryptAndVerify; |
978 | 995 | const Data::Private *const cdp = cipherText.impl(); |
979 | 996 | Data::Private *const pdp = plainText.impl(); |
980 | d->lasterr = gpgme_op_decrypt_verify(d->ctx, cdp ? cdp->data : 0, pdp ? pdp->data : 0); | |
997 | d->lasterr = gpgme_op_decrypt_ext(d->ctx, static_cast<gpgme_decrypt_flags_t> (d->decryptFlags | flags | DecryptVerify), | |
998 | cdp ? cdp->data : 0, pdp ? pdp->data : 0); | |
981 | 999 | return std::make_pair(DecryptionResult(d->ctx, Error(d->lasterr)), |
982 | 1000 | VerificationResult(d->ctx, Error(d->lasterr))); |
983 | 1001 | } |
984 | 1002 | |
985 | Error Context::startCombinedDecryptionAndVerification(const Data &cipherText, Data &plainText) | |
1003 | std::pair<DecryptionResult, VerificationResult> Context::decryptAndVerify(const Data &cipherText, Data &plainText) | |
1004 | { | |
1005 | return decryptAndVerify(cipherText, plainText, DecryptNone); | |
1006 | } | |
1007 | ||
1008 | Error Context::startCombinedDecryptionAndVerification(const Data &cipherText, Data &plainText, DecryptionFlags flags) | |
986 | 1009 | { |
987 | 1010 | d->lastop = Private::DecryptAndVerify; |
988 | 1011 | const Data::Private *const cdp = cipherText.impl(); |
989 | 1012 | Data::Private *const pdp = plainText.impl(); |
990 | return Error(d->lasterr = gpgme_op_decrypt_verify_start(d->ctx, cdp ? cdp->data : 0, pdp ? pdp->data : 0)); | |
1013 | return Error(d->lasterr = gpgme_op_decrypt_ext_start(d->ctx, static_cast<gpgme_decrypt_flags_t> (d->decryptFlags | flags | DecryptVerify), cdp ? cdp->data : 0, pdp ? pdp->data : 0)); | |
1014 | } | |
1015 | ||
1016 | Error Context::startCombinedDecryptionAndVerification(const Data &cipherText, Data &plainText) | |
1017 | { | |
1018 | return startCombinedDecryptionAndVerification(cipherText, plainText, DecryptNone); | |
991 | 1019 | } |
992 | 1020 | |
993 | 1021 | unsigned int to_auditlog_flags(unsigned int flags) |
1373 | 1401 | { |
1374 | 1402 | return Error(d->lasterr = gpgme_op_tofu_policy_start(d->ctx, |
1375 | 1403 | k.impl(), to_tofu_policy_t(policy))); |
1404 | } | |
1405 | ||
1406 | Error Context::addUid(const Key &k, const char *userid) | |
1407 | { | |
1408 | return Error(d->lasterr = gpgme_op_adduid(d->ctx, | |
1409 | k.impl(), userid, 0)); | |
1410 | } | |
1411 | ||
1412 | Error Context::startAddUid(const Key &k, const char *userid) | |
1413 | { | |
1414 | return Error(d->lasterr = gpgme_op_adduid_start(d->ctx, | |
1415 | k.impl(), userid, 0)); | |
1416 | } | |
1417 | ||
1418 | Error Context::revUid(const Key &k, const char *userid) | |
1419 | { | |
1420 | return Error(d->lasterr = gpgme_op_revuid(d->ctx, | |
1421 | k.impl(), userid, 0)); | |
1422 | } | |
1423 | ||
1424 | Error Context::startRevUid(const Key &k, const char *userid) | |
1425 | { | |
1426 | return Error(d->lasterr = gpgme_op_revuid_start(d->ctx, | |
1427 | k.impl(), userid, 0)); | |
1376 | 1428 | } |
1377 | 1429 | |
1378 | 1430 | // Engine Spawn stuff |
213 | 213 | GpgME::Error edit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out); |
214 | 214 | GpgME::Error startEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out); |
215 | 215 | |
216 | Error addUid(const Key &key, const char *userid); | |
217 | Error startAddUid(const Key &key, const char *userid); | |
218 | ||
219 | Error revUid(const Key &key, const char *userid); | |
220 | Error startRevUid(const Key &key, const char *userid); | |
221 | ||
216 | 222 | // using TofuInfo::Policy |
217 | 223 | Error setTofuPolicy(const Key &k, unsigned int policy); |
218 | 224 | Error setTofuPolicyStart(const Key &k, unsigned int policy); |
254 | 260 | // |
255 | 261 | // Crypto Operations |
256 | 262 | // |
257 | // | |
263 | ||
264 | enum DecryptionFlags { | |
265 | // Keep in line with core's flags | |
266 | DecryptNone = 0, | |
267 | DecryptVerify = 1, | |
268 | DecryptUnwrap = 128, | |
269 | DecryptMaxValue = 0x80000000 | |
270 | }; | |
258 | 271 | |
259 | 272 | // |
260 | 273 | // Decryption |
261 | 274 | // |
275 | ||
276 | // Alternative way to set decryption flags as they were added only in | |
277 | // 1.9.0 and so other API can still be used but with 1.9.0 additionally | |
278 | // flags can be set. | |
279 | void setDecryptionFlags (const DecryptionFlags flags); | |
262 | 280 | |
263 | 281 | DecryptionResult decrypt(const Data &cipherText, Data &plainText); |
264 | 282 | GpgME::Error startDecryption(const Data &cipherText, Data &plainText); |
283 | DecryptionResult decrypt(const Data &cipherText, Data &plainText, const DecryptionFlags flags); | |
284 | GpgME::Error startDecryption(const Data &cipherText, Data &plainText, const DecryptionFlags flags); | |
265 | 285 | DecryptionResult decryptionResult() const; |
266 | 286 | |
267 | 287 | // |
279 | 299 | // |
280 | 300 | |
281 | 301 | std::pair<DecryptionResult, VerificationResult> decryptAndVerify(const Data &cipherText, Data &plainText); |
302 | std::pair<DecryptionResult, VerificationResult> decryptAndVerify(const Data &cipherText, Data &plainText, const DecryptionFlags flags); | |
282 | 303 | GpgME::Error startCombinedDecryptionAndVerification(const Data &cipherText, Data &plainText); |
304 | GpgME::Error startCombinedDecryptionAndVerification(const Data &cipherText, Data &plainText, const DecryptionFlags flags); | |
283 | 305 | // use verificationResult() and decryptionResult() to retrieve the result objects... |
284 | 306 | |
285 | 307 | // |
318 | 340 | Prepare = 4, |
319 | 341 | ExpectSign = 8, |
320 | 342 | NoCompress = 16, |
321 | Symmetric = 32 | |
343 | Symmetric = 32, | |
344 | ThrowKeyIds = 64, | |
345 | EncryptWrap = 128 | |
322 | 346 | }; |
323 | 347 | EncryptionResult encrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags); |
324 | 348 | GpgME::Error encryptSymmetrically(const Data &plainText, Data &cipherText); |
76 | 76 | Data lastAssuanInquireData; |
77 | 77 | std::unique_ptr<AssuanTransaction> lastAssuanTransaction; |
78 | 78 | std::unique_ptr<EditInteractor> lastEditInteractor, lastCardEditInteractor; |
79 | DecryptionFlags decryptFlags; | |
79 | 80 | }; |
80 | 81 | |
81 | 82 | } // namespace GpgME |
24 | 24 | #endif |
25 | 25 | |
26 | 26 | #include "data_p.h" |
27 | #include "context_p.h" | |
27 | 28 | #include <error.h> |
28 | 29 | #include <interfaces/dataprovider.h> |
29 | 30 | |
229 | 230 | { |
230 | 231 | return gpgme_data_seek(d->data, offset, whence); |
231 | 232 | } |
233 | ||
234 | std::vector<GpgME::Key> GpgME::Data::toKeys(Protocol proto) const | |
235 | { | |
236 | std::vector<GpgME::Key> ret; | |
237 | if (isNull()) { | |
238 | return ret; | |
239 | } | |
240 | auto ctx = GpgME::Context::createForProtocol(proto); | |
241 | if (!ctx) { | |
242 | return ret; | |
243 | } | |
244 | ||
245 | if (gpgme_op_keylist_from_data_start (ctx->impl()->ctx, d->data, 0)) { | |
246 | return ret; | |
247 | } | |
248 | ||
249 | gpgme_key_t key; | |
250 | while (!gpgme_op_keylist_next (ctx->impl()->ctx, &key)) { | |
251 | ret.push_back(GpgME::Key(key, false)); | |
252 | } | |
253 | delete ctx; | |
254 | return ret; | |
255 | } |
23 | 23 | #define __GPGMEPP_DATA_H__ |
24 | 24 | |
25 | 25 | #include "global.h" |
26 | #include "key.h" | |
26 | 27 | |
27 | 28 | #include <sys/types.h> // for size_t, off_t |
28 | 29 | #include <cstdio> // FILE |
108 | 109 | ssize_t write(const void *buffer, size_t length); |
109 | 110 | off_t seek(off_t offset, int whence); |
110 | 111 | |
112 | /** Try to parse the data to a key object using the | |
113 | * Protocol proto. Returns an empty list on error.*/ | |
114 | std::vector<Key> toKeys(const Protocol proto = Protocol::OpenPGP) const; | |
115 | ||
111 | 116 | class Private; |
112 | 117 | Private *impl() |
113 | 118 | { |
211 | 211 | case GPGME_STATUS_KEY_CREATED: |
212 | 212 | case GPGME_STATUS_NEED_PASSPHRASE_SYM: |
213 | 213 | case GPGME_STATUS_SC_OP_FAILURE: |
214 | case GPGME_STATUS_CARDCTRL: | |
215 | case GPGME_STATUS_BACKUP_KEY_CREATED: | |
214 | 216 | return false; |
215 | 217 | default: |
216 | 218 | return true; |
0 | /* | |
1 | gpggencardkeyinteractor.cpp - Edit Interactor to generate a key on a card | |
2 | Copyright (C) 2017 Intevation GmbH | |
3 | ||
4 | This file is part of GPGME++. | |
5 | ||
6 | GPGME++ is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Library General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2 of the License, or (at your option) any later version. | |
10 | ||
11 | GPGME++ is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU Library General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Library General Public License | |
17 | along with GPGME++; see the file COPYING.LIB. If not, write to the | |
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
19 | Boston, MA 02110-1301, USA. | |
20 | */ | |
21 | ||
22 | #ifdef HAVE_CONFIG_H | |
23 | #include "config.h" | |
24 | #endif | |
25 | ||
26 | #include "gpggencardkeyinteractor.h" | |
27 | ||
28 | #include "error.h" | |
29 | ||
30 | #include <gpgme.h> | |
31 | ||
32 | using namespace GpgME; | |
33 | ||
34 | class GpgGenCardKeyInteractor::Private | |
35 | { | |
36 | public: | |
37 | Private() : keysize(2048), backup(false) | |
38 | { | |
39 | ||
40 | } | |
41 | std::string name, email, backupFileName, expiry, serial; | |
42 | int keysize; | |
43 | bool backup; | |
44 | }; | |
45 | ||
46 | GpgGenCardKeyInteractor::~GpgGenCardKeyInteractor() {} | |
47 | ||
48 | GpgGenCardKeyInteractor::GpgGenCardKeyInteractor(const std::string &serial): | |
49 | d(new Private) | |
50 | { | |
51 | d->serial = serial; | |
52 | } | |
53 | ||
54 | void GpgGenCardKeyInteractor::setNameUtf8(const std::string &name) | |
55 | { | |
56 | d->name = name; | |
57 | } | |
58 | ||
59 | void GpgGenCardKeyInteractor::setEmailUtf8(const std::string &email) | |
60 | { | |
61 | d->email = email; | |
62 | } | |
63 | ||
64 | void GpgGenCardKeyInteractor::setDoBackup(bool value) | |
65 | { | |
66 | d->backup = value; | |
67 | } | |
68 | ||
69 | void GpgGenCardKeyInteractor::setKeySize(int value) | |
70 | { | |
71 | d->keysize = value; | |
72 | } | |
73 | ||
74 | void GpgGenCardKeyInteractor::setExpiry(const std::string &timeStr) | |
75 | { | |
76 | d->expiry = timeStr; | |
77 | } | |
78 | ||
79 | std::string GpgGenCardKeyInteractor::backupFileName() const | |
80 | { | |
81 | return d->backupFileName; | |
82 | } | |
83 | ||
84 | namespace GpgGenCardKeyInteractor_Private | |
85 | { | |
86 | enum { | |
87 | START = EditInteractor::StartState, | |
88 | DO_ADMIN, | |
89 | EXPIRE, | |
90 | ||
91 | GOT_SERIAL, | |
92 | COMMAND, | |
93 | NAME, | |
94 | EMAIL, | |
95 | COMMENT, | |
96 | BACKUP, | |
97 | REPLACE, | |
98 | SIZE, | |
99 | SIZE2, | |
100 | SIZE3, | |
101 | BACKUP_KEY_CREATED, | |
102 | KEY_CREATED, | |
103 | QUIT, | |
104 | SAVE, | |
105 | ||
106 | ERROR = EditInteractor::ErrorState | |
107 | }; | |
108 | } | |
109 | ||
110 | const char *GpgGenCardKeyInteractor::action(Error &err) const | |
111 | { | |
112 | ||
113 | using namespace GpgGenCardKeyInteractor_Private; | |
114 | ||
115 | switch (state()) { | |
116 | case DO_ADMIN: | |
117 | return "admin"; | |
118 | case COMMAND: | |
119 | return "generate"; | |
120 | case NAME: | |
121 | return d->name.c_str(); | |
122 | case EMAIL: | |
123 | return d->email.c_str(); | |
124 | case EXPIRE: | |
125 | return d->expiry.c_str(); | |
126 | case BACKUP: | |
127 | return d->backup ? "Y" : "N"; | |
128 | case REPLACE: | |
129 | return "Y"; | |
130 | case SIZE: | |
131 | case SIZE2: | |
132 | case SIZE3: | |
133 | return std::to_string(d->keysize).c_str(); | |
134 | case COMMENT: | |
135 | return ""; | |
136 | case SAVE: | |
137 | return "Y"; | |
138 | case QUIT: | |
139 | return "quit"; | |
140 | case KEY_CREATED: | |
141 | case START: | |
142 | case GOT_SERIAL: | |
143 | case BACKUP_KEY_CREATED: | |
144 | case ERROR: | |
145 | return 0; | |
146 | default: | |
147 | err = Error::fromCode(GPG_ERR_GENERAL); | |
148 | return 0; | |
149 | } | |
150 | } | |
151 | ||
152 | unsigned int GpgGenCardKeyInteractor::nextState(unsigned int status, const char *args, Error &err) const | |
153 | { | |
154 | ||
155 | static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL); | |
156 | static const Error INV_NAME_ERROR = Error::fromCode(GPG_ERR_INV_NAME); | |
157 | static const Error INV_EMAIL_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID); | |
158 | static const Error INV_COMMENT_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID); | |
159 | ||
160 | if (needsNoResponse(status)) { | |
161 | return state(); | |
162 | } | |
163 | ||
164 | using namespace GpgGenCardKeyInteractor_Private; | |
165 | ||
166 | switch (state()) { | |
167 | case START: | |
168 | if (status == GPGME_STATUS_CARDCTRL && | |
169 | !d->serial.empty()) { | |
170 | const std::string sArgs = args; | |
171 | if (sArgs.find(d->serial) == std::string::npos) { | |
172 | // Wrong smartcard | |
173 | err = Error::fromCode(GPG_ERR_WRONG_CARD); | |
174 | return ERROR; | |
175 | } else { | |
176 | printf("EditInteractor: Confirmed S/N: %s %s\n", | |
177 | d->serial.c_str(), sArgs.c_str()); | |
178 | } | |
179 | return GOT_SERIAL; | |
180 | } else if (d->serial.empty()) { | |
181 | return GOT_SERIAL; | |
182 | } | |
183 | err = GENERAL_ERROR; | |
184 | return ERROR; | |
185 | case GOT_SERIAL: | |
186 | if (status == GPGME_STATUS_GET_LINE && | |
187 | strcmp(args, "cardedit.prompt") == 0) { | |
188 | return DO_ADMIN; | |
189 | } | |
190 | err = GENERAL_ERROR; | |
191 | return ERROR; | |
192 | case DO_ADMIN: | |
193 | if (status == GPGME_STATUS_GET_LINE && | |
194 | strcmp(args, "cardedit.prompt") == 0) { | |
195 | return COMMAND; | |
196 | } | |
197 | err = GENERAL_ERROR; | |
198 | return ERROR; | |
199 | case COMMAND: | |
200 | if (status == GPGME_STATUS_GET_LINE && | |
201 | strcmp(args, "cardedit.genkeys.backup_enc") == 0) { | |
202 | return BACKUP; | |
203 | } | |
204 | err = GENERAL_ERROR; | |
205 | return ERROR; | |
206 | case BACKUP: | |
207 | if (status == GPGME_STATUS_GET_BOOL && | |
208 | strcmp(args, "cardedit.genkeys.replace_keys") == 0) { | |
209 | return REPLACE; | |
210 | } | |
211 | if (status == GPGME_STATUS_GET_LINE && | |
212 | strcmp(args, "cardedit.genkeys.size") == 0) { | |
213 | return SIZE; | |
214 | } | |
215 | err = GENERAL_ERROR; | |
216 | return ERROR; | |
217 | case REPLACE: | |
218 | if (status == GPGME_STATUS_GET_LINE && | |
219 | strcmp(args, "cardedit.genkeys.size") == 0) { | |
220 | printf("Moving to SIZE\n"); | |
221 | return SIZE; | |
222 | } | |
223 | err = GENERAL_ERROR; | |
224 | return ERROR; | |
225 | case SIZE: | |
226 | if (status == GPGME_STATUS_GET_LINE && | |
227 | strcmp(args, "cardedit.genkeys.size") == 0) { | |
228 | return SIZE2; | |
229 | } | |
230 | if (status == GPGME_STATUS_GET_LINE && | |
231 | strcmp(args, "keygen.valid") == 0) { | |
232 | return EXPIRE; | |
233 | } | |
234 | err = GENERAL_ERROR; | |
235 | return ERROR; | |
236 | case SIZE2: | |
237 | if (status == GPGME_STATUS_GET_LINE && | |
238 | strcmp(args, "cardedit.genkeys.size") == 0) { | |
239 | return SIZE3; | |
240 | } | |
241 | if (status == GPGME_STATUS_GET_LINE && | |
242 | strcmp(args, "keygen.valid") == 0) { | |
243 | return EXPIRE; | |
244 | } | |
245 | err = GENERAL_ERROR; | |
246 | return ERROR; | |
247 | case SIZE3: | |
248 | if (status == GPGME_STATUS_GET_LINE && | |
249 | strcmp(args, "keygen.valid") == 0) { | |
250 | return EXPIRE; | |
251 | } | |
252 | err = GENERAL_ERROR; | |
253 | return ERROR; | |
254 | case EXPIRE: | |
255 | if (status == GPGME_STATUS_GET_LINE && | |
256 | strcmp(args, "keygen.name") == 0) { | |
257 | return NAME; | |
258 | } | |
259 | err = GENERAL_ERROR; | |
260 | return ERROR; | |
261 | case NAME: | |
262 | if (status == GPGME_STATUS_GET_LINE && | |
263 | strcmp(args, "keygen.email") == 0) { | |
264 | return EMAIL; | |
265 | } | |
266 | err = GENERAL_ERROR; | |
267 | if (status == GPGME_STATUS_GET_LINE && | |
268 | strcmp(args, "keygen.name") == 0) { | |
269 | err = INV_NAME_ERROR; | |
270 | } | |
271 | return ERROR; | |
272 | case EMAIL: | |
273 | if (status == GPGME_STATUS_GET_LINE && | |
274 | strcmp(args, "keygen.comment") == 0) { | |
275 | return COMMENT; | |
276 | } | |
277 | err = GENERAL_ERROR; | |
278 | if (status == GPGME_STATUS_GET_LINE && | |
279 | strcmp(args, "keygen.email") == 0) { | |
280 | err = INV_EMAIL_ERROR; | |
281 | } | |
282 | return ERROR; | |
283 | case COMMENT: | |
284 | if (status == GPGME_STATUS_BACKUP_KEY_CREATED) { | |
285 | std::string sArgs = args; | |
286 | const auto pos = sArgs.rfind(" "); | |
287 | if (pos != std::string::npos) { | |
288 | d->backupFileName = sArgs.substr(pos + 1); | |
289 | return BACKUP_KEY_CREATED; | |
290 | } | |
291 | } | |
292 | if (status == GPGME_STATUS_KEY_CREATED) { | |
293 | return KEY_CREATED; | |
294 | } | |
295 | if (status == GPGME_STATUS_GET_LINE && | |
296 | strcmp(args, "keyedit.prompt") == 0) { | |
297 | return QUIT; | |
298 | } | |
299 | err = GENERAL_ERROR; | |
300 | if (status == GPGME_STATUS_GET_LINE && | |
301 | strcmp(args, "keygen.comment") == 0) { | |
302 | err = INV_COMMENT_ERROR; | |
303 | } | |
304 | return ERROR; | |
305 | case BACKUP_KEY_CREATED: | |
306 | if (status == GPGME_STATUS_KEY_CREATED) { | |
307 | return KEY_CREATED; | |
308 | } | |
309 | err = GENERAL_ERROR; | |
310 | return ERROR; | |
311 | case KEY_CREATED: | |
312 | return QUIT; | |
313 | case QUIT: | |
314 | if (status == GPGME_STATUS_GET_LINE && | |
315 | strcmp(args, "cardedit.prompt") == 0) { | |
316 | return QUIT; | |
317 | } | |
318 | err = GENERAL_ERROR; | |
319 | return ERROR; | |
320 | case ERROR: | |
321 | if (status == GPGME_STATUS_GET_LINE && | |
322 | strcmp(args, "keyedit.prompt") == 0) { | |
323 | return QUIT; | |
324 | } | |
325 | err = lastError(); | |
326 | return ERROR; | |
327 | default: | |
328 | err = GENERAL_ERROR; | |
329 | return ERROR; | |
330 | } | |
331 | } |
0 | /* | |
1 | gpggencardkeyinteractor.h - Edit Interactor to generate a key on a card | |
2 | Copyright (C) 2017 Intevation GmbH | |
3 | ||
4 | This file is part of GPGME++. | |
5 | ||
6 | GPGME++ is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Library General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2 of the License, or (at your option) any later version. | |
10 | ||
11 | GPGME++ is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU Library General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Library General Public License | |
17 | along with GPGME++; see the file COPYING.LIB. If not, write to the | |
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
19 | Boston, MA 02110-1301, USA. | |
20 | */ | |
21 | ||
22 | #ifndef __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__ | |
23 | #define __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__ | |
24 | ||
25 | #include <editinteractor.h> | |
26 | ||
27 | #include <string> | |
28 | #include <memory> | |
29 | ||
30 | namespace GpgME | |
31 | { | |
32 | ||
33 | class GPGMEPP_EXPORT GpgGenCardKeyInteractor: public EditInteractor | |
34 | { | |
35 | public: | |
36 | /** Edit interactor to generate a key on a smartcard. | |
37 | * | |
38 | * The \a serialnumber argument is intended to safeguard | |
39 | * against accidentally working on the wrong smartcard. | |
40 | * | |
41 | * The edit interactor will fail if the card did not match. | |
42 | * | |
43 | * @param serialnumber: Serialnumber of the intended card. | |
44 | **/ | |
45 | explicit GpgGenCardKeyInteractor(const std::string &serialnumber); | |
46 | ~GpgGenCardKeyInteractor(); | |
47 | ||
48 | /** Set the key sizes for the subkeys (default 2048) */ | |
49 | void setKeySize(int size); | |
50 | ||
51 | void setNameUtf8(const std::string &name); | |
52 | void setEmailUtf8(const std::string &email); | |
53 | ||
54 | void setDoBackup(bool value); | |
55 | void setExpiry(const std::string &timeString); | |
56 | ||
57 | std::string backupFileName() const; | |
58 | ||
59 | private: | |
60 | /* reimp */ const char *action(Error &err) const; | |
61 | /* reimp */ unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const; | |
62 | ||
63 | private: | |
64 | class Private; | |
65 | std::shared_ptr<Private> d; | |
66 | }; | |
67 | ||
68 | } // namespace GpgME | |
69 | ||
70 | #endif // __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__ |
231 | 231 | bool Key::isQualified() const |
232 | 232 | { |
233 | 233 | return key && key->is_qualified; |
234 | } | |
235 | ||
236 | bool Key::isDeVs() const | |
237 | { | |
238 | return key && key->subkeys && key->subkeys->is_de_vs; | |
234 | 239 | } |
235 | 240 | |
236 | 241 | const char *Key::issuerSerial() const |
340 | 345 | KeyListMode::Validate | |
341 | 346 | KeyListMode::WithTofu); |
342 | 347 | Error err; |
343 | auto newKey = ctx->key(primaryFingerprint(), err, hasSecret()); | |
348 | auto newKey = ctx->key(primaryFingerprint(), err, true); | |
349 | // Not secret so we get the information from the pubring. | |
350 | if (newKey.isNull()) | |
351 | { | |
352 | newKey = ctx->key(primaryFingerprint(), err, false); | |
353 | } | |
344 | 354 | delete ctx; |
345 | 355 | if (err) { |
346 | 356 | return; |
463 | 473 | return subkey && subkey->is_qualified; |
464 | 474 | } |
465 | 475 | |
476 | bool Subkey::isDeVs() const | |
477 | { | |
478 | return subkey && subkey->is_de_vs; | |
479 | } | |
480 | ||
466 | 481 | bool Subkey::isCardKey() const |
467 | 482 | { |
468 | 483 | return subkey && subkey->is_cardkey; |
470 | 485 | |
471 | 486 | const char *Subkey::cardSerialNumber() const |
472 | 487 | { |
473 | return subkey ? subkey->card_number : 0 ; | |
488 | return subkey ? subkey->card_number : nullptr; | |
489 | } | |
490 | ||
491 | const char *Subkey::keyGrip() const | |
492 | { | |
493 | return subkey ? subkey->keygrip : nullptr; | |
474 | 494 | } |
475 | 495 | |
476 | 496 | bool Subkey::isSecret() const |
893 | 913 | |
894 | 914 | std::string UserID::addrSpec() const |
895 | 915 | { |
896 | return addrSpecFromString(email()); | |
916 | if (!uid || !uid->address) { | |
917 | return std::string(); | |
918 | } | |
919 | ||
920 | return uid->address; | |
921 | } | |
922 | ||
923 | Error UserID::revoke() | |
924 | { | |
925 | if (isNull()) { | |
926 | return Error::fromCode(GPG_ERR_GENERAL); | |
927 | } | |
928 | auto ctx = Context::createForProtocol(parent().protocol()); | |
929 | if (!ctx) { | |
930 | return Error::fromCode(GPG_ERR_INV_ENGINE); | |
931 | } | |
932 | Error ret = ctx->revUid(key, id()); | |
933 | delete ctx; | |
934 | return ret; | |
935 | } | |
936 | ||
937 | Error Key::addUid(const char *uid) | |
938 | { | |
939 | if (isNull()) { | |
940 | return Error::fromCode(GPG_ERR_GENERAL); | |
941 | } | |
942 | auto ctx = Context::createForProtocol(protocol()); | |
943 | if (!ctx) { | |
944 | return Error::fromCode(GPG_ERR_INV_ENGINE); | |
945 | } | |
946 | Error ret = ctx->addUid(key, uid); | |
947 | delete ctx; | |
948 | return ret; | |
897 | 949 | } |
898 | 950 | |
899 | 951 | std::ostream &operator<<(std::ostream &os, const UserID &uid) |
902 | 954 | if (!uid.isNull()) { |
903 | 955 | os << "\n name: " << protect(uid.name()) |
904 | 956 | << "\n email: " << protect(uid.email()) |
957 | << "\n mbox: " << uid.addrSpec() | |
905 | 958 | << "\n comment: " << protect(uid.comment()) |
906 | 959 | << "\n validity: " << uid.validityAsString() |
907 | 960 | << "\n revoked: " << uid.isRevoked() |
111 | 111 | bool canCertify() const; |
112 | 112 | bool canAuthenticate() const; |
113 | 113 | bool isQualified() const; |
114 | bool isDeVs() const; | |
114 | 115 | |
115 | 116 | bool hasSecret() const; |
116 | 117 | GPGMEPP_DEPRECATED bool isSecret() const |
151 | 152 | * how long the keylisting takes.*/ |
152 | 153 | void update(); |
153 | 154 | |
155 | /** | |
156 | * @brief Add a user id to this key. | |
157 | * | |
158 | * Needs gnupg 2.1.13 and the key needs to be updated | |
159 | * afterwards to see the new uid. | |
160 | * | |
161 | * @param uid should be fully formated and UTF-8 encoded. | |
162 | * | |
163 | * @returns a possible error. | |
164 | **/ | |
165 | Error addUid(const char *uid); | |
154 | 166 | private: |
155 | 167 | gpgme_key_t impl() const |
156 | 168 | { |
207 | 219 | bool canCertify() const; |
208 | 220 | bool canAuthenticate() const; |
209 | 221 | bool isQualified() const; |
222 | bool isDeVs() const; | |
210 | 223 | bool isCardKey() const; |
211 | 224 | |
212 | 225 | bool isSecret() const; |
258 | 271 | |
259 | 272 | const char *cardSerialNumber() const; |
260 | 273 | |
274 | const char *keyGrip() const; | |
275 | ||
261 | 276 | private: |
262 | 277 | shared_gpgme_key_t key; |
263 | 278 | gpgme_sub_key_t subkey; |
334 | 349 | * @returns a normalized mail address for this userid |
335 | 350 | * or an empty string. */ |
336 | 351 | std::string addrSpec() const; |
352 | ||
353 | /*! Revoke the user id. | |
354 | * | |
355 | * Key needs update afterwards. | |
356 | * | |
357 | * @returns an error on error.*/ | |
358 | Error revoke(); | |
337 | 359 | private: |
338 | 360 | shared_gpgme_key_t key; |
339 | 361 | gpgme_user_id_t uid; |
412 | 412 | } |
413 | 413 | } |
414 | 414 | if (update) { |
415 | ret.update(); | |
415 | d->keys[idx].update(); | |
416 | ret = d->keys[idx]; | |
416 | 417 | } |
417 | 418 | return ret; |
418 | 419 | } |
45 | 45 | |
46 | 46 | # For VPATH builds we need to copy some files because Python's |
47 | 47 | # distutils are not VPATH-aware. |
48 | copystamp: $(COPY_FILES) $(COPY_FILES_GPG) data.h config.h | |
49 | if test "$(srcdir)" != "$(builddir)" ; then \ | |
50 | cp -R $(COPY_FILES) . ; \ | |
51 | cp -R $(COPY_FILES_GPG) gpg ; \ | |
52 | fi | |
48 | copystamp: $(COPY_FILES) $(COPY_FILES_GPG) | |
49 | set -e ; for VERSION in $(PYTHON_VERSIONS); do \ | |
50 | $(MKDIR_P) python$${VERSION}-gpg/gpg ; \ | |
51 | cp -R $(COPY_FILES) python$${VERSION}-gpg ; \ | |
52 | cp setup.py python$${VERSION}-gpg ; \ | |
53 | cp gpg/version.py python$${VERSION}-gpg/gpg ; \ | |
54 | ln -sf "$(abs_top_srcdir)/src/data.h" python$${VERSION}-gpg ; \ | |
55 | ln -sf "$(abs_top_builddir)/config.h" python$${VERSION}-gpg ; \ | |
56 | cp -R $(COPY_FILES_GPG) python$${VERSION}-gpg/gpg ; \ | |
57 | done | |
53 | 58 | touch $@ |
54 | 59 | |
55 | data.h: | |
56 | ln -s "$(top_srcdir)/src/data.h" . | |
57 | ||
58 | config.h: | |
59 | ln -s "$(top_builddir)/config.h" . | |
60 | ||
61 | 60 | all-local: copystamp |
62 | for PYTHON in $(PYTHONS); do \ | |
61 | set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \ | |
62 | PYTHON="$$1" ; shift ; \ | |
63 | cd python$${VERSION}-gpg && \ | |
63 | 64 | CFLAGS="$(CFLAGS)" \ |
64 | 65 | $$PYTHON setup.py build --verbose ; \ |
66 | cd .. ; \ | |
65 | 67 | done |
66 | 68 | |
67 | dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp | |
69 | python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \ | |
70 | python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc: copystamp | |
71 | cd python$(PYTHON_VERSION)-gpg && \ | |
68 | 72 | CFLAGS="$(CFLAGS)" \ |
69 | 73 | $(PYTHON) setup.py sdist --verbose |
70 | gpg2 --detach-sign --armor dist/gpg-$(VERSION).tar.gz | |
74 | gpg2 --detach-sign --armor python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz | |
71 | 75 | |
72 | 76 | .PHONY: prepare |
73 | 77 | prepare: copystamp |
74 | 78 | |
75 | 79 | .PHONY: sdist |
76 | sdist: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc | |
80 | sdist: python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \ | |
81 | python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc | |
77 | 82 | |
78 | 83 | .PHONY: upload |
79 | upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc | |
84 | upload: python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \ | |
85 | python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc | |
80 | 86 | twine upload $^ |
81 | 87 | |
82 | CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \ | |
83 | data.h config.h copystamp | |
88 | CLEANFILES = copystamp | |
84 | 89 | |
85 | 90 | # Remove the rest. |
86 | 91 | # |
88 | 93 | # permissions. |
89 | 94 | clean-local: |
90 | 95 | rm -rf -- build |
91 | if test "$(srcdir)" != "$(builddir)" ; then \ | |
92 | find . -type d ! -perm -200 -exec chmod u+w {} ';' ; \ | |
93 | for F in $(COPY_FILES); do rm -rf -- `basename $$F` ; done ; \ | |
94 | for F in $(COPY_FILES_GPG); do \ | |
95 | rm -rf -- gpg/`basename $$F` ; \ | |
96 | done ; \ | |
97 | fi | |
96 | for VERSION in $(PYTHON_VERSIONS); do \ | |
97 | find python$${VERSION}-gpg -type d ! -perm -200 -exec chmod u+w {} ';' ; \ | |
98 | rm -rf -- python$${VERSION}-gpg ; \ | |
99 | done | |
98 | 100 | |
99 | 101 | install-exec-local: |
100 | 102 | rm -f install_files.txt |
101 | for PYTHON in $(PYTHONS); do \ | |
103 | set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \ | |
104 | PYTHON="$$1" ; shift ; \ | |
105 | cd python$${VERSION}-gpg ; \ | |
102 | 106 | $$PYTHON setup.py install \ |
103 | 107 | --prefix $(DESTDIR)$(prefix) \ |
104 | 108 | --record files.txt \ |
105 | 109 | --verbose ; \ |
106 | cat files.txt >> install_files.txt ; \ | |
110 | cat files.txt >> ../install_files.txt ; \ | |
107 | 111 | rm files.txt ; \ |
112 | cd .. ; \ | |
108 | 113 | done |
109 | 114 | $(MKDIR_P) $(DESTDIR)$(pythondir)/gpg |
110 | 115 | mv install_files.txt $(DESTDIR)$(pythondir)/gpg |
24 | 24 | del util |
25 | 25 | |
26 | 26 | # For convenience, we import the modules here. |
27 | from . import data, event, keylist, md, pk | |
28 | from . import protocol, sig, sigsum, status, validity | |
27 | from . import data, keylist, sig, tofu # The subdirs. | |
28 | from . import create, event, keysign, md, pk, protocol, sigsum, status, validity | |
29 | 29 | |
30 | 30 | # A complication arises because 'import' is a reserved keyword. |
31 | 31 | # Import it as 'Import' instead. |
32 | 32 | globals()['Import'] = getattr(__import__('', globals(), locals(), |
33 | 33 | [str('import')], 1), "import") |
34 | 34 | |
35 | __all__ = ['data', 'event', 'import', 'keylist', 'md', 'pk', | |
36 | 'protocol', 'sig', 'sigsum', 'status', 'validity'] | |
35 | __all__ = ['data', 'event', 'import', 'keysign', 'keylist', 'md', 'pk', | |
36 | 'protocol', 'sig', 'sigsum', 'status', 'tofu', 'validity', 'create'] | |
37 | 37 | |
38 | 38 | # GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We |
39 | 39 | # implement gpg.Context.op_edit using gpgme_op_interact, so the |
0 | # Flags for key creation | |
1 | # | |
2 | # Copyright (C) 2017 g10 Code GmbH | |
3 | # | |
4 | # This file is part of GPGME. | |
5 | # | |
6 | # GPGME is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU Lesser General Public License as | |
8 | # published by the Free Software Foundation; either version 2.1 of the | |
9 | # License, or (at your option) any later version. | |
10 | # | |
11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT | |
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | |
14 | # Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU Lesser General Public | |
17 | # License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | from __future__ import absolute_import, print_function, unicode_literals | |
20 | del absolute_import, print_function, unicode_literals | |
21 | ||
22 | from gpg import util | |
23 | util.process_constants('GPGME_CREATE_', globals()) | |
24 | del util |
0 | # Flags for key signing | |
1 | # | |
2 | # Copyright (C) 2017 g10 Code GmbH | |
3 | # | |
4 | # This file is part of GPGME. | |
5 | # | |
6 | # GPGME is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU Lesser General Public License as | |
8 | # published by the Free Software Foundation; either version 2.1 of the | |
9 | # License, or (at your option) any later version. | |
10 | # | |
11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT | |
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | |
14 | # Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU Lesser General Public | |
17 | # License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | from __future__ import absolute_import, print_function, unicode_literals | |
20 | del absolute_import, print_function, unicode_literals | |
21 | ||
22 | from gpg import util | |
23 | util.process_constants('GPGME_KEYSIGN_', globals()) | |
24 | del util |
0 | # TOFU | |
1 | # | |
2 | # Copyright (C) 2017 g10 Code GmbH | |
3 | # | |
4 | # This file is part of GPGME. | |
5 | # | |
6 | # GPGME is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU Lesser General Public License as | |
8 | # published by the Free Software Foundation; either version 2.1 of the | |
9 | # License, or (at your option) any later version. | |
10 | # | |
11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT | |
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | |
14 | # Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU Lesser General Public | |
17 | # License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | from __future__ import absolute_import, print_function, unicode_literals | |
20 | del absolute_import, print_function, unicode_literals | |
21 | ||
22 | from . import policy | |
23 | __all__ = ['policy'] |
0 | # TOFU policies | |
1 | # | |
2 | # Copyright (C) 2017 g10 Code GmbH | |
3 | # | |
4 | # This file is part of GPGME. | |
5 | # | |
6 | # GPGME is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU Lesser General Public License as | |
8 | # published by the Free Software Foundation; either version 2.1 of the | |
9 | # License, or (at your option) any later version. | |
10 | # | |
11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT | |
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | |
14 | # Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU Lesser General Public | |
17 | # License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | from __future__ import absolute_import, print_function, unicode_literals | |
20 | del absolute_import, print_function, unicode_literals | |
21 | ||
22 | from gpg import util | |
23 | util.process_constants('GPGME_TOFU_POLICY_', globals()) | |
24 | del util |
0 | # Copyright (C) 2016 g10 Code GmbH | |
0 | # Copyright (C) 2016-2017 g10 Code GmbH | |
1 | 1 | # Copyright (C) 2004,2008 Igor Belyi <belyi@users.sourceforge.net> |
2 | 2 | # Copyright (C) 2002 John Goerzen <jgoerzen@complete.org> |
3 | 3 | # |
175 | 175 | def __init__(self, armor=False, textmode=False, offline=False, |
176 | 176 | signers=[], pinentry_mode=constants.PINENTRY_MODE_DEFAULT, |
177 | 177 | protocol=constants.PROTOCOL_OpenPGP, |
178 | wrapped=None): | |
178 | wrapped=None, home_dir=None): | |
179 | 179 | """Construct a context object |
180 | 180 | |
181 | 181 | Keyword arguments: |
185 | 185 | signers -- list of keys used for signing (default []) |
186 | 186 | pinentry_mode -- pinentry mode (default PINENTRY_MODE_DEFAULT) |
187 | 187 | protocol -- protocol to use (default PROTOCOL_OpenPGP) |
188 | home_dir -- state directory (default is the engine default) | |
188 | 189 | |
189 | 190 | """ |
190 | 191 | if wrapped: |
202 | 203 | self.signers = signers |
203 | 204 | self.pinentry_mode = pinentry_mode |
204 | 205 | self.protocol = protocol |
206 | self.home_dir = home_dir | |
207 | ||
208 | def __repr__(self): | |
209 | return ( | |
210 | "Context(armor={0.armor}, " | |
211 | "textmode={0.textmode}, offline={0.offline}, " | |
212 | "signers={0.signers}, pinentry_mode={0.pinentry_mode}, " | |
213 | "protocol={0.protocol}, home_dir={0.home_dir}" | |
214 | ")").format(self) | |
205 | 215 | |
206 | 216 | def encrypt(self, plaintext, recipients=[], sign=True, sink=None, |
207 | 217 | passphrase=None, always_trust=False, add_encrypt_to=False, |
472 | 482 | plainbytes = data.read() |
473 | 483 | return plainbytes, result |
474 | 484 | |
475 | def keylist(self, pattern=None, secret=False): | |
485 | def keylist(self, pattern=None, secret=False, | |
486 | mode=constants.keylist.mode.LOCAL, | |
487 | source=None): | |
476 | 488 | """List keys |
477 | 489 | |
478 | 490 | Keyword arguments: |
479 | 491 | pattern -- return keys matching pattern (default: all keys) |
480 | secret -- return only secret keys | |
492 | secret -- return only secret keys (default: False) | |
493 | mode -- keylist mode (default: list local keys) | |
494 | source -- read keys from source instead from the keyring | |
495 | (all other options are ignored in this case) | |
481 | 496 | |
482 | 497 | Returns: |
483 | 498 | -- an iterator returning key objects |
485 | 500 | Raises: |
486 | 501 | GPGMEError -- as signaled by the underlying library |
487 | 502 | """ |
488 | return self.op_keylist_all(pattern, secret) | |
503 | if not source: | |
504 | self.set_keylist_mode(mode) | |
505 | self.op_keylist_start(pattern, secret) | |
506 | else: | |
507 | # Automatic wrapping of SOURCE is not possible here, | |
508 | # because the object must not be deallocated until the | |
509 | # iteration over the results ends. | |
510 | if not isinstance(source, Data): | |
511 | source = Data(file=source) | |
512 | self.op_keylist_from_data_start(source, 0) | |
513 | ||
514 | key = self.op_keylist_next() | |
515 | while key: | |
516 | yield key | |
517 | key = self.op_keylist_next() | |
518 | self.op_keylist_end() | |
519 | ||
520 | def create_key(self, userid, algorithm=None, expires_in=0, expires=True, | |
521 | sign=False, encrypt=False, certify=False, authenticate=False, | |
522 | passphrase=None, force=False): | |
523 | """Create a primary key | |
524 | ||
525 | Create a primary key for the user id USERID. | |
526 | ||
527 | ALGORITHM may be used to specify the public key encryption | |
528 | algorithm for the new key. By default, a reasonable default | |
529 | is chosen. You may use "future-default" to select an | |
530 | algorithm that will be the default in a future implementation | |
531 | of the engine. ALGORITHM may be a string like "rsa", or | |
532 | "rsa2048" to explicitly request an algorithm and a key size. | |
533 | ||
534 | EXPIRES_IN specifies the expiration time of the key in number | |
535 | of seconds since the keys creation. By default, a reasonable | |
536 | expiration time is chosen. If you want to create a key that | |
537 | does not expire, use the keyword argument EXPIRES. | |
538 | ||
539 | SIGN, ENCRYPT, CERTIFY, and AUTHENTICATE can be used to | |
540 | request the capabilities of the new key. If you don't request | |
541 | any, a reasonable set of capabilities is selected, and in case | |
542 | of OpenPGP, a subkey with a reasonable set of capabilities is | |
543 | created. | |
544 | ||
545 | If PASSPHRASE is None (the default), then the key will not be | |
546 | protected with a passphrase. If PASSPHRASE is a string, it | |
547 | will be used to protect the key. If PASSPHRASE is True, the | |
548 | passphrase must be supplied using a passphrase callback or | |
549 | out-of-band with a pinentry. | |
550 | ||
551 | Keyword arguments: | |
552 | algorithm -- public key algorithm, see above (default: reasonable) | |
553 | expires_in -- expiration time in seconds (default: reasonable) | |
554 | expires -- whether or not the key should expire (default: True) | |
555 | sign -- request the signing capability (see above) | |
556 | encrypt -- request the encryption capability (see above) | |
557 | certify -- request the certification capability (see above) | |
558 | authenticate -- request the authentication capability (see above) | |
559 | passphrase -- protect the key with a passphrase (default: no passphrase) | |
560 | force -- force key creation even if a key with the same userid exists | |
561 | (default: False) | |
562 | ||
563 | Returns: | |
564 | -- an object describing the result of the key creation | |
565 | ||
566 | Raises: | |
567 | GPGMEError -- as signaled by the underlying library | |
568 | ||
569 | """ | |
570 | if util.is_a_string(passphrase): | |
571 | old_pinentry_mode = self.pinentry_mode | |
572 | old_passphrase_cb = getattr(self, '_passphrase_cb', None) | |
573 | self.pinentry_mode = constants.PINENTRY_MODE_LOOPBACK | |
574 | def passphrase_cb(hint, desc, prev_bad, hook=None): | |
575 | return passphrase | |
576 | self.set_passphrase_cb(passphrase_cb) | |
577 | ||
578 | try: | |
579 | self.op_createkey(userid, algorithm, | |
580 | 0, # reserved | |
581 | expires_in, | |
582 | None, # extrakey | |
583 | ((constants.create.SIGN if sign else 0) | |
584 | | (constants.create.ENCR if encrypt else 0) | |
585 | | (constants.create.CERT if certify else 0) | |
586 | | (constants.create.AUTH if authenticate else 0) | |
587 | | (constants.create.NOPASSWD if passphrase == None else 0) | |
588 | | (0 if expires else constants.create.NOEXPIRE) | |
589 | | (constants.create.FORCE if force else 0))) | |
590 | finally: | |
591 | if util.is_a_string(passphrase): | |
592 | self.pinentry_mode = old_pinentry_mode | |
593 | if old_passphrase_cb: | |
594 | self.set_passphrase_cb(*old_passphrase_cb[1:]) | |
595 | ||
596 | return self.op_genkey_result() | |
597 | ||
598 | def create_subkey(self, key, algorithm=None, expires_in=0, expires=True, | |
599 | sign=False, encrypt=False, authenticate=False, passphrase=None): | |
600 | """Create a subkey | |
601 | ||
602 | Create a subkey for the given KEY. As subkeys are a concept | |
603 | of OpenPGP, calling this is only valid for the OpenPGP | |
604 | protocol. | |
605 | ||
606 | ALGORITHM may be used to specify the public key encryption | |
607 | algorithm for the new subkey. By default, a reasonable | |
608 | default is chosen. You may use "future-default" to select an | |
609 | algorithm that will be the default in a future implementation | |
610 | of the engine. ALGORITHM may be a string like "rsa", or | |
611 | "rsa2048" to explicitly request an algorithm and a key size. | |
612 | ||
613 | EXPIRES_IN specifies the expiration time of the subkey in | |
614 | number of seconds since the subkeys creation. By default, a | |
615 | reasonable expiration time is chosen. If you want to create a | |
616 | subkey that does not expire, use the keyword argument EXPIRES. | |
617 | ||
618 | SIGN, ENCRYPT, and AUTHENTICATE can be used to request the | |
619 | capabilities of the new subkey. If you don't request any, an | |
620 | encryption subkey is generated. | |
621 | ||
622 | If PASSPHRASE is None (the default), then the subkey will not | |
623 | be protected with a passphrase. If PASSPHRASE is a string, it | |
624 | will be used to protect the subkey. If PASSPHRASE is True, | |
625 | the passphrase must be supplied using a passphrase callback or | |
626 | out-of-band with a pinentry. | |
627 | ||
628 | Keyword arguments: | |
629 | algorithm -- public key algorithm, see above (default: reasonable) | |
630 | expires_in -- expiration time in seconds (default: reasonable) | |
631 | expires -- whether or not the subkey should expire (default: True) | |
632 | sign -- request the signing capability (see above) | |
633 | encrypt -- request the encryption capability (see above) | |
634 | authenticate -- request the authentication capability (see above) | |
635 | passphrase -- protect the subkey with a passphrase (default: no passphrase) | |
636 | ||
637 | Returns: | |
638 | -- an object describing the result of the subkey creation | |
639 | ||
640 | Raises: | |
641 | GPGMEError -- as signaled by the underlying library | |
642 | ||
643 | """ | |
644 | if util.is_a_string(passphrase): | |
645 | old_pinentry_mode = self.pinentry_mode | |
646 | old_passphrase_cb = getattr(self, '_passphrase_cb', None) | |
647 | self.pinentry_mode = constants.PINENTRY_MODE_LOOPBACK | |
648 | def passphrase_cb(hint, desc, prev_bad, hook=None): | |
649 | return passphrase | |
650 | self.set_passphrase_cb(passphrase_cb) | |
651 | ||
652 | try: | |
653 | self.op_createsubkey(key, algorithm, | |
654 | 0, # reserved | |
655 | expires_in, | |
656 | ((constants.create.SIGN if sign else 0) | |
657 | | (constants.create.ENCR if encrypt else 0) | |
658 | | (constants.create.AUTH if authenticate else 0) | |
659 | | (constants.create.NOPASSWD | |
660 | if passphrase == None else 0) | |
661 | | (0 if expires else constants.create.NOEXPIRE))) | |
662 | finally: | |
663 | if util.is_a_string(passphrase): | |
664 | self.pinentry_mode = old_pinentry_mode | |
665 | if old_passphrase_cb: | |
666 | self.set_passphrase_cb(*old_passphrase_cb[1:]) | |
667 | ||
668 | return self.op_genkey_result() | |
669 | ||
670 | def key_add_uid(self, key, uid): | |
671 | """Add a UID | |
672 | ||
673 | Add the uid UID to the given KEY. Calling this function is | |
674 | only valid for the OpenPGP protocol. | |
675 | ||
676 | Raises: | |
677 | GPGMEError -- as signaled by the underlying library | |
678 | ||
679 | """ | |
680 | self.op_adduid(key, uid, 0) | |
681 | ||
682 | def key_revoke_uid(self, key, uid): | |
683 | """Revoke a UID | |
684 | ||
685 | Revoke the uid UID from the given KEY. Calling this function | |
686 | is only valid for the OpenPGP protocol. | |
687 | ||
688 | Raises: | |
689 | GPGMEError -- as signaled by the underlying library | |
690 | ||
691 | """ | |
692 | self.op_revuid(key, uid, 0) | |
693 | ||
694 | def key_sign(self, key, uids=None, expires_in=False, local=False): | |
695 | """Sign a key | |
696 | ||
697 | Sign a key with the current set of signing keys. Calling this | |
698 | function is only valid for the OpenPGP protocol. | |
699 | ||
700 | If UIDS is None (the default), then all UIDs are signed. If | |
701 | it is a string, then only the matching UID is signed. If it | |
702 | is a list of strings, then all matching UIDs are signed. Note | |
703 | that a case-sensitive exact string comparison is done. | |
704 | ||
705 | EXPIRES_IN specifies the expiration time of the signature in | |
706 | seconds. If EXPIRES_IN is False, the signature does not | |
707 | expire. | |
708 | ||
709 | Keyword arguments: | |
710 | uids -- user ids to sign, see above (default: sign all) | |
711 | expires_in -- validity period of the signature in seconds | |
712 | (default: do not expire) | |
713 | local -- create a local, non-exportable signature | |
714 | (default: False) | |
715 | ||
716 | Raises: | |
717 | GPGMEError -- as signaled by the underlying library | |
718 | ||
719 | """ | |
720 | flags = 0 | |
721 | if uids == None or util.is_a_string(uids): | |
722 | pass#through unchanged | |
723 | else: | |
724 | flags |= constants.keysign.LFSEP | |
725 | uids = "\n".join(uids) | |
726 | ||
727 | if not expires_in: | |
728 | flags |= constants.keysign.NOEXPIRE | |
729 | ||
730 | if local: | |
731 | flags |= constants.keysign.LOCAL | |
732 | ||
733 | self.op_keysign(key, uids, expires_in, flags) | |
734 | ||
735 | def key_tofu_policy(self, key, policy): | |
736 | """Set a keys' TOFU policy | |
737 | ||
738 | Set the TOFU policy associated with KEY to POLICY. Calling | |
739 | this function is only valid for the OpenPGP protocol. | |
740 | ||
741 | Raises: | |
742 | GPGMEError -- as signaled by the underlying library | |
743 | ||
744 | """ | |
745 | self.op_tofu_policy(key, policy) | |
489 | 746 | |
490 | 747 | def assuan_transact(self, command, |
491 | 748 | data_cb=None, inquire_cb=None, status_cb=None): |
511 | 768 | |
512 | 769 | """ |
513 | 770 | |
514 | if isinstance(command, (str, bytes)): | |
771 | if util.is_a_string(command) or isinstance(command, bytes): | |
515 | 772 | cmd = command |
516 | 773 | else: |
517 | 774 | cmd = " ".join(util.percent_escape(f) for f in command) |
601 | 858 | errorcheck(gpgme.gpgme_engine_check_version(value)) |
602 | 859 | self.set_protocol(value) |
603 | 860 | |
861 | @property | |
862 | def home_dir(self): | |
863 | """Engine's home directory""" | |
864 | return self.engine_info.home_dir | |
865 | @home_dir.setter | |
866 | def home_dir(self, value): | |
867 | self.set_engine_info(self.protocol, home_dir=value) | |
868 | ||
604 | 869 | _ctype = 'gpgme_ctx_t' |
605 | 870 | _cprefix = 'gpgme_' |
606 | 871 | |
607 | 872 | def _errorcheck(self, name): |
608 | 873 | """This function should list all functions returning gpgme_error_t""" |
874 | # The list of functions is created using: | |
875 | # | |
876 | # $ grep '^gpgme_error_t ' obj/lang/python/python3.5-gpg/gpgme.h \ | |
877 | # | grep -v _op_ | awk "/\(gpgme_ctx/ { printf (\"'%s',\\n\", \$2) } " | |
609 | 878 | return ((name.startswith('gpgme_op_') |
610 | 879 | and not name.endswith('_result')) |
611 | 880 | or name in { |
881 | 'gpgme_new', | |
612 | 882 | 'gpgme_set_ctx_flag', |
613 | 883 | 'gpgme_set_protocol', |
614 | 884 | 'gpgme_set_sub_protocol', |
615 | 885 | 'gpgme_set_keylist_mode', |
616 | 886 | 'gpgme_set_pinentry_mode', |
617 | 887 | 'gpgme_set_locale', |
618 | 'gpgme_set_engine_info', | |
888 | 'gpgme_ctx_set_engine_info', | |
619 | 889 | 'gpgme_signers_add', |
620 | 'gpgme_get_sig_key', | |
621 | 890 | 'gpgme_sig_notation_add', |
891 | 'gpgme_set_sender', | |
622 | 892 | 'gpgme_cancel', |
623 | 893 | 'gpgme_cancel_async', |
624 | 'gpgme_cancel_get_key', | |
894 | 'gpgme_get_key', | |
625 | 895 | }) |
626 | 896 | |
627 | 897 | _boolean_properties = {'armor', 'textmode', 'offline'} |
828 | 1098 | home_dir -- configuration directory (unchanged if None) |
829 | 1099 | |
830 | 1100 | """ |
831 | errorcheck(gpgme.gpgme_ctx_set_engine_info( | |
832 | self.wrapped, proto, file_name, home_dir)) | |
1101 | self.ctx_set_engine_info(proto, file_name, home_dir) | |
833 | 1102 | |
834 | 1103 | def wait(self, hang): |
835 | 1104 | """Wait for asynchronous call to finish. Wait forever if hang is True. |
883 | 1152 | |
884 | 1153 | def _errorcheck(self, name): |
885 | 1154 | """This function should list all functions returning gpgme_error_t""" |
1155 | # This list is compiled using | |
1156 | # | |
1157 | # $ grep -v '^gpgme_error_t ' obj/lang/python/python3.5-gpg/gpgme.h \ | |
1158 | # | awk "/\(gpgme_data_t/ { printf (\"'%s',\\n\", \$2) } " | sed "s/'\\*/'/" | |
886 | 1159 | return name not in { |
1160 | 'gpgme_data_read', | |
1161 | 'gpgme_data_write', | |
1162 | 'gpgme_data_seek', | |
1163 | 'gpgme_data_release', | |
887 | 1164 | 'gpgme_data_release_and_get_mem', |
888 | 1165 | 'gpgme_data_get_encoding', |
889 | 'gpgme_data_seek', | |
890 | 1166 | 'gpgme_data_get_file_name', |
1167 | 'gpgme_data_identify', | |
891 | 1168 | } |
892 | 1169 | |
893 | 1170 | def __init__(self, string=None, file=None, offset=None, |
1096 | 1373 | chunks.append(result) |
1097 | 1374 | return b''.join(chunks) |
1098 | 1375 | |
1376 | def pubkey_algo_string(subkey): | |
1377 | """Return short algorithm string | |
1378 | ||
1379 | Return a public key algorithm string (e.g. "rsa2048") for a given | |
1380 | SUBKEY. | |
1381 | ||
1382 | Returns: | |
1383 | algo - a string | |
1384 | ||
1385 | """ | |
1386 | return gpgme.gpgme_pubkey_algo_string(subkey) | |
1387 | ||
1099 | 1388 | def pubkey_algo_name(algo): |
1389 | """Return name of public key algorithm | |
1390 | ||
1391 | Return the name of the public key algorithm for a given numeric | |
1392 | algorithm id ALGO (cf. RFC4880). | |
1393 | ||
1394 | Returns: | |
1395 | algo - a string | |
1396 | ||
1397 | """ | |
1100 | 1398 | return gpgme.gpgme_pubkey_algo_name(algo) |
1101 | 1399 | |
1102 | 1400 | def hash_algo_name(algo): |
1401 | """Return name of hash algorithm | |
1402 | ||
1403 | Return the name of the hash algorithm for a given numeric | |
1404 | algorithm id ALGO (cf. RFC4880). | |
1405 | ||
1406 | Returns: | |
1407 | algo - a string | |
1408 | ||
1409 | """ | |
1103 | 1410 | return gpgme.gpgme_hash_algo_name(algo) |
1104 | 1411 | |
1105 | 1412 | def get_protocol_name(proto): |
1413 | """Get protocol description | |
1414 | ||
1415 | Get the string describing protocol PROTO. | |
1416 | ||
1417 | Returns: | |
1418 | proto - a string | |
1419 | ||
1420 | """ | |
1106 | 1421 | return gpgme.gpgme_get_protocol_name(proto) |
1422 | ||
1423 | def addrspec_from_uid(uid): | |
1424 | """Return the address spec | |
1425 | ||
1426 | Return the addr-spec (cf. RFC2822 section 4.3) from a user id UID. | |
1427 | ||
1428 | Returns: | |
1429 | addr_spec - a string | |
1430 | ||
1431 | """ | |
1432 | return gpgme.gpgme_addrspec_from_uid(uid) | |
1107 | 1433 | |
1108 | 1434 | def check_version(version=None): |
1109 | 1435 | return gpgme.gpgme_check_version(version) |
63 | 63 | |
64 | 64 | setattr(self, key, getattr(fragile, key)) |
65 | 65 | |
66 | def __str__(self): | |
67 | return '<{} {}>'.format( | |
66 | def __repr__(self): | |
67 | return '{}({})'.format( | |
68 | 68 | self.__class__.__name__, |
69 | ', '.join('{}: {}'.format(k, getattr(self, k)) | |
69 | ', '.join('{}={!r}'.format(k, getattr(self, k)) | |
70 | 70 | for k in dir(self) if not k.startswith('_'))) |
71 | 71 | |
72 | 72 | class InvalidKey(Result): |
110 | 110 | } |
111 | 111 | |
112 | 112 | /* Release returned buffers as necessary. */ |
113 | %typemap(newfree) char * "free($1);"; | |
113 | %typemap(newfree) char * "gpgme_free($1);"; | |
114 | 114 | %newobject gpgme_data_release_and_get_mem; |
115 | %newobject gpgme_pubkey_algo_string; | |
116 | %newobject gpgme_addrspec_from_uid; | |
115 | 117 | |
116 | 118 | %typemap(arginit) gpgme_key_t [] { |
117 | 119 | $1 = NULL; |
134 | 136 | |
135 | 137 | /* Following code is from swig's python.swg. */ |
136 | 138 | if ((SWIG_ConvertPtr(pypointer,(void **) &$1[i], $*1_descriptor,SWIG_POINTER_EXCEPTION | $disown )) == -1) { |
137 | Py_DECREF(pypointer); | |
139 | Py_DECREF(pypointer); | |
140 | PyErr_Format(PyExc_TypeError, | |
141 | "arg %d: list must contain only gpgme_key_ts, got %s " | |
142 | "at position %d", | |
143 | $argnum, pypointer->ob_type->tp_name, i); | |
144 | free($1); | |
138 | 145 | return NULL; |
139 | 146 | } |
140 | 147 | Py_DECREF(pypointer); |
286 | 293 | gpgme_data_t sig, gpgme_data_t signed_text, |
287 | 294 | gpgme_data_t plaintext, gpgme_data_t keydata, |
288 | 295 | gpgme_data_t pubkey, gpgme_data_t seckey, |
289 | gpgme_data_t out}; | |
296 | gpgme_data_t out, gpgme_data_t data}; | |
290 | 297 | |
291 | 298 | /* SWIG has problems interpreting ssize_t, off_t or gpgme_error_t in |
292 | 299 | gpgme.h. */ |
423 | 430 | |
424 | 431 | |
425 | 432 | /* Wrap the fragile result objects into robust Python ones. */ |
426 | %typemap(out) gpgme_encrypt_result_t { | |
433 | %define wrapresult(cls, name) | |
434 | %typemap(out) cls { | |
427 | 435 | PyObject *fragile; |
428 | 436 | fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, |
429 | 437 | %newpointer_flags); |
430 | $result = _gpg_wrap_result(fragile, "EncryptResult"); | |
438 | $result = _gpg_wrap_result(fragile, name); | |
431 | 439 | Py_DECREF(fragile); |
432 | 440 | } |
433 | ||
434 | %typemap(out) gpgme_decrypt_result_t { | |
435 | PyObject *fragile; | |
436 | fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, | |
437 | %newpointer_flags); | |
438 | $result = _gpg_wrap_result(fragile, "DecryptResult"); | |
439 | Py_DECREF(fragile); | |
440 | } | |
441 | ||
442 | %typemap(out) gpgme_sign_result_t { | |
443 | PyObject *fragile; | |
444 | fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, | |
445 | %newpointer_flags); | |
446 | $result = _gpg_wrap_result(fragile, "SignResult"); | |
447 | Py_DECREF(fragile); | |
448 | } | |
449 | ||
450 | %typemap(out) gpgme_verify_result_t { | |
451 | PyObject *fragile; | |
452 | fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, | |
453 | %newpointer_flags); | |
454 | $result = _gpg_wrap_result(fragile, "VerifyResult"); | |
455 | Py_DECREF(fragile); | |
456 | } | |
457 | ||
458 | %typemap(out) gpgme_import_result_t { | |
459 | PyObject *fragile; | |
460 | fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, | |
461 | %newpointer_flags); | |
462 | $result = _gpg_wrap_result(fragile, "ImportResult"); | |
463 | Py_DECREF(fragile); | |
464 | } | |
465 | ||
466 | %typemap(out) gpgme_genkey_result_t { | |
467 | PyObject *fragile; | |
468 | fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, | |
469 | %newpointer_flags); | |
470 | $result = _gpg_wrap_result(fragile, "GenkeyResult"); | |
471 | Py_DECREF(fragile); | |
472 | } | |
473 | ||
474 | %typemap(out) gpgme_keylist_result_t { | |
475 | PyObject *fragile; | |
476 | fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, | |
477 | %newpointer_flags); | |
478 | $result = _gpg_wrap_result(fragile, "KeylistResult"); | |
479 | Py_DECREF(fragile); | |
480 | } | |
481 | ||
482 | %typemap(out) gpgme_vfs_mount_result_t { | |
483 | PyObject *fragile; | |
484 | fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, | |
485 | %newpointer_flags); | |
486 | $result = _gpg_wrap_result(fragile, "VFSMountResult"); | |
487 | Py_DECREF(fragile); | |
488 | } | |
441 | %enddef | |
442 | ||
443 | wrapresult(gpgme_encrypt_result_t, "EncryptResult") | |
444 | wrapresult(gpgme_decrypt_result_t, "DecryptResult") | |
445 | wrapresult(gpgme_sign_result_t, "SignResult") | |
446 | wrapresult(gpgme_verify_result_t, "VerifyResult") | |
447 | wrapresult(gpgme_import_result_t, "ImportResult") | |
448 | wrapresult(gpgme_genkey_result_t, "GenkeyResult") | |
449 | wrapresult(gpgme_keylist_result_t, "KeylistResult") | |
450 | wrapresult(gpgme_vfs_mount_result_t, "VFSMountResult") | |
489 | 451 | |
490 | 452 | %typemap(out) gpgme_engine_info_t { |
491 | 453 | int i; |
585 | 547 | } |
586 | 548 | } |
587 | 549 | |
550 | ||
551 | /* With SWIG, you can define default arguments for parameters. | |
552 | * While it's legal in C++ it is not in C, so we cannot change the | |
553 | * already existing gpgme.h. We need, however, to declare the function | |
554 | * *before* SWIG loads it from gpgme.h. Hence, we define it here. */ | |
555 | gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, | |
556 | const char *pattern="", | |
557 | int secret_only=0); | |
558 | ||
588 | 559 | /* Include the unmodified <gpgme.h> for cc, and the cleaned-up local |
589 | 560 | version for SWIG. We do, however, want to hide certain fields on |
590 | 561 | some structs, which we provide prior to including the version for |
655 | 626 | PyObject * |
656 | 627 | _gpg_wrap_gpgme_data_t(gpgme_data_t data) |
657 | 628 | { |
658 | return SWIG_Python_NewPointerObj(NULL, data, SWIGTYPE_p_gpgme_data, 0); | |
629 | /* | |
630 | * If SWIG is invoked without -builtin, the macro SWIG_NewPointerObj | |
631 | * expects a variable named "self". | |
632 | * | |
633 | * XXX: It is not quite clear why passing NULL as self is okay, but | |
634 | * it works with -builtin, and it seems to work just fine without | |
635 | * it too. | |
636 | */ | |
637 | PyObject* self = NULL; | |
638 | (void) self; | |
639 | return SWIG_NewPointerObj(data, SWIGTYPE_p_gpgme_data, 0); | |
659 | 640 | } |
660 | 641 | |
661 | 642 | gpgme_ctx_t |
674 | 655 | /* ... but only the public definitions here. They will be exposed to |
675 | 656 | the Python world, so let's be careful. */ |
676 | 657 | %include "helpers.h" |
658 | ||
659 | ||
660 | %define genericrepr(cls) | |
661 | %pythoncode %{ | |
662 | def __repr__(self): | |
663 | names = [name for name in dir(self) | |
664 | if not name.startswith("_") and name != "this"] | |
665 | props = ", ".join(("{}={!r}".format(name, getattr(self, name)) | |
666 | for name in names) | |
667 | ) | |
668 | return "cls({})".format(props) | |
669 | %} | |
670 | ||
671 | %enddef | |
672 | ||
673 | %extend _gpgme_key { | |
674 | genericrepr(Key) | |
675 | }; | |
676 | ||
677 | ||
678 | %extend _gpgme_subkey { | |
679 | genericrepr(SubKey) | |
680 | }; | |
681 | ||
682 | %extend _gpgme_key_sig { | |
683 | genericrepr(KeySig) | |
684 | }; | |
685 | ||
686 | %extend _gpgme_user_id { | |
687 | genericrepr(UID) | |
688 | }; | |
689 | ||
690 | %extend _gpgme_tofu_info { | |
691 | genericrepr(TofuInfo) | |
692 | }; |
292 | 292 | return _gpg_obj2gpgme_t(data, "gpgme_data_t", argnum); |
293 | 293 | |
294 | 294 | return PyErr_Format(PyExc_TypeError, |
295 | "arg %d: expected gpg.Data, file, or an object " | |
296 | "implementing the buffer protocol, got %s", | |
295 | "arg %d: expected gpg.Data, file, " | |
296 | "bytes (not string!), or an object " | |
297 | "implementing the buffer protocol. Got: %s. " | |
298 | "If you provided a string, try to encode() it.", | |
297 | 299 | argnum, data->ob_type->tp_name); |
298 | 300 | } |
299 | 301 | |
374 | 376 | goto leave; |
375 | 377 | } |
376 | 378 | |
377 | PyTuple_SetItem(args, 1, PyBytes_FromString(passphrase_info)); | |
379 | if (passphrase_info == NULL) | |
380 | { | |
381 | Py_INCREF(Py_None); | |
382 | PyTuple_SetItem(args, 1, Py_None); | |
383 | } | |
384 | else | |
385 | PyTuple_SetItem(args, 1, PyUnicode_DecodeUTF8(passphrase_info, | |
386 | strlen (passphrase_info), | |
387 | "strict")); | |
388 | if (PyErr_Occurred()) { | |
389 | Py_DECREF(args); | |
390 | err_status = gpg_error(GPG_ERR_GENERAL); | |
391 | goto leave; | |
392 | } | |
393 | ||
378 | 394 | PyTuple_SetItem(args, 2, PyBool_FromLong((long)prev_was_bad)); |
379 | 395 | if (dataarg) { |
380 | 396 | Py_INCREF(dataarg); /* Because GetItem doesn't give a ref but SetItem taketh away */ |
33 | 33 | extra_swig_opts = [] |
34 | 34 | extra_macros = dict() |
35 | 35 | |
36 | if os.path.exists("../../src/gpgme-config"): | |
36 | if os.path.exists("../../../src/gpgme-config"): | |
37 | 37 | # In-tree build. |
38 | 38 | in_tree = True |
39 | gpgme_config = ["../../src/gpgme-config"] + gpgme_config_flags | |
40 | gpgme_h = "../../src/gpgme.h" | |
41 | library_dirs = ["../../src/.libs"] # XXX uses libtool internals | |
39 | gpgme_config = ["../../../src/gpgme-config"] + gpgme_config_flags | |
40 | gpgme_h = "../../../src/gpgme.h" | |
41 | library_dirs = ["../../../src/.libs"] # XXX uses libtool internals | |
42 | 42 | extra_macros.update( |
43 | 43 | HAVE_CONFIG_H=1, |
44 | 44 | HAVE_DATA_H=1, |
151 | 151 | self.run_command('build_ext') |
152 | 152 | build.run(self) |
153 | 153 | |
154 | py3 = [] if sys.version_info.major < 3 else ['-py3'] | |
154 | 155 | swige = Extension("gpg._gpgme", ["gpgme.i", "helpers.c"], |
155 | swig_opts = ['-py3', '-builtin', '-threads', | |
156 | '-outdir', 'gpg'] + extra_swig_opts, | |
156 | swig_opts = ['-threads', | |
157 | '-outdir', 'gpg'] + py3 + extra_swig_opts, | |
157 | 158 | include_dirs = include_dirs, |
158 | 159 | define_macros = define_macros, |
159 | 160 | library_dirs = library_dirs, |
170 | 171 | url='https://www.gnupg.org', |
171 | 172 | ext_modules=[swige], |
172 | 173 | packages = ['gpg', 'gpg.constants', 'gpg.constants.data', |
173 | 'gpg.constants.keylist', 'gpg.constants.sig'], | |
174 | 'gpg.constants.keylist', 'gpg.constants.sig', | |
175 | 'gpg.constants.tofu'], | |
174 | 176 | license="LGPL2.1+ (the library), GPL2+ (tests and examples)", |
175 | 177 | classifiers=[ |
176 | 178 | 'Development Status :: 4 - Beta', |
45 | 45 | t-trustlist.py \ |
46 | 46 | t-edit.py \ |
47 | 47 | t-keylist.py \ |
48 | t-keylist-from-data.py \ | |
48 | 49 | t-wait.py \ |
49 | 50 | t-encrypt-large.py \ |
50 | 51 | t-file-name.py \ |
51 | 52 | t-idiomatic.py \ |
52 | t-protocol-assuan.py | |
53 | t-protocol-assuan.py \ | |
54 | t-quick-key-creation.py \ | |
55 | t-quick-subkey-creation.py \ | |
56 | t-quick-key-manipulation.py \ | |
57 | t-quick-key-signing.py | |
53 | 58 | |
54 | 59 | XTESTS = initial.py $(py_tests) final.py |
55 | 60 | EXTRA_DIST = support.py $(XTESTS) encrypt-only.asc sign-only.asc \ |
72 | 77 | |
73 | 78 | CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ |
74 | 79 | gpg-agent.conf pubring.kbx~ gpg.conf pubring.gpg~ \ |
75 | random_seed .gpg-v21-migrated \ | |
80 | random_seed .gpg-v21-migrated tofu.db \ | |
76 | 81 | pubring-stamp private-keys-v1.d/gpg-sample.stamp |
77 | 82 | |
78 | 83 | private_keys = \ |
106 | 111 | ./gpg.conf: |
107 | 112 | # This is required for t-sig-notations. |
108 | 113 | echo no-force-v3-sigs > ./gpg.conf |
114 | echo ignore-invalid-option agent-program >> ./gpg.conf | |
115 | echo "agent-program `which $(GPG_AGENT)`|--debug-quick-random" >> ./gpg.conf | |
109 | 116 | |
110 | 117 | ./gpg-agent.conf: |
111 | 118 | # This is required for gpg2, which does not support command fd. |
112 | 119 | echo pinentry-program $(abs_top_srcdir)/tests/gpg/pinentry >$@ |
113 | echo allow-loopback-pinentry >>$@ |
23 | 23 | import subprocess |
24 | 24 | import gpg |
25 | 25 | import support |
26 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
26 | ||
27 | print("Using gpg module from {0!r}.".format(os.path.dirname(gpg.__file__))) | |
27 | 28 | |
28 | 29 | subprocess.check_call([os.path.join(os.getenv('top_srcdir'), |
29 | 30 | "tests", "start-stop-agent"), "--start"]) |
38 | 38 | help='A test to run') |
39 | 39 | parser.add_argument('-v', '--verbose', action="store_true", default=False, |
40 | 40 | help='Be verbose.') |
41 | parser.add_argument('-q', '--quiet', action="store_true", default=False, | |
42 | help='Be quiet.') | |
41 | 43 | parser.add_argument('--interpreters', metavar='PYTHON', type=str, |
42 | 44 | default=[], action=SplitAndAccumulate, |
43 | 45 | help='Use these interpreters to run the tests, ' + |
48 | 50 | parser.add_argument('--builddir', type=str, |
49 | 51 | default=os.environ.get("abs_builddir", ""), |
50 | 52 | help='Location of the tests.') |
53 | parser.add_argument('--parallel', action="store_true", default=False, | |
54 | help='Ignored. For compatibility with run-tests.scm.') | |
51 | 55 | |
52 | 56 | args = parser.parse_args() |
53 | 57 | if not args.interpreters: |
64 | 68 | version = subprocess.check_output( |
65 | 69 | [interpreter, "-c", "import sys; print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))"]).strip().decode() |
66 | 70 | |
67 | builddirs = glob.glob(os.path.join(args.builddir, "..", "build", | |
68 | "lib*"+version)) | |
69 | assert len(builddirs) == 1, \ | |
70 | "Expected one build directory, got {0}".format(builddirs) | |
71 | pattern = os.path.join(args.builddir, "..", | |
72 | "python{0}-gpg".format(version), | |
73 | "build", | |
74 | "lib*"+version) | |
75 | builddirs = glob.glob(pattern) | |
76 | if len(builddirs) == 0: | |
77 | sys.exit("Build directory matching {0!r} not found.".format(pattern)) | |
78 | elif len(builddirs) > 1: | |
79 | sys.exit("Multiple build directories matching {0!r} found: {1}".format( | |
80 | pattern, builddirs)) | |
81 | ||
71 | 82 | env = dict(os.environ) |
72 | 83 | env["PYTHONPATH"] = builddirs[0] |
73 | 84 | |
74 | print("Running tests using {0} ({1})...".format(interpreter, version)) | |
85 | if not args.quiet: | |
86 | print("Running tests using {0} ({1})...".format(interpreter, version)) | |
87 | ||
75 | 88 | for test in args.tests: |
76 | 89 | status = subprocess.call( |
77 | 90 | [interpreter, os.path.join(args.srcdir, test)], |
78 | 91 | env=env, stdout=out, stderr=err) |
79 | print("{0}: {1}".format(status_to_str(status), test)) | |
92 | if not args.quiet: | |
93 | print("{0}: {1}".format(status_to_str(status), test)) | |
80 | 94 | results.append(status) |
81 | 95 | |
82 | 96 | def count(status): |
84 | 98 | def failed(): |
85 | 99 | return len(list(filter(lambda x: x not in (0, 77, 99), results))) |
86 | 100 | |
87 | print("{0} tests run, {1} succeeded, {2} failed, {3} skipped.".format( | |
88 | len(results), count(0), failed(), count(77))) | |
89 | sys.exit(len(results) - count(0)) | |
101 | if not args.quiet: | |
102 | print("{0} tests run, {1} succeeded, {2} failed, {3} skipped.".format( | |
103 | len(results), count(0), failed(), count(77))) | |
104 | sys.exit(len(results) - count(0)) | |
105 | sys.exit(results[0]) |
17 | 17 | from __future__ import absolute_import, print_function, unicode_literals |
18 | 18 | del absolute_import, print_function, unicode_literals |
19 | 19 | |
20 | import contextlib | |
21 | import shutil | |
20 | 22 | import sys |
21 | 23 | import os |
24 | import re | |
25 | import tempfile | |
26 | import time | |
22 | 27 | import gpg |
28 | ||
29 | def assert_gpg_version(version=(2, 1, 0)): | |
30 | with gpg.Context() as c: | |
31 | clean_version = re.match(r'\d+\.\d+\.\d+', c.engine_info.version).group(0) | |
32 | if tuple(map(int, clean_version.split('.'))) < version: | |
33 | print("GnuPG too old: have {0}, need {1}.".format( | |
34 | c.engine_info.version, '.'.join(map(str, version)))) | |
35 | sys.exit(77) | |
36 | ||
37 | # Skip the Python tests for GnuPG < 2.1.12. Prior versions do not | |
38 | # understand the command line flags that we assume exist. C.f. issue | |
39 | # 3008. | |
40 | assert_gpg_version((2, 1, 12)) | |
23 | 41 | |
24 | 42 | # known keys |
25 | 43 | alpha = "A0FF4590BB6122EDEF6E3C542D727CC768697734" |
34 | 52 | def in_srcdir(name): |
35 | 53 | return os.path.join(os.environ['srcdir'], name) |
36 | 54 | |
37 | def init_gpgme(proto): | |
38 | gpg.core.engine_check_version(proto) | |
39 | ||
40 | 55 | verbose = int(os.environ.get('verbose', 0)) > 1 |
41 | 56 | def print_data(data): |
42 | 57 | if verbose: |
47 | 62 | except: |
48 | 63 | # Hope for the best. |
49 | 64 | pass |
50 | sys.stdout.buffer.write(data) | |
65 | ||
66 | if hasattr(sys.stdout, "buffer"): | |
67 | sys.stdout.buffer.write(data) | |
68 | else: | |
69 | sys.stdout.write(data) | |
51 | 70 | |
52 | 71 | def mark_key_trusted(ctx, key): |
53 | 72 | class Editor(object): |
67 | 86 | return result |
68 | 87 | with gpg.Data() as sink: |
69 | 88 | ctx.op_edit(key, Editor().edit, sink, sink) |
89 | ||
90 | ||
91 | # Python3.2 and up has tempfile.TemporaryDirectory, but we cannot use | |
92 | # that, because there shutil.rmtree is used without | |
93 | # ignore_errors=True, and that races against gpg-agent deleting its | |
94 | # sockets. | |
95 | class TemporaryDirectory(object): | |
96 | def __enter__(self): | |
97 | self.path = tempfile.mkdtemp() | |
98 | return self.path | |
99 | def __exit__(self, *args): | |
100 | shutil.rmtree(self.path, ignore_errors=True) | |
101 | ||
102 | @contextlib.contextmanager | |
103 | def EphemeralContext(): | |
104 | with TemporaryDirectory() as tmp: | |
105 | home = os.environ['GNUPGHOME'] | |
106 | shutil.copy(os.path.join(home, "gpg.conf"), tmp) | |
107 | shutil.copy(os.path.join(home, "gpg-agent.conf"), tmp) | |
108 | ||
109 | with gpg.Context(home_dir=tmp) as ctx: | |
110 | yield ctx | |
111 | ||
112 | # Ask the agent to quit. | |
113 | agent_socket = os.path.join(tmp, "S.gpg-agent") | |
114 | ctx.protocol = gpg.constants.protocol.ASSUAN | |
115 | ctx.set_engine_info(ctx.protocol, file_name=agent_socket) | |
116 | try: | |
117 | ctx.assuan_transact(["KILLAGENT"]) | |
118 | except gpg.errors.GPGMEError as e: | |
119 | if e.getcode() == gpg.errors.ASS_CONNECT_FAILED: | |
120 | pass # the agent was not running | |
121 | else: | |
122 | raise | |
123 | ||
124 | # Block until it is really gone. | |
125 | while os.path.exists(agent_socket): | |
126 | time.sleep(.01) |
23 | 23 | import gpg |
24 | 24 | import support |
25 | 25 | |
26 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
26 | support.assert_gpg_version() | |
27 | 27 | |
28 | 28 | c = gpg.Context() |
29 | 29 | c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) |
33 | 33 | assert sig.validity == gpg.constants.validity.FULL |
34 | 34 | assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR |
35 | 35 | |
36 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
37 | 36 | c = gpg.Context() |
38 | 37 | |
39 | 38 | source = gpg.Data(file=support.make_filename("cipher-2.asc")) |
22 | 22 | import gpg |
23 | 23 | import support |
24 | 24 | |
25 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
26 | 25 | c = gpg.Context() |
27 | 26 | |
28 | 27 | source = gpg.Data(file=support.make_filename("cipher-1.asc")) |
25 | 25 | import gpg |
26 | 26 | import support |
27 | 27 | |
28 | support.assert_gpg_version() | |
29 | ||
28 | 30 | class KeyEditor(object): |
29 | 31 | def __init__(self): |
30 | 32 | self.steps = ["fpr", "expire", "1", "primary", "quit"] |
50 | 52 | |
51 | 53 | return result |
52 | 54 | |
53 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
54 | ||
55 | 55 | c = gpg.Context() |
56 | 56 | c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) |
57 | 57 | c.set_passphrase_cb(lambda *args: "abc") |
29 | 29 | else: |
30 | 30 | nbytes = 100000 |
31 | 31 | |
32 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
33 | 32 | c = gpg.Context() |
34 | 33 | |
35 | 34 | ntoread = nbytes |
23 | 23 | import gpg |
24 | 24 | import support |
25 | 25 | |
26 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
27 | 26 | c = gpg.Context() |
28 | 27 | c.set_armor(True) |
29 | 28 |
23 | 23 | import gpg |
24 | 24 | import support |
25 | 25 | |
26 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
26 | support.assert_gpg_version() | |
27 | 27 | |
28 | 28 | for passphrase in ("abc", b"abc"): |
29 | 29 | c = gpg.Context() |
22 | 22 | import gpg |
23 | 23 | import support |
24 | 24 | |
25 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
26 | 25 | c = gpg.Context() |
27 | 26 | c.set_armor(True) |
28 | 27 | |
61 | 60 | assert support.sign_only.endswith(e.recipients[0].fpr) |
62 | 61 | else: |
63 | 62 | assert False, "Expected an InvalidRecipients error, got none" |
63 | ||
64 | ||
65 | ||
66 | try: | |
67 | # People might be tempted to provide strings. | |
68 | # We should raise something useful. | |
69 | ciphertext, _, _ = c.encrypt("Hallo Leute\n", | |
70 | recipients=keys, | |
71 | sign=False, | |
72 | always_trust=True) | |
73 | except TypeError as e: | |
74 | # This test is a bit fragile, because the message | |
75 | # may very well change. So if the behaviour will change | |
76 | # this test can easily be deleted. | |
77 | assert "encode" in str(e) |
22 | 22 | import gpg |
23 | 23 | import support |
24 | 24 | |
25 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
26 | 25 | c = gpg.Context() |
27 | 26 | c.set_armor(True) |
28 | 27 |
25 | 25 | |
26 | 26 | testname = "abcde12345" |
27 | 27 | |
28 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
29 | 28 | c = gpg.Context() |
30 | 29 | c.set_armor(True) |
31 | 30 |
25 | 25 | import tempfile |
26 | 26 | import gpg |
27 | 27 | import support |
28 | ||
29 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
30 | 28 | |
31 | 29 | # Both Context and Data can be used as context manager: |
32 | 30 | with gpg.Context() as c, gpg.Data() as d: |
66 | 66 | assert len(result.imports) == 1 or fpr == result.imports[1].fpr |
67 | 67 | assert result.imports[0].result == 0 |
68 | 68 | |
69 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
70 | 69 | c = gpg.Context() |
71 | 70 | |
72 | 71 | c.op_import(gpg.Data(file=support.make_filename("pubkey-1.asc"))) |
0 | #!/usr/bin/env python | |
1 | ||
2 | # Copyright (C) 2016 g10 Code GmbH | |
3 | # | |
4 | # This file is part of GPGME. | |
5 | # | |
6 | # GPGME is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT | |
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | |
14 | # Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU Lesser General Public | |
17 | # License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | from __future__ import absolute_import, print_function, unicode_literals | |
20 | del absolute_import, print_function, unicode_literals | |
21 | ||
22 | import os | |
23 | import sys | |
24 | import gpg | |
25 | import support | |
26 | ||
27 | support.assert_gpg_version((2, 1, 14)) | |
28 | ||
29 | # Check expration of keys. This test assumes three subkeys of which | |
30 | # 2 are expired; it is used with the "Whisky" test key. It has | |
31 | # already been checked that these 3 subkeys are available. | |
32 | def check_whisky(name, key): | |
33 | sub1 = key.subkeys[2] | |
34 | sub2 = key.subkeys[3] | |
35 | ||
36 | assert sub1.expired and sub2.expired, \ | |
37 | "Subkey of `{}' not flagged as expired".format(name) | |
38 | assert sub1.expires == 1129636886 and sub2.expires == 1129636939, \ | |
39 | "Subkey of `{}' has wrong expiration date".format(name) | |
40 | ||
41 | keys = [ | |
42 | [ "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", | |
43 | [ [ "Alfa Test", "demo key", "alfa@example.net" ], | |
44 | [ "Alpha Test", "demo key", "alpha@example.net" ], | |
45 | [ "Alice", "demo key", "" ] ], 1 ], | |
46 | [ "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", "5381EA4EE29BA37F", | |
47 | [ [ "Bob", "demo key", "" ], | |
48 | [ "Bravo Test", "demo key", "bravo@example.net" ] ], 1 ], | |
49 | [ "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60", | |
50 | [ [ "Charlie Test", "demo key", "charlie@example.net" ] ], 1 ], | |
51 | [ "6560C59C43D031C54D7C588EEBA9F240EB9DC9E6", "06F22880B0C45424", | |
52 | [ [ "Delta Test", "demo key", "delta@example.net" ] ], 1 ], | |
53 | [ "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D", | |
54 | [ [ "Echelon", "demo key", "" ], | |
55 | [ "Echo Test", "demo key", "echo@example.net" ], | |
56 | [ "Eve", "demo key", "" ] ], 1 ], | |
57 | [ "56D33268F7FE693FBB594762D4BF57F37372E243", "0A32EE79EE45198E", | |
58 | [ [ "Foxtrot Test", "demo key", "foxtrot@example.net" ] ], 1 ], | |
59 | [ "C9C07DCC6621B9FB8D071B1D168410A48FC282E6", "247491CC9DCAD354", | |
60 | [ [ "Golf Test", "demo key", "golf@example.net" ] ], 1 ], | |
61 | [ "9E91CBB11E4D4135583EF90513DB965534C6E3F1", "76E26537D622AD0A", | |
62 | [ [ "Hotel Test", "demo key", "hotel@example.net" ] ], 1 ], | |
63 | [ "CD538D6CC9FB3D745ECDA5201FE8FC6F04259677", "C1C8EFDE61F76C73", | |
64 | [ [ "India Test", "demo key", "india@example.net" ] ], 1 ], | |
65 | [ "F8F1EDC73995AB739AD54B380C820C71D2699313", "BD0B108735F8F136", | |
66 | [ [ "Juliet Test", "demo key", "juliet@example.net" ] ], 1 ], | |
67 | [ "3FD11083779196C2ECDD9594AD1B0FAD43C2D0C7", "86CBB34A9AF64D02", | |
68 | [ [ "Kilo Test", "demo key", "kilo@example.net" ] ], 1 ], | |
69 | [ "1DDD28CEF714F5B03B8C246937CAB51FB79103F8", "0363B449FE56350C", | |
70 | [ [ "Lima Test", "demo key", "lima@example.net" ] ], 1 ], | |
71 | [ "2686AA191A278013992C72EBBE794852BE5CF886", "5F600A834F31EAE8", | |
72 | [ [ "Mallory", "demo key", "" ], | |
73 | [ "Mike Test", "demo key", "mike@example.net" ] ], 1 ], | |
74 | [ "5AB9D6D7BAA1C95B3BAA3D9425B00FD430CEC684", "4C1D63308B70E472", | |
75 | [ [ "November Test", "demo key", "november@example.net" ] ], 1 ], | |
76 | [ "43929E89F8F79381678CAE515F6356BA6D9732AC", "FF0785712681619F", | |
77 | [ [ "Oscar Test", "demo key", "oscar@example.net" ] ], 1 ], | |
78 | [ "6FAA9C201E5E26DCBAEC39FD5D15E01D3FF13206", "2764E18263330D9C", | |
79 | [ [ "Papa test", "demo key", "papa@example.net" ] ], 1 ], | |
80 | [ "A7969DA1C3297AA96D49843F1C67EC133C661C84", "6CDCFC44A029ACF4", | |
81 | [ [ "Quebec Test", "demo key", "quebec@example.net" ] ], 1 ], | |
82 | [ "38FBE1E4BF6A5E1242C8F6A13BDBEDB1777FBED3", "9FAB805A11D102EA", | |
83 | [ [ "Romeo Test", "demo key", "romeo@example.net" ] ], 1 ], | |
84 | [ "045B2334ADD69FC221076841A5E67F7FA3AE3EA1", "93B88B0F0F1B50B4", | |
85 | [ [ "Sierra Test", "demo key", "sierra@example.net" ] ], 1 ], | |
86 | [ "ECAC774F4EEEB0620767044A58CB9A4C85A81F38", "97B60E01101C0402", | |
87 | [ [ "Tango Test", "demo key", "tango@example.net" ] ], 1 ], | |
88 | [ "0DBCAD3F08843B9557C6C4D4A94C0F75653244D6", "93079B915522BDB9", | |
89 | [ [ "Uniform Test", "demo key", "uniform@example.net" ] ], 1 ], | |
90 | [ "E8143C489C8D41124DC40D0B47AF4B6961F04784", "04071FB807287134", | |
91 | [ [ "Victor Test", "demo key", "victor@example.org" ] ], 1 ], | |
92 | [ "E8D6C90B683B0982BD557A99DEF0F7B8EC67DBDE", "D7FBB421FD6E27F6", | |
93 | [ [ "Whisky Test", "demo key", "whisky@example.net" ] ], 3, | |
94 | check_whisky ], | |
95 | [ "04C1DF62EFA0EBB00519B06A8979A6C5567FB34A", "5CC6F87F41E408BE", | |
96 | [ [ "XRay Test", "demo key", "xray@example.net" ] ], 1 ], | |
97 | [ "ED9B316F78644A58D042655A9EEF34CD4B11B25F", "5ADFD255F7B080AD", | |
98 | [ [ "Yankee Test", "demo key", "yankee@example.net" ] ], 1 ], | |
99 | [ "23FD347A419429BACCD5E72D6BC4778054ACD246", "EF9DC276A172C881", | |
100 | [ [ "Zulu Test", "demo key", "zulu@example.net" ] ], 1 ], | |
101 | ] | |
102 | ||
103 | def check_global(key, uids, n_subkeys): | |
104 | assert not key.revoked, "Key unexpectedly revoked" | |
105 | assert not key.expired, "Key unexpectedly expired" | |
106 | assert not key.disabled, "Key unexpectedly disabled" | |
107 | assert not key.invalid, "Key unexpectedly invalid" | |
108 | assert key.can_sign, "Key unexpectedly unusable for signing" | |
109 | assert key.can_certify, "Key unexpectedly unusable for certifications" | |
110 | assert not key.secret, "Key unexpectedly secret" | |
111 | assert not key.protocol != gpg.constants.protocol.OpenPGP, \ | |
112 | "Key has unexpected protocol: {}".format(key.protocol) | |
113 | assert not key.issuer_serial, \ | |
114 | "Key unexpectedly carries issuer serial: {}".format(key.issuer_serial) | |
115 | assert not key.issuer_name, \ | |
116 | "Key unexpectedly carries issuer name: {}".format(key.issuer_name) | |
117 | assert not key.chain_id, \ | |
118 | "Key unexpectedly carries chain ID: {}".format(key.chain_id) | |
119 | assert key.owner_trust == gpg.constants.validity.UNKNOWN, \ | |
120 | "Key has unexpected owner trust: {}".format(key.owner_trust) | |
121 | assert len(key.subkeys) - 1 == n_subkeys, \ | |
122 | "Key `{}' has unexpected number of subkeys".format(uids[0][0]) | |
123 | ||
124 | ||
125 | def check_subkey(fpr, which, subkey): | |
126 | assert not subkey.revoked, which + " key unexpectedly revoked" | |
127 | assert not subkey.expired, which + " key unexpectedly expired" | |
128 | assert not subkey.disabled, which + " key unexpectedly disabled" | |
129 | assert not subkey.invalid, which + " key unexpectedly invalid" | |
130 | ||
131 | if which == "Primary": | |
132 | assert not subkey.can_encrypt, \ | |
133 | which + " key unexpectedly usable for encryption" | |
134 | assert subkey.can_sign, \ | |
135 | which + " key unexpectedly unusable for signing" | |
136 | assert subkey.can_certify, \ | |
137 | which + " key unexpectedly unusable for certifications" | |
138 | else: | |
139 | assert subkey.can_encrypt, \ | |
140 | which + " key unexpectedly unusable for encryption" | |
141 | assert not subkey.can_sign, \ | |
142 | which + " key unexpectedly usable for signing" | |
143 | assert not subkey.can_certify, \ | |
144 | which + " key unexpectedly usable for certifications" | |
145 | ||
146 | assert not subkey.secret, which + " key unexpectedly secret" | |
147 | assert not subkey.is_cardkey, "Public key marked as card key" | |
148 | assert not subkey.card_number, "Public key with card number set" | |
149 | assert not subkey.pubkey_algo != (gpg.constants.pk.DSA if which == "Primary" | |
150 | else gpg.constants.pk.ELG_E), \ | |
151 | which + " key has unexpected public key algo: {}".\ | |
152 | format(subkey.pubkey_algo) | |
153 | assert subkey.length == 1024, \ | |
154 | which + " key has unexpected length: {}".format(subkey.length) | |
155 | assert fpr.endswith(subkey.keyid), \ | |
156 | which + " key has unexpected key ID: {}".format(subkey.keyid) | |
157 | assert which == "Secondary" or subkey.fpr == fpr, \ | |
158 | which + " key has unexpected fingerprint: {}".format(subkey.fpr) | |
159 | assert not subkey.expires, \ | |
160 | which + " key unexpectedly expires: {}".format(subkey.expires) | |
161 | ||
162 | def check_uid(which, ref, uid): | |
163 | assert not uid.revoked, which + " user ID unexpectedly revoked" | |
164 | assert not uid.invalid, which + " user ID unexpectedly invalid" | |
165 | assert uid.validity == gpg.constants.validity.UNKNOWN, \ | |
166 | which + " user ID has unexpected validity: {}".format(uid.validity) | |
167 | assert not uid.signatures, which + " user ID unexpectedly signed" | |
168 | assert uid.name == ref[0], \ | |
169 | "Unexpected name in {} user ID: {!r}".format(which.lower(), uid.name) | |
170 | assert uid.comment == ref[1], \ | |
171 | "Unexpected comment in {} user ID: {!r}".format(which.lower(), | |
172 | uid.comment) | |
173 | assert uid.email == ref[2], \ | |
174 | "Unexpected email in {} user ID: {!r}".format(which.lower(), uid.email) | |
175 | ||
176 | # Export all the data from our keyring... | |
177 | key_data = gpg.Data() | |
178 | with gpg.Context() as c: | |
179 | c.op_export_keys([c.get_key(k[0]) for k in keys], 0, key_data) | |
180 | ||
181 | # ... rewind the tape... | |
182 | key_data.rewind() | |
183 | ||
184 | # ... and feed it into a keylist in an empty context. | |
185 | with support.EphemeralContext() as c: | |
186 | for i, key in enumerate(c.keylist(source=key_data)): | |
187 | try: | |
188 | if len(keys[i]) == 4: | |
189 | fpr, sec_keyid, uids, n_subkeys = keys[i] | |
190 | misc_check = None | |
191 | else: | |
192 | fpr, sec_keyid, uids, n_subkeys, misc_check = keys[i] | |
193 | except IndexError: | |
194 | # There are more keys. We don't check for that. | |
195 | break | |
196 | ||
197 | # Global key flags. | |
198 | check_global(key, uids, n_subkeys) | |
199 | check_subkey(fpr, "Primary", key.subkeys[0]) | |
200 | check_subkey(sec_keyid, "Secondary", key.subkeys[1]) | |
201 | ||
202 | assert len(key.uids) == len(uids) | |
203 | check_uid("First", uids[0], key.uids[0]) | |
204 | if len(key.uids) > 1: | |
205 | check_uid("Second", uids[1], key.uids[1]) | |
206 | if len(key.uids) > 2: | |
207 | check_uid("Third", uids[2], key.uids[2]) | |
208 | ||
209 | if misc_check: | |
210 | misc_check (uids[0][0], key) | |
211 | ||
212 | assert len(list(c.keylist())) == 0, "Keys were imported" |
22 | 22 | import gpg |
23 | 23 | import support |
24 | 24 | |
25 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
26 | 25 | c = gpg.Context() |
27 | 26 | |
28 | 27 | # Check expration of keys. This test assumes three subkeys of which |
218 | 217 | assert not result.truncated, "Key listing unexpectedly truncated" |
219 | 218 | |
220 | 219 | |
220 | # We test for a parameter-less keylist | |
221 | keyring_length = len(list(c.op_keylist_all())) | |
222 | assert keyring_length > 1,\ | |
223 | "Expected to find some keys, but got %r" % keyring_length | |
224 | ||
225 | # Then we do want to call with a pattern, only | |
226 | # i.e. without giving secret=0 | |
227 | alpha_keys = list(c.op_keylist_all(b"Alpha")) | |
228 | assert len(alpha_keys) == 1, "Expected only one key for 'Alpha', got %r" % len(alpha_keys) | |
229 | ||
230 | ||
231 | ||
221 | 232 | for i, key in enumerate(c.keylist()): |
222 | 233 | try: |
223 | 234 | if len(keys[i]) == 4: |
23 | 23 | |
24 | 24 | with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c: |
25 | 25 | # Do nothing. |
26 | c.assuan_transact('nop') | |
27 | c.assuan_transact('NOP') | |
28 | c.assuan_transact(['NOP']) | |
26 | err = c.assuan_transact('nop') | |
27 | assert err == None | |
28 | err = c.assuan_transact(b'NOP') | |
29 | assert err == None | |
30 | err = c.assuan_transact(['NOP']) | |
31 | assert err == None | |
29 | 32 | |
30 | 33 | err = c.assuan_transact('idontexist') |
31 | 34 | assert err.getsource() == gpg.errors.SOURCE_GPGAGENT |
0 | #!/usr/bin/env python | |
1 | ||
2 | # Copyright (C) 2017 g10 Code GmbH | |
3 | # | |
4 | # This file is part of GPGME. | |
5 | # | |
6 | # GPGME is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT | |
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | |
14 | # Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU Lesser General Public | |
17 | # License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | from __future__ import absolute_import, print_function, unicode_literals | |
20 | del absolute_import, print_function, unicode_literals | |
21 | ||
22 | import gpg | |
23 | import itertools | |
24 | import time | |
25 | ||
26 | import support | |
27 | support.assert_gpg_version((2, 1, 2)) | |
28 | ||
29 | alpha = "Alpha <alpha@invalid.example.net>" | |
30 | ||
31 | with support.EphemeralContext() as ctx: | |
32 | res = ctx.create_key(alpha) | |
33 | ||
34 | keys = list(ctx.keylist()) | |
35 | assert len(keys) == 1, "Weird number of keys created" | |
36 | ||
37 | key = keys[0] | |
38 | assert key.fpr == res.fpr | |
39 | assert len(key.subkeys) == 2, "Expected one primary key and one subkey" | |
40 | assert key.subkeys[0].expires > 0, "Expected primary key to expire" | |
41 | ||
42 | # Try to create a key with the same UID | |
43 | try: | |
44 | ctx.create_key(alpha) | |
45 | assert False, "Expected an error but got none" | |
46 | except gpg.errors.GpgError as e: | |
47 | pass | |
48 | ||
49 | # Try to create a key with the same UID, now with force! | |
50 | res2 = ctx.create_key(alpha, force=True) | |
51 | assert res.fpr != res2.fpr | |
52 | ||
53 | ||
54 | # From here on, we use one context, and create unique UIDs | |
55 | uid_counter = 0 | |
56 | def make_uid(): | |
57 | global uid_counter | |
58 | uid_counter += 1 | |
59 | return "user{0}@invalid.example.org".format(uid_counter) | |
60 | ||
61 | with support.EphemeralContext() as ctx: | |
62 | # Check gpg.constants.create.NOEXPIRE... | |
63 | res = ctx.create_key(make_uid(), expires=False) | |
64 | key = ctx.get_key(res.fpr, secret=True) | |
65 | assert key.fpr == res.fpr | |
66 | assert len(key.subkeys) == 2, "Expected one primary key and one subkey" | |
67 | assert key.subkeys[0].expires == 0, "Expected primary key not to expire" | |
68 | ||
69 | t = 2 * 24 * 60 * 60 | |
70 | slack = 5 * 60 | |
71 | res = ctx.create_key(make_uid(), expires_in=t) | |
72 | key = ctx.get_key(res.fpr, secret=True) | |
73 | assert key.fpr == res.fpr | |
74 | assert len(key.subkeys) == 2, "Expected one primary key and one subkey" | |
75 | assert abs(time.time() + t - key.subkeys[0].expires) < slack, \ | |
76 | "Primary keys expiration time is off" | |
77 | ||
78 | # Check capabilities | |
79 | for sign, encrypt, certify, authenticate in itertools.product([False, True], | |
80 | [False, True], | |
81 | [False, True], | |
82 | [False, True]): | |
83 | # Filter some out | |
84 | if not (sign or encrypt or certify or authenticate): | |
85 | # This triggers the default capabilities tested before. | |
86 | continue | |
87 | if (sign or encrypt or authenticate) and not certify: | |
88 | # The primary key always certifies. | |
89 | continue | |
90 | ||
91 | res = ctx.create_key(make_uid(), algorithm="rsa", | |
92 | sign=sign, encrypt=encrypt, certify=certify, | |
93 | authenticate=authenticate) | |
94 | key = ctx.get_key(res.fpr, secret=True) | |
95 | assert key.fpr == res.fpr | |
96 | assert len(key.subkeys) == 1, \ | |
97 | "Expected no subkey for non-default capabilities" | |
98 | ||
99 | p = key.subkeys[0] | |
100 | assert sign == p.can_sign | |
101 | assert encrypt == p.can_encrypt | |
102 | assert certify == p.can_certify | |
103 | assert authenticate == p.can_authenticate | |
104 | ||
105 | # Check algorithm | |
106 | res = ctx.create_key(make_uid(), algorithm="rsa") | |
107 | key = ctx.get_key(res.fpr, secret=True) | |
108 | assert key.fpr == res.fpr | |
109 | for k in key.subkeys: | |
110 | assert k.pubkey_algo == 1 | |
111 | ||
112 | # Check algorithm with size | |
113 | res = ctx.create_key(make_uid(), algorithm="rsa1024") | |
114 | key = ctx.get_key(res.fpr, secret=True) | |
115 | assert key.fpr == res.fpr | |
116 | for k in key.subkeys: | |
117 | assert k.pubkey_algo == 1 | |
118 | assert k.length == 1024 | |
119 | ||
120 | # Check algorithm future-default | |
121 | ctx.create_key(make_uid(), algorithm="future-default") | |
122 | ||
123 | # Check passphrase protection | |
124 | recipient = make_uid() | |
125 | passphrase = "streng geheim" | |
126 | res = ctx.create_key(recipient, passphrase=passphrase) | |
127 | ciphertext, _, _ = ctx.encrypt(b"hello there", recipients=[ctx.get_key(res.fpr)]) | |
128 | ||
129 | cb_called = False | |
130 | def cb(*args): | |
131 | global cb_called | |
132 | cb_called = True | |
133 | return passphrase | |
134 | ctx.pinentry_mode = gpg.constants.PINENTRY_MODE_LOOPBACK | |
135 | ctx.set_passphrase_cb(cb) | |
136 | ||
137 | plaintext, _, _ = ctx.decrypt(ciphertext) | |
138 | assert plaintext == b"hello there" | |
139 | assert cb_called |
0 | #!/usr/bin/env python | |
1 | ||
2 | # Copyright (C) 2017 g10 Code GmbH | |
3 | # | |
4 | # This file is part of GPGME. | |
5 | # | |
6 | # GPGME is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT | |
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | |
14 | # Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU Lesser General Public | |
17 | # License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | from __future__ import absolute_import, print_function, unicode_literals | |
20 | del absolute_import, print_function, unicode_literals | |
21 | ||
22 | import os | |
23 | import gpg | |
24 | ||
25 | import support | |
26 | support.assert_gpg_version((2, 1, 14)) | |
27 | ||
28 | alpha = "Alpha <alpha@invalid.example.net>" | |
29 | bravo = "Bravo <bravo@invalid.example.net>" | |
30 | ||
31 | with support.EphemeralContext() as ctx: | |
32 | res = ctx.create_key(alpha, certify=True) | |
33 | key = ctx.get_key(res.fpr) | |
34 | assert len(key.subkeys) == 1, "Expected one primary key and no subkeys" | |
35 | assert len(key.uids) == 1, "Expected exactly one UID" | |
36 | ||
37 | def get_uid(uid): | |
38 | key = ctx.get_key(res.fpr) | |
39 | for u in key.uids: | |
40 | if u.uid == uid: | |
41 | return u | |
42 | return None | |
43 | ||
44 | # sanity check | |
45 | uid = get_uid(alpha) | |
46 | assert uid, "UID alpha not found" | |
47 | assert uid.revoked == 0 | |
48 | ||
49 | # add bravo | |
50 | ctx.key_add_uid(key, bravo) | |
51 | uid = get_uid(bravo) | |
52 | assert uid, "UID bravo not found" | |
53 | assert uid.revoked == 0 | |
54 | ||
55 | # revoke alpha | |
56 | ctx.key_revoke_uid(key, alpha) | |
57 | uid = get_uid(alpha) | |
58 | assert uid, "UID alpha not found" | |
59 | assert uid.revoked == 1 | |
60 | uid = get_uid(bravo) | |
61 | assert uid, "UID bravo not found" | |
62 | assert uid.revoked == 0 | |
63 | ||
64 | # try to revoke the last UID | |
65 | try: | |
66 | ctx.key_revoke_uid(key, alpha) | |
67 | # IMHO this should fail. issue2961. | |
68 | # assert False, "Expected an error but got none" | |
69 | except gpg.errors.GpgError: | |
70 | pass | |
71 | ||
72 | # Everything should be the same | |
73 | uid = get_uid(alpha) | |
74 | assert uid, "UID alpha not found" | |
75 | assert uid.revoked == 1 | |
76 | uid = get_uid(bravo) | |
77 | assert uid, "UID bravo not found" | |
78 | assert uid.revoked == 0 | |
79 | ||
80 | # try to revoke a non-existent UID | |
81 | try: | |
82 | ctx.key_revoke_uid(key, "i dont exist") | |
83 | # IMHO this should fail. issue2963. | |
84 | # assert False, "Expected an error but got none" | |
85 | except gpg.errors.GpgError: | |
86 | pass | |
87 | ||
88 | # try to add an pre-existent UID | |
89 | try: | |
90 | ctx.key_add_uid(key, bravo) | |
91 | assert False, "Expected an error but got none" | |
92 | except gpg.errors.GpgError: | |
93 | pass | |
94 | ||
95 | # Check setting the TOFU policy. | |
96 | with open(os.path.join(ctx.home_dir, "gpg.conf"), "a") as handle: | |
97 | handle.write("trust-model tofu+pgp\n") | |
98 | ||
99 | for name, policy in [(name, getattr(gpg.constants.tofu.policy, name)) | |
100 | for name in filter(lambda x: not x.startswith('__'), | |
101 | dir(gpg.constants.tofu.policy))]: | |
102 | if policy == gpg.constants.tofu.policy.NONE: | |
103 | # We must not set the policy to NONE. | |
104 | continue | |
105 | ||
106 | ctx.key_tofu_policy(key, policy) | |
107 | ||
108 | keys = list(ctx.keylist(key.uids[0].uid, | |
109 | mode=(gpg.constants.keylist.mode.LOCAL | |
110 | |gpg.constants.keylist.mode.WITH_TOFU))) | |
111 | assert len(keys) == 1 | |
112 | ||
113 | if policy == gpg.constants.tofu.policy.AUTO: | |
114 | # We cannot check that it is set to AUTO. | |
115 | continue | |
116 | ||
117 | for uid in keys[0].uids: | |
118 | if uid.uid == alpha: | |
119 | # TOFU information of revoked UIDs is not updated. | |
120 | # XXX: Is that expected? | |
121 | continue | |
122 | assert uid.tofu[0].policy == policy, \ | |
123 | "Expected policy {0} ({1}), got {2}".format(policy, name, | |
124 | uid.tofu[0].policy) |
0 | #!/usr/bin/env python | |
1 | ||
2 | # Copyright (C) 2017 g10 Code GmbH | |
3 | # | |
4 | # This file is part of GPGME. | |
5 | # | |
6 | # GPGME is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT | |
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | |
14 | # Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU Lesser General Public | |
17 | # License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | from __future__ import absolute_import, print_function, unicode_literals | |
20 | del absolute_import, print_function, unicode_literals | |
21 | ||
22 | import gpg | |
23 | import itertools | |
24 | import time | |
25 | ||
26 | import support | |
27 | support.assert_gpg_version((2, 1, 1)) | |
28 | ||
29 | with support.EphemeralContext() as ctx: | |
30 | uid_counter = 0 | |
31 | def make_uid(): | |
32 | global uid_counter | |
33 | uid_counter += 1 | |
34 | return "user{0}@invalid.example.org".format(uid_counter) | |
35 | ||
36 | def make_key(): | |
37 | uids = [make_uid() for i in range(3)] | |
38 | res = ctx.create_key(uids[0], certify=True) | |
39 | key = ctx.get_key(res.fpr) | |
40 | for u in uids[1:]: | |
41 | ctx.key_add_uid(key, u) | |
42 | return key, uids | |
43 | ||
44 | def check_sigs(key, expected_sigs): | |
45 | keys = list(ctx.keylist(key.fpr, mode=(gpg.constants.keylist.mode.LOCAL | |
46 | |gpg.constants.keylist.mode.SIGS))) | |
47 | assert len(keys) == 1 | |
48 | key_uids = {uid.uid: [s for s in uid.signatures] for uid in keys[0].uids} | |
49 | expected = list(expected_sigs) | |
50 | ||
51 | while key_uids and expected: | |
52 | uid, signing_key, func = expected[0] | |
53 | match = False | |
54 | for i, s in enumerate(key_uids[uid]): | |
55 | if signing_key.fpr.endswith(s.keyid): | |
56 | if func: | |
57 | func(s) | |
58 | match = True | |
59 | break | |
60 | if match: | |
61 | expected.pop(0) | |
62 | key_uids[uid].pop(i) | |
63 | if not key_uids[uid]: | |
64 | del key_uids[uid] | |
65 | ||
66 | assert not key_uids, "Superfluous signatures: {0}".format(key_uids) | |
67 | assert not expected, "Missing signatures: {0}".format(expected) | |
68 | ||
69 | # Simplest case. Sign without any options. | |
70 | key_a, uids_a = make_key() | |
71 | key_b, uids_b = make_key() | |
72 | ctx.signers = [key_a] | |
73 | ||
74 | def exportable_non_expiring(s): | |
75 | assert s.exportable | |
76 | assert s.expires == 0 | |
77 | ||
78 | check_sigs(key_b, itertools.product(uids_b, [key_b], [exportable_non_expiring])) | |
79 | ctx.key_sign(key_b) | |
80 | check_sigs(key_b, itertools.product(uids_b, [key_b, key_a], [exportable_non_expiring])) | |
81 | ||
82 | # Create a non-exportable signature, and explicitly name all uids. | |
83 | key_c, uids_c = make_key() | |
84 | ctx.signers = [key_a, key_b] | |
85 | ||
86 | def non_exportable_non_expiring(s): | |
87 | assert s.exportable == 0 | |
88 | assert s.expires == 0 | |
89 | ||
90 | ctx.key_sign(key_c, local=True, uids=uids_c) | |
91 | check_sigs(key_c, | |
92 | list(itertools.product(uids_c, [key_c], | |
93 | [exportable_non_expiring])) | |
94 | + list(itertools.product(uids_c, [key_b, key_a], | |
95 | [non_exportable_non_expiring]))) | |
96 | ||
97 | # Create a non-exportable, expiring signature for a single uid. | |
98 | key_d, uids_d = make_key() | |
99 | ctx.signers = [key_c] | |
100 | expires_in = 600 | |
101 | slack = 10 | |
102 | ||
103 | def non_exportable_expiring(s): | |
104 | assert s.exportable == 0 | |
105 | assert abs(time.time() + expires_in - s.expires) < slack | |
106 | ||
107 | ctx.key_sign(key_d, local=True, expires_in=expires_in, uids=uids_d[0]) | |
108 | check_sigs(key_d, | |
109 | list(itertools.product(uids_d, [key_d], | |
110 | [exportable_non_expiring])) | |
111 | + list(itertools.product(uids_d[:1], [key_c], | |
112 | [non_exportable_expiring]))) | |
113 | ||
114 | # Now sign the second in the same fashion, but use a singleton list. | |
115 | ctx.key_sign(key_d, local=True, expires_in=expires_in, uids=uids_d[1:2]) | |
116 | check_sigs(key_d, | |
117 | list(itertools.product(uids_d, [key_d], | |
118 | [exportable_non_expiring])) | |
119 | + list(itertools.product(uids_d[:2], [key_c], | |
120 | [non_exportable_expiring]))) |
0 | #!/usr/bin/env python | |
1 | ||
2 | # Copyright (C) 2017 g10 Code GmbH | |
3 | # | |
4 | # This file is part of GPGME. | |
5 | # | |
6 | # GPGME is free software; you can redistribute it and/or modify it | |
7 | # under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # GPGME is distributed in the hope that it will be useful, but WITHOUT | |
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General | |
14 | # Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU Lesser General Public | |
17 | # License along with this program; if not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | from __future__ import absolute_import, print_function, unicode_literals | |
20 | del absolute_import, print_function, unicode_literals | |
21 | ||
22 | import gpg | |
23 | import itertools | |
24 | import time | |
25 | ||
26 | import support | |
27 | ||
28 | alpha = "Alpha <alpha@invalid.example.net>" | |
29 | bravo = "Bravo <bravo@invalid.example.net>" | |
30 | ||
31 | with support.EphemeralContext() as ctx: | |
32 | res = ctx.create_key(alpha, certify=True) | |
33 | keys = list(ctx.keylist()) | |
34 | assert len(keys) == 1, "Weird number of keys created" | |
35 | key = keys[0] | |
36 | assert key.fpr == res.fpr | |
37 | assert len(key.subkeys) == 1, "Expected one primary key and no subkeys" | |
38 | ||
39 | def get_subkey(fpr): | |
40 | k = ctx.get_key(fpr) | |
41 | for sk in k.subkeys: | |
42 | if sk.fpr == fpr: | |
43 | return sk | |
44 | return None | |
45 | ||
46 | # Check gpg.constants.create.NOEXPIRE... | |
47 | res = ctx.create_subkey(key, expires=False) | |
48 | subkey = get_subkey(res.fpr) | |
49 | assert subkey.expires == 0, "Expected subkey not to expire" | |
50 | assert subkey.can_encrypt, \ | |
51 | "Default subkey capabilities do not include encryption" | |
52 | ||
53 | t = 2 * 24 * 60 * 60 | |
54 | slack = 5 * 60 | |
55 | res = ctx.create_subkey(key, expires_in=t) | |
56 | subkey = get_subkey(res.fpr) | |
57 | assert abs(time.time() + t - subkey.expires) < slack, \ | |
58 | "subkeys expiration time is off" | |
59 | ||
60 | # Check capabilities | |
61 | for sign, encrypt, authenticate in itertools.product([False, True], | |
62 | [False, True], | |
63 | [False, True]): | |
64 | # Filter some out | |
65 | if not (sign or encrypt or authenticate): | |
66 | # This triggers the default capabilities tested before. | |
67 | continue | |
68 | ||
69 | res = ctx.create_subkey(key, sign=sign, encrypt=encrypt, | |
70 | authenticate=authenticate) | |
71 | subkey = get_subkey(res.fpr) | |
72 | assert sign == subkey.can_sign | |
73 | assert encrypt == subkey.can_encrypt | |
74 | assert authenticate == subkey.can_authenticate | |
75 | ||
76 | # Check algorithm | |
77 | res = ctx.create_subkey(key, algorithm="rsa") | |
78 | subkey = get_subkey(res.fpr) | |
79 | assert subkey.pubkey_algo == 1 | |
80 | ||
81 | # Check algorithm with size | |
82 | res = ctx.create_subkey(key, algorithm="rsa1024") | |
83 | subkey = get_subkey(res.fpr) | |
84 | assert subkey.pubkey_algo == 1 | |
85 | assert subkey.length == 1024 | |
86 | ||
87 | # Check algorithm future-default | |
88 | ctx.create_subkey(key, algorithm="future-default") | |
89 | ||
90 | # Check passphrase protection. For this we create a new key | |
91 | # so that we have a key with just one encryption subkey. | |
92 | bravo_res = ctx.create_key(bravo, certify=True) | |
93 | bravo_key = ctx.get_key(bravo_res.fpr) | |
94 | assert len(bravo_key.subkeys) == 1, "Expected one primary key and no subkeys" | |
95 | ||
96 | passphrase = "streng geheim" | |
97 | res = ctx.create_subkey(bravo_key, passphrase=passphrase) | |
98 | ciphertext, _, _ = ctx.encrypt(b"hello there", | |
99 | recipients=[ctx.get_key(bravo_res.fpr)]) | |
100 | ||
101 | cb_called = False | |
102 | def cb(*args): | |
103 | global cb_called | |
104 | cb_called = True | |
105 | return passphrase | |
106 | ctx.pinentry_mode = gpg.constants.PINENTRY_MODE_LOOPBACK | |
107 | ctx.set_passphrase_cb(cb) | |
108 | ||
109 | plaintext, _, _ = ctx.decrypt(ciphertext) | |
110 | assert plaintext == b"hello there" | |
111 | assert cb_called |
61 | 61 | |
62 | 62 | assert len(expected_notations) == 0 |
63 | 63 | |
64 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
65 | ||
66 | 64 | source = gpg.Data("Hallo Leute\n") |
67 | 65 | signed = gpg.Data() |
68 | 66 |
52 | 52 | if signature.fpr != "A0FF4590BB6122EDEF6E3C542D727CC768697734": |
53 | 53 | fail("Wrong fingerprint reported: {}".format(signature.fpr)) |
54 | 54 | |
55 | ||
56 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
57 | 55 | c = gpg.Context() |
58 | 56 | c.set_textmode(True) |
59 | 57 | c.set_armor(True) |
52 | 52 | "23FD347A419429BACCD5E72D6BC4778054ACD246"): |
53 | 53 | fail("Wrong fingerprint reported: {}".format(signature.fpr)) |
54 | 54 | |
55 | ||
56 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
57 | 55 | c = gpg.Context() |
58 | 56 | c.set_textmode(True) |
59 | 57 | c.set_armor(True) |
22 | 22 | import gpg |
23 | 23 | import support |
24 | 24 | |
25 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
26 | 25 | c = gpg.Context() |
27 | 26 | |
28 | 27 | def dump_item(item): |
96 | 96 | sig.validity, validity) |
97 | 97 | assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR |
98 | 98 | |
99 | ||
100 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
101 | 99 | c = gpg.Context() |
102 | 100 | c.set_armor(True) |
103 | 101 |
23 | 23 | import gpg |
24 | 24 | import support |
25 | 25 | |
26 | support.init_gpgme(gpg.constants.protocol.OpenPGP) | |
27 | 26 | c = gpg.Context() |
28 | 27 | c.set_armor(True) |
29 | 28 |
36 | 36 | qgpgmekeyformailboxjob.cpp gpgme_backend_debug.cpp \ |
37 | 37 | qgpgmetofupolicyjob.cpp \ |
38 | 38 | defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \ |
39 | dn.cpp | |
39 | dn.cpp cryptoconfig.cpp | |
40 | 40 | |
41 | 41 | # If you add one here make sure that you also add one in camelcase |
42 | 42 | qgpgme_headers= \ |
219 | 219 | libqgpgme_la_LDFLAGS = -no-undefined -version-info \ |
220 | 220 | @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@ |
221 | 221 | |
222 | if HAVE_MACOS_SYSTEM | |
223 | libsuffix=.dylib | |
224 | else | |
225 | libsuffix=.so | |
226 | endif | |
227 | ||
222 | 228 | if HAVE_W32_SYSTEM |
223 | 229 | QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in |
224 | 230 | sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ |
227 | 233 | else |
228 | 234 | QGpgmeConfig.cmake: QGpgmeConfig.cmake.in |
229 | 235 | sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ |
236 | sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \ | |
230 | 237 | sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ |
231 | 238 | endif |
232 | 239 |
63 | 63 | set_target_properties(QGpgme PROPERTIES |
64 | 64 | INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@" |
65 | 65 | INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core" |
66 | IMPORTED_LOCATION "@resolved_libdir@/libqgpgme.so" | |
66 | IMPORTED_LOCATION "@resolved_libdir@/libqgpgme@libsuffix@" | |
67 | 67 | ) |
68 | 68 | |
69 | 69 | if(CMAKE_VERSION VERSION_LESS 2.8.12) |
0 | /* | |
1 | cryptoconfig.cpp | |
2 | ||
3 | This file is part of qgpgme, the Qt API binding for gpgme | |
4 | Copyright (c) 2017 Intevation GmbH | |
5 | ||
6 | QGpgME is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU General Public License as | |
8 | published by the Free Software Foundation; either version 2 of the | |
9 | License, or (at your option) any later version. | |
10 | ||
11 | QGpgME is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | ||
20 | In addition, as a special exception, the copyright holders give | |
21 | permission to link the code of this program with any edition of | |
22 | the Qt library by Trolltech AS, Norway (or with modified versions | |
23 | of Qt that use the same license as Qt), and distribute linked | |
24 | combinations including the two. You must obey the GNU General | |
25 | Public License in all respects for all of the code used other than | |
26 | Qt. If you modify this file, you may extend this exception to | |
27 | your version of the file, but you are not obligated to do so. If | |
28 | you do not wish to do so, delete this exception statement from | |
29 | your version. | |
30 | */ | |
31 | #include "cryptoconfig.h" | |
32 | #include "qgpgmenewcryptoconfig.h" | |
33 | ||
34 | using namespace QGpgME; | |
35 | ||
36 | QStringList CryptoConfigEntry::stringValueList() const | |
37 | { | |
38 | const QGpgMENewCryptoConfigEntry *entry = dynamic_cast <const QGpgMENewCryptoConfigEntry*> (this); | |
39 | if (!entry) { | |
40 | return QStringList(); | |
41 | } | |
42 | return entry->stringValueList(); | |
43 | } |
247 | 247 | * @return true if the value was changed |
248 | 248 | */ |
249 | 249 | virtual bool isDirty() const = 0; |
250 | ||
251 | // Design change from here on we are closely bound to one implementation | |
252 | // of cryptoconfig. To avoid ABI breaks with every new function we | |
253 | // add real functions from now on. | |
254 | ||
255 | /** | |
256 | * @return a stringValueList. | |
257 | */ | |
258 | QStringList stringValueList() const; | |
250 | 259 | }; |
251 | 260 | |
252 | 261 | /** |
378 | 387 | /** |
379 | 388 | * Write back changes |
380 | 389 | * |
381 | * @param runtime If this option is set, the changes will take effect at run-time, as | |
382 | * far as this is possible. Otherwise, they will take effect at the next | |
383 | * start of the respective backend programs. | |
390 | * @param runtime this parameter is ignored. Changes will always | |
391 | * be made with --runtime set. | |
384 | 392 | */ |
385 | 393 | virtual void sync(bool runtime) = 0; |
386 | 394 |
90 | 90 | |
91 | 91 | GpgME::Error DefaultKeyGenerationJob::start(const QString &email, const QString &name) |
92 | 92 | { |
93 | const QString namePart = name.isEmpty() ? QString() : | |
94 | QStringLiteral("name-real: %1\n").arg(name); | |
95 | const QString mailPart = email.isEmpty() ? QString() : | |
96 | QStringLiteral("name-email: %1\n").arg(email); | |
97 | ||
93 | 98 | const QString args = QStringLiteral("<GnupgKeyParms format=\"internal\">\n" |
94 | 99 | "%ask-passphrase\n" |
95 | 100 | "key-type: RSA\n" |
98 | 103 | "subkey-type: RSA\n" |
99 | 104 | "subkey-length: 2048\n" |
100 | 105 | "subkey-usage: encrypt\n" |
101 | "name-email: %1\n" | |
102 | "name-real: %2\n" | |
103 | "</GnupgKeyParms>").arg(email, name); | |
106 | "%1" | |
107 | "%2" | |
108 | "</GnupgKeyParms>").arg(mailPart, namePart); | |
104 | 109 | |
105 | 110 | d->job = openpgp()->keyGenerationJob(); |
106 | 111 | d->job->installEventFilter(this); |
35 | 35 | #endif |
36 | 36 | |
37 | 37 | #include "dn.h" |
38 | ||
39 | #include <gpg-error.h> | |
38 | 40 | |
39 | 41 | static const struct { |
40 | 42 | const char *name; |
164 | 166 | for (unsigned int i = 0; i < numOidMaps; ++i) |
165 | 167 | if (!strcasecmp((char *)p, oidmap[i].oid)) { |
166 | 168 | free(p); |
167 | p = strdup(oidmap[i].name); | |
169 | gpgrt_asprintf(&p, oidmap[i].name); | |
168 | 170 | break; |
169 | 171 | } |
170 | 172 | array->key = p; |
48 | 48 | #include <sstream> |
49 | 49 | #include <string> |
50 | 50 | #include <cassert> |
51 | #include <functional> | |
51 | 52 | |
52 | 53 | using namespace QGpgME; |
53 | 54 | using namespace GpgME; |
215 | 216 | |
216 | 217 | void QGpgMENewCryptoConfigComponent::sync(bool runtime) |
217 | 218 | { |
218 | Q_UNUSED(runtime) | |
219 | // ### how to pass --runtime to gpgconf? -> marcus: not yet supported (2010-11-20) | |
219 | Q_UNUSED(runtime) // runtime is always set by engine_gpgconf | |
220 | 220 | if (const Error err = m_component.save()) { |
221 | #if 0 | |
222 | TODO port | |
223 | const QString wmsg = i18n("Error from gpgconf while saving configuration: %1", QString::fromLocal8Bit(err.asString())); | |
224 | qCWarning(GPGPME_BACKEND_LOG) << ":" << wmsg; | |
225 | KMessageBox::error(0, wmsg); | |
226 | #endif | |
227 | } | |
228 | // ### unset dirty state again | |
221 | qCWarning(GPGPME_BACKEND_LOG) << ":" | |
222 | << "Error from gpgconf while saving configuration: %1" | |
223 | << QString::fromLocal8Bit(err.asString()); | |
224 | } | |
229 | 225 | } |
230 | 226 | |
231 | 227 | //// |
550 | 546 | return m_option.currentValue().uintValues(); |
551 | 547 | } |
552 | 548 | |
549 | QStringList QGpgMENewCryptoConfigEntry::stringValueList() const | |
550 | { | |
551 | Q_ASSERT(isList()); | |
552 | const Argument arg = m_option.currentValue(); | |
553 | const std::vector<const char *> values = arg.stringValues(); | |
554 | QStringList ret; | |
555 | for(const char *value: values) { | |
556 | ret << QString::fromUtf8(value); | |
557 | } | |
558 | return ret; | |
559 | } | |
560 | ||
553 | 561 | QList<QUrl> QGpgMENewCryptoConfigEntry::urlValueList() const |
554 | 562 | { |
555 | 563 | const Type type = m_option.type(); |
92 | 92 | void setURLValueList(const QList<QUrl> &) Q_DECL_OVERRIDE; |
93 | 93 | bool isDirty() const Q_DECL_OVERRIDE; |
94 | 94 | |
95 | QStringList stringValueList() const; | |
96 | ||
95 | 97 | #if 0 |
96 | 98 | void setDirty(bool b); |
97 | 99 | QString outputString() const; |
50 | 50 | #include "job.h" |
51 | 51 | |
52 | 52 | #include <cassert> |
53 | #include <functional> | |
53 | 54 | |
54 | 55 | namespace QGpgME |
55 | 56 | { |
24 | 24 | EXTRA_DIST = initial.test |
25 | 25 | |
26 | 26 | TESTS = initial.test t-keylist t-keylocate t-ownertrust t-tofuinfo \ |
27 | t-encrypt t-verify | |
27 | t-encrypt t-verify t-various t-config | |
28 | 28 | |
29 | 29 | moc_files = t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \ |
30 | t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc | |
30 | t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc \ | |
31 | t-various.moc t-config.moc | |
31 | 32 | |
32 | 33 | AM_LDFLAGS = -no-install |
33 | 34 | |
56 | 57 | t_encrypt_SOURCES = t-encrypt.cpp $(support_src) |
57 | 58 | t_wkspublish_SOURCES = t-wkspublish.cpp $(support_src) |
58 | 59 | t_verify_SOURCES = t-verify.cpp $(support_src) |
60 | t_various_SOURCES = t-various.cpp $(support_src) | |
61 | t_config_SOURCES = t-config.cpp $(support_src) | |
59 | 62 | run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp |
60 | 63 | |
61 | 64 | nodist_t_keylist_SOURCES = $(moc_files) |
63 | 66 | BUILT_SOURCES = $(moc_files) |
64 | 67 | |
65 | 68 | noinst_PROGRAMS = t-keylist t-keylocate t-ownertrust t-tofuinfo t-encrypt \ |
66 | run-keyformailboxjob t-wkspublish t-verify | |
69 | run-keyformailboxjob t-wkspublish t-verify t-various t-config | |
67 | 70 | |
68 | 71 | CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ |
69 | 72 | gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ |
70 | 73 | random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp $(moc_files) \ |
71 | gpg.conf | |
74 | gpg.conf tofu.db | |
72 | 75 | |
73 | 76 | clean-local: |
74 | 77 | -rm -fR private-keys-v1.d crls.d |
0 | /* t-config.cpp | |
1 | ||
2 | This file is part of qgpgme, the Qt API binding for gpgme | |
3 | Copyright (c) 2016 Intevation GmbH | |
4 | ||
5 | QGpgME is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU General Public License as | |
7 | published by the Free Software Foundation; either version 2 of the | |
8 | License, or (at your option) any later version. | |
9 | ||
10 | QGpgME is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program; if not, write to the Free Software | |
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | ||
19 | In addition, as a special exception, the copyright holders give | |
20 | permission to link the code of this program with any edition of | |
21 | the Qt library by Trolltech AS, Norway (or with modified versions | |
22 | of Qt that use the same license as Qt), and distribute linked | |
23 | combinations including the two. You must obey the GNU General | |
24 | Public License in all respects for all of the code used other than | |
25 | Qt. If you modify this file, you may extend this exception to | |
26 | your version of the file, but you are not obligated to do so. If | |
27 | you do not wish to do so, delete this exception statement from | |
28 | your version. | |
29 | */ | |
30 | #ifdef HAVE_CONFIG_H | |
31 | #include "config.h" | |
32 | #endif | |
33 | ||
34 | #include <QDebug> | |
35 | #include <QTest> | |
36 | #include <QTemporaryDir> | |
37 | #include "t-support.h" | |
38 | #include "protocol.h" | |
39 | #include "cryptoconfig.h" | |
40 | #include <unistd.h> | |
41 | ||
42 | using namespace QGpgME; | |
43 | ||
44 | class CryptoConfigTest: public QGpgMETest | |
45 | { | |
46 | Q_OBJECT | |
47 | ||
48 | private Q_SLOTS: | |
49 | void testKeyserver() | |
50 | { | |
51 | // Repeatedly set a config value and clear it | |
52 | // this war broken at some point so it gets a | |
53 | // unit test. | |
54 | for (int i = 0; i < 10; i++) { | |
55 | auto conf = cryptoConfig(); | |
56 | QVERIFY(conf); | |
57 | auto entry = conf->entry(QStringLiteral("gpg"), | |
58 | QStringLiteral("Keyserver"), | |
59 | QStringLiteral("keyserver")); | |
60 | QVERIFY(entry); | |
61 | const QString url(QStringLiteral("hkp://foo.bar.baz")); | |
62 | entry->setStringValue(url); | |
63 | conf->sync(false); | |
64 | conf->clear(); | |
65 | entry = conf->entry(QStringLiteral("gpg"), | |
66 | QStringLiteral("Keyserver"), | |
67 | QStringLiteral("keyserver")); | |
68 | QCOMPARE (entry->stringValue(), url); | |
69 | entry->setStringValue(QString()); | |
70 | conf->sync(false); | |
71 | conf->clear(); | |
72 | entry = conf->entry(QStringLiteral("gpg"), | |
73 | QStringLiteral("Keyserver"), | |
74 | QStringLiteral("keyserver")); | |
75 | QCOMPARE (entry->stringValue(), QString()); | |
76 | } | |
77 | } | |
78 | ||
79 | void initTestCase() | |
80 | { | |
81 | QGpgMETest::initTestCase(); | |
82 | const QString gpgHome = qgetenv("GNUPGHOME"); | |
83 | qputenv("GNUPGHOME", mDir.path().toUtf8()); | |
84 | QVERIFY(mDir.isValid()); | |
85 | } | |
86 | private: | |
87 | QTemporaryDir mDir; | |
88 | ||
89 | }; | |
90 | ||
91 | QTEST_MAIN(CryptoConfigTest) | |
92 | ||
93 | #include "t-config.moc" |
38 | 38 | #include <QBuffer> |
39 | 39 | #include "keylistjob.h" |
40 | 40 | #include "encryptjob.h" |
41 | #include "signencryptjob.h" | |
42 | #include "signingresult.h" | |
41 | 43 | #include "qgpgmeencryptjob.h" |
42 | 44 | #include "encryptionresult.h" |
43 | 45 | #include "decryptionresult.h" |
45 | 47 | #include "qgpgmebackend.h" |
46 | 48 | #include "keylistresult.h" |
47 | 49 | #include "engineinfo.h" |
50 | #include "verifyopaquejob.h" | |
48 | 51 | #include "t-support.h" |
49 | 52 | |
50 | 53 | #define PROGRESS_TEST_SIZE 1 * 1024 * 1024 |
84 | 87 | std::vector<Key> keys; |
85 | 88 | auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), |
86 | 89 | false, keys); |
87 | Q_ASSERT(!keylistresult.error()); | |
88 | Q_ASSERT(keys.size() == 1); | |
90 | QVERIFY(!keylistresult.error()); | |
91 | QVERIFY(keys.size() == 1); | |
89 | 92 | delete listjob; |
90 | 93 | |
91 | 94 | auto job = openpgp()->encryptJob(/*ASCII Armor */true, /* Textmode */ true); |
92 | Q_ASSERT(job); | |
95 | QVERIFY(job); | |
93 | 96 | QByteArray cipherText; |
94 | 97 | auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText); |
95 | 98 | delete job; |
96 | Q_ASSERT(!result.error()); | |
99 | QVERIFY(!result.error()); | |
97 | 100 | const auto cipherString = QString::fromUtf8(cipherText); |
98 | Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); | |
101 | QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); | |
99 | 102 | |
100 | 103 | /* Now decrypt */ |
101 | 104 | if (!decryptSupported()) { |
108 | 111 | auto decJob = new QGpgMEDecryptJob(ctx); |
109 | 112 | QByteArray plainText; |
110 | 113 | auto decResult = decJob->exec(cipherText, plainText); |
111 | Q_ASSERT(!result.error()); | |
112 | Q_ASSERT(QString::fromUtf8(plainText) == QStringLiteral("Hello World")); | |
114 | QVERIFY(!decResult.error()); | |
115 | QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello World")); | |
113 | 116 | delete decJob; |
114 | 117 | } |
115 | 118 | |
124 | 127 | std::vector<Key> keys; |
125 | 128 | auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), |
126 | 129 | false, keys); |
127 | Q_ASSERT(!keylistresult.error()); | |
128 | Q_ASSERT(keys.size() == 1); | |
130 | QVERIFY(!keylistresult.error()); | |
131 | QVERIFY(keys.size() == 1); | |
129 | 132 | delete listjob; |
130 | 133 | |
131 | 134 | auto job = openpgp()->encryptJob(/*ASCII Armor */false, /* Textmode */ false); |
132 | Q_ASSERT(job); | |
135 | QVERIFY(job); | |
133 | 136 | QByteArray plainBa; |
134 | 137 | plainBa.fill('X', PROGRESS_TEST_SIZE); |
135 | 138 | QByteArray cipherText; |
139 | 142 | connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString&, int current, int total) { |
140 | 143 | // We only check for progress 0 and max progress as the other progress |
141 | 144 | // lines depend on the system speed and are as such unreliable to test. |
142 | Q_ASSERT(total == PROGRESS_TEST_SIZE); | |
145 | QVERIFY(total == PROGRESS_TEST_SIZE); | |
143 | 146 | if (current == 0) { |
144 | 147 | initSeen = true; |
145 | 148 | } |
146 | 149 | if (current == total) { |
147 | 150 | finishSeen = true; |
148 | 151 | } |
149 | Q_ASSERT(current >= 0 && current <= total); | |
152 | QVERIFY(current >= 0 && current <= total); | |
150 | 153 | }); |
151 | 154 | connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &, |
152 | 155 | const QByteArray &, |
153 | 156 | const QString, |
154 | 157 | const GpgME::Error) { |
155 | Q_ASSERT(initSeen); | |
156 | Q_ASSERT(finishSeen); | |
158 | QVERIFY(initSeen); | |
159 | QVERIFY(finishSeen); | |
157 | 160 | Q_EMIT asyncDone(); |
158 | 161 | }); |
159 | 162 | |
164 | 167 | |
165 | 168 | job->start(keys, inptr, outptr, Context::AlwaysTrust); |
166 | 169 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
167 | Q_ASSERT(spy.wait()); | |
170 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
168 | 171 | } |
169 | 172 | |
170 | 173 | void testSymmetricEncryptDecrypt() |
182 | 185 | QByteArray cipherText; |
183 | 186 | auto result = job->exec(std::vector<Key>(), QStringLiteral("Hello symmetric World").toUtf8(), Context::AlwaysTrust, cipherText); |
184 | 187 | delete job; |
185 | Q_ASSERT(!result.error()); | |
188 | QVERIFY(!result.error()); | |
186 | 189 | const auto cipherString = QString::fromUtf8(cipherText); |
187 | Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); | |
190 | QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); | |
188 | 191 | |
189 | 192 | killAgent(mDir.path()); |
190 | 193 | |
194 | 197 | auto decJob = new QGpgMEDecryptJob(ctx2); |
195 | 198 | QByteArray plainText; |
196 | 199 | auto decResult = decJob->exec(cipherText, plainText); |
197 | Q_ASSERT(!result.error()); | |
198 | Q_ASSERT(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World")); | |
200 | QVERIFY(!result.error()); | |
201 | QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World")); | |
199 | 202 | delete decJob; |
203 | } | |
204 | ||
205 | private: | |
206 | /* This apparently does not work under ASAN currently. TODO fix and reeanble */ | |
207 | void testEncryptDecryptNowrap() | |
208 | { | |
209 | /* Now decrypt */ | |
210 | if (!decryptSupported()) { | |
211 | return; | |
212 | } | |
213 | auto listjob = openpgp()->keyListJob(false, false, false); | |
214 | std::vector<Key> keys; | |
215 | auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), | |
216 | false, keys); | |
217 | QVERIFY(!keylistresult.error()); | |
218 | QVERIFY(keys.size() == 1); | |
219 | delete listjob; | |
220 | ||
221 | auto job = openpgp()->signEncryptJob(/*ASCII Armor */true, /* Textmode */ true); | |
222 | ||
223 | auto encSignCtx = Job::context(job); | |
224 | TestPassphraseProvider provider1; | |
225 | encSignCtx->setPassphraseProvider(&provider1); | |
226 | encSignCtx->setPinentryMode(Context::PinentryLoopback); | |
227 | ||
228 | QVERIFY(job); | |
229 | QByteArray cipherText; | |
230 | auto result = job->exec(keys, keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText); | |
231 | delete job; | |
232 | QVERIFY(!result.first.error()); | |
233 | QVERIFY(!result.second.error()); | |
234 | const auto cipherString = QString::fromUtf8(cipherText); | |
235 | QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); | |
236 | ||
237 | /* Now decrypt */ | |
238 | if (!decryptSupported()) { | |
239 | return; | |
240 | } | |
241 | auto ctx = Context::createForProtocol(OpenPGP); | |
242 | TestPassphraseProvider provider; | |
243 | ctx->setPassphraseProvider(&provider); | |
244 | ctx->setPinentryMode(Context::PinentryLoopback); | |
245 | ctx->setDecryptionFlags(Context::DecryptUnwrap); | |
246 | ||
247 | auto decJob = new QGpgMEDecryptJob(ctx); | |
248 | QByteArray plainText; | |
249 | auto decResult = decJob->exec(cipherText, plainText); | |
250 | ||
251 | QVERIFY(!decResult.error()); | |
252 | ||
253 | delete decJob; | |
254 | ||
255 | // Now verify the unwrapeped data. | |
256 | auto verifyJob = openpgp()->verifyOpaqueJob(true); | |
257 | QByteArray verified; | |
258 | ||
259 | auto verResult = verifyJob->exec(plainText, verified); | |
260 | QVERIFY(!verResult.error()); | |
261 | delete verifyJob; | |
262 | ||
263 | QVERIFY(verResult.numSignatures() == 1); | |
264 | auto sig = verResult.signatures()[0]; | |
265 | ||
266 | QVERIFY(verified == QStringLiteral("Hello World")); | |
200 | 267 | } |
201 | 268 | |
202 | 269 | private: |
211 | 278 | std::vector<Key> keys; |
212 | 279 | auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), |
213 | 280 | false, keys); |
214 | Q_ASSERT(!keylistresult.error()); | |
215 | Q_ASSERT(keys.size() == 1); | |
281 | QVERIFY(!keylistresult.error()); | |
282 | QVERIFY(keys.size() == 1); | |
216 | 283 | delete listjob; |
217 | 284 | |
218 | 285 | auto ctx = Context::createForProtocol(OpenPGP); |
228 | 295 | cipherText); |
229 | 296 | printf("After exec\n"); |
230 | 297 | delete job; |
231 | Q_ASSERT(!result.error()); | |
298 | QVERIFY(!result.error()); | |
232 | 299 | printf("Cipher:\n%s\n", cipherText.constData()); |
233 | 300 | const auto cipherString = QString::fromUtf8(cipherText); |
234 | Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); | |
301 | QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); | |
235 | 302 | |
236 | 303 | killAgent(mDir.path()); |
237 | 304 | |
239 | 306 | QTemporaryDir tmp; |
240 | 307 | qputenv("GNUPGHOME", tmp.path().toUtf8()); |
241 | 308 | QFile agentConf(tmp.path() + QStringLiteral("/gpg-agent.conf")); |
242 | Q_ASSERT(agentConf.open(QIODevice::WriteOnly)); | |
309 | QVERIFY(agentConf.open(QIODevice::WriteOnly)); | |
243 | 310 | agentConf.write("allow-loopback-pinentry"); |
244 | 311 | agentConf.close(); |
245 | 312 | |
250 | 317 | auto decJob = new QGpgMEDecryptJob(ctx2); |
251 | 318 | QByteArray plainText; |
252 | 319 | auto decResult = decJob->exec(cipherText, plainText); |
253 | Q_ASSERT(!decResult.error()); | |
320 | QVERIFY(!decResult.error()); | |
254 | 321 | qDebug() << "Plain: " << plainText; |
255 | Q_ASSERT(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World")); | |
322 | QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World")); | |
256 | 323 | delete decJob; |
257 | 324 | |
258 | 325 | killAgent(tmp.path()); |
266 | 333 | QGpgMETest::initTestCase(); |
267 | 334 | const QString gpgHome = qgetenv("GNUPGHOME"); |
268 | 335 | qputenv("GNUPGHOME", mDir.path().toUtf8()); |
269 | Q_ASSERT(mDir.isValid()); | |
336 | QVERIFY(mDir.isValid()); | |
270 | 337 | QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf")); |
271 | Q_ASSERT(agentConf.open(QIODevice::WriteOnly)); | |
338 | QVERIFY(agentConf.open(QIODevice::WriteOnly)); | |
272 | 339 | agentConf.write("allow-loopback-pinentry"); |
273 | 340 | agentConf.close(); |
274 | Q_ASSERT(copyKeyrings(gpgHome, mDir.path())); | |
341 | QVERIFY(copyKeyrings(gpgHome, mDir.path())); | |
275 | 342 | } |
276 | 343 | |
277 | 344 | private: |
60 | 60 | GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa@example.net"), |
61 | 61 | false, keys); |
62 | 62 | delete job; |
63 | Q_ASSERT (!result.error()); | |
64 | Q_ASSERT (keys.size() == 1); | |
63 | QVERIFY (!result.error()); | |
64 | QVERIFY (keys.size() == 1); | |
65 | 65 | const QString kId = QLatin1String(keys.front().keyID()); |
66 | Q_ASSERT (kId == QStringLiteral("2D727CC768697734")); | |
66 | QVERIFY (kId == QStringLiteral("2D727CC768697734")); | |
67 | 67 | |
68 | Q_ASSERT (keys[0].subkeys().size() == 2); | |
69 | Q_ASSERT (keys[0].subkeys()[0].publicKeyAlgorithm() == Subkey::AlgoDSA); | |
70 | Q_ASSERT (keys[0].subkeys()[1].publicKeyAlgorithm() == Subkey::AlgoELG_E); | |
68 | QVERIFY (keys[0].subkeys().size() == 2); | |
69 | QVERIFY (keys[0].subkeys()[0].publicKeyAlgorithm() == Subkey::AlgoDSA); | |
70 | QVERIFY (keys[0].subkeys()[1].publicKeyAlgorithm() == Subkey::AlgoELG_E); | |
71 | 71 | } |
72 | 72 | |
73 | 73 | void testPubkeyAlgoAsString() |
86 | 86 | { Subkey::AlgoUnknown, QString() } |
87 | 87 | }; |
88 | 88 | Q_FOREACH (Subkey::PubkeyAlgo algo, expected.keys()) { |
89 | Q_ASSERT(QString::fromUtf8(Subkey::publicKeyAlgorithmAsString(algo)) == | |
89 | QVERIFY(QString::fromUtf8(Subkey::publicKeyAlgorithmAsString(algo)) == | |
90 | 90 | expected.value(algo)); |
91 | 91 | } |
92 | 92 | } |
96 | 96 | KeyListJob *job = openpgp()->keyListJob(); |
97 | 97 | connect(job, &KeyListJob::result, job, [this, job](KeyListResult, std::vector<Key> keys, QString, Error) |
98 | 98 | { |
99 | Q_ASSERT(keys.size() == 1); | |
99 | QVERIFY(keys.size() == 1); | |
100 | 100 | Q_EMIT asyncDone(); |
101 | 101 | }); |
102 | 102 | job->start(QStringList() << "alfa@example.net"); |
103 | 103 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
104 | Q_ASSERT(spy.wait()); | |
104 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
105 | 105 | } |
106 | 106 | }; |
107 | 107 |
62 | 62 | qputenv("GNUPGHOME", dir.path().toUtf8()); |
63 | 63 | /* Could do this with gpgconf but this is not a gpgconf test ;-) */ |
64 | 64 | QFile conf(dir.path() + QStringLiteral("/gpg.conf")); |
65 | Q_ASSERT(conf.open(QIODevice::WriteOnly)); | |
65 | QVERIFY(conf.open(QIODevice::WriteOnly)); | |
66 | 66 | conf.write("auto-key-locate dane"); |
67 | 67 | conf.close(); |
68 | 68 | |
70 | 70 | mTestpattern = QStringLiteral("wk@gnupg.org"); |
71 | 71 | connect(job, &KeyListJob::result, job, [this, job](KeyListResult result, std::vector<Key> keys, QString, Error) |
72 | 72 | { |
73 | Q_ASSERT(!result.error()); | |
74 | Q_ASSERT(keys.size() == 1); | |
73 | QVERIFY(!result.error()); | |
74 | QVERIFY(keys.size() == 1); | |
75 | 75 | |
76 | 76 | Key k = keys.front(); |
77 | Q_ASSERT(k.numUserIDs()); | |
77 | QVERIFY(k.numUserIDs()); | |
78 | 78 | bool found = false; |
79 | 79 | Q_FOREACH (const UserID uid, k.userIDs()) { |
80 | 80 | const QString mailBox = QString::fromUtf8(uid.email()); |
82 | 82 | found = true; |
83 | 83 | } |
84 | 84 | } |
85 | Q_ASSERT(found); | |
85 | QVERIFY(found); | |
86 | 86 | Q_EMIT asyncDone(); |
87 | 87 | }); |
88 | 88 | job->start(QStringList() << mTestpattern); |
89 | 89 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
90 | Q_ASSERT(spy.wait()); | |
90 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
91 | 91 | qputenv("GNUPGHOME", oldHome.toUtf8()); |
92 | 92 | } |
93 | 93 | #endif |
102 | 102 | |
103 | 103 | connect(job, &KeyListJob::result, job, [this, job](KeyListResult result, std::vector<Key> keys, QString, Error) |
104 | 104 | { |
105 | Q_ASSERT(!result.isNull()); | |
106 | Q_ASSERT(!result.isTruncated()); | |
107 | Q_ASSERT(!result.error()); | |
108 | Q_ASSERT(keys.size() == 1); | |
105 | QVERIFY(!result.isNull()); | |
106 | QVERIFY(!result.isTruncated()); | |
107 | QVERIFY(!result.error()); | |
108 | QVERIFY(keys.size() == 1); | |
109 | 109 | |
110 | 110 | Key k = keys.front(); |
111 | Q_ASSERT(k.numUserIDs()); | |
111 | QVERIFY(k.numUserIDs()); | |
112 | 112 | bool found = false; |
113 | 113 | Q_FOREACH (const UserID uid, k.userIDs()) { |
114 | 114 | const QString mailBox = QString::fromUtf8(uid.email()); |
116 | 116 | found = true; |
117 | 117 | } |
118 | 118 | } |
119 | Q_ASSERT(found); | |
119 | QVERIFY(found); | |
120 | 120 | Q_EMIT asyncDone(); |
121 | 121 | }); |
122 | 122 | job->start(QStringList() << mTestpattern); |
123 | 123 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
124 | Q_ASSERT(spy.wait()); | |
124 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
125 | 125 | } |
126 | 126 | |
127 | 127 | private: |
61 | 61 | GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa@example.net"), |
62 | 62 | false, keys); |
63 | 63 | delete job; |
64 | Q_ASSERT (!result.error()); | |
65 | Q_ASSERT (keys.size() == 1); | |
64 | QVERIFY (!result.error()); | |
65 | QVERIFY (keys.size() == 1); | |
66 | 66 | Key key = keys.front(); |
67 | Q_ASSERT (key.ownerTrust() == Key::Unknown); | |
67 | QVERIFY (key.ownerTrust() == Key::Unknown); | |
68 | 68 | |
69 | 69 | ChangeOwnerTrustJob *job2 = openpgp()->changeOwnerTrustJob(); |
70 | 70 | connect(job2, &ChangeOwnerTrustJob::result, this, [this](Error e) |
72 | 72 | if (e) { |
73 | 73 | qDebug() << "Error in result: " << e.asString(); |
74 | 74 | } |
75 | Q_ASSERT(!e); | |
75 | QVERIFY(!e); | |
76 | 76 | Q_EMIT asyncDone(); |
77 | 77 | }); |
78 | 78 | job2->start(key, Key::Ultimate); |
79 | 79 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
80 | Q_ASSERT(spy.wait()); | |
80 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
81 | 81 | |
82 | 82 | job = openpgp()->keyListJob(false, true, true); |
83 | 83 | result = job->exec(QStringList() << QStringLiteral("alfa@example.net"), |
84 | 84 | false, keys); |
85 | 85 | delete job; |
86 | 86 | key = keys.front(); |
87 | Q_ASSERT (key.ownerTrust() == Key::Ultimate); | |
87 | QVERIFY (key.ownerTrust() == Key::Ultimate); | |
88 | 88 | |
89 | 89 | ChangeOwnerTrustJob *job3 = openpgp()->changeOwnerTrustJob(); |
90 | 90 | connect(job3, &ChangeOwnerTrustJob::result, this, [this](Error e) |
91 | 91 | { |
92 | Q_ASSERT(!e); | |
92 | QVERIFY(!e); | |
93 | 93 | Q_EMIT asyncDone(); |
94 | 94 | }); |
95 | 95 | job3->start(key, Key::Unknown); |
96 | Q_ASSERT(spy.wait()); | |
96 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
97 | 97 | |
98 | 98 | job = openpgp()->keyListJob(false, true, true); |
99 | 99 | result = job->exec(QStringList() << QStringLiteral("alfa@example.net"), |
101 | 101 | delete job; |
102 | 102 | |
103 | 103 | key = keys.front(); |
104 | Q_ASSERT (key.ownerTrust() == Key::Unknown); | |
104 | QVERIFY (key.ownerTrust() == Key::Unknown); | |
105 | 105 | } |
106 | 106 | }; |
107 | 107 |
33 | 33 | #endif |
34 | 34 | |
35 | 35 | #include "t-support.h" |
36 | #include "context.h" | |
36 | 37 | |
37 | 38 | #include <QTest> |
38 | 39 | |
43 | 44 | |
44 | 45 | void QGpgMETest::initTestCase() |
45 | 46 | { |
47 | GpgME::initializeLibrary(); | |
46 | 48 | const QString gpgHome = qgetenv("GNUPGHOME"); |
47 | 49 | QVERIFY2(!gpgHome.isEmpty(), "GNUPGHOME environment variable is not set."); |
48 | 50 | } |
33 | 33 | #include "interfaces/passphraseprovider.h" |
34 | 34 | #include <QObject> |
35 | 35 | |
36 | #include <gpg-error.h> | |
37 | ||
36 | 38 | namespace GpgME |
37 | 39 | { |
38 | 40 | class TestPassphraseProvider : public PassphraseProvider |
41 | 43 | char *getPassphrase(const char * /*useridHint*/, const char * /*description*/, |
42 | 44 | bool /*previousWasBad*/, bool &/*canceled*/) Q_DECL_OVERRIDE |
43 | 45 | { |
44 | return strdup("abc"); | |
46 | char *ret; | |
47 | gpgrt_asprintf(&ret, "abc"); | |
48 | return ret; | |
45 | 49 | } |
46 | 50 | }; |
47 | 51 | } // namespace GpgME |
59 | 63 | void cleanupTestCase(); |
60 | 64 | }; |
61 | 65 | |
66 | /* Timeout, in milliseconds, for use with QSignalSpy to wait on | |
67 | signals. */ | |
68 | #define QSIGNALSPY_TIMEOUT 60000 | |
69 | ||
62 | 70 | #endif // T_SUPPORT_H |
34 | 34 | #include <QDebug> |
35 | 35 | #include <QTest> |
36 | 36 | #include <QTemporaryDir> |
37 | #include <QSignalSpy> | |
38 | ||
37 | 39 | #include "protocol.h" |
38 | 40 | #include "tofuinfo.h" |
39 | 41 | #include "tofupolicyjob.h" |
40 | 42 | #include "verifyopaquejob.h" |
41 | 43 | #include "verificationresult.h" |
42 | 44 | #include "signingresult.h" |
45 | #include "importjob.h" | |
46 | #include "importresult.h" | |
43 | 47 | #include "keylistjob.h" |
44 | 48 | #include "keylistresult.h" |
45 | 49 | #include "qgpgmesignjob.h" |
60 | 64 | "=Crq6\n" |
61 | 65 | "-----END PGP MESSAGE-----\n"; |
62 | 66 | |
67 | static const char conflictKey1[] = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" | |
68 | "\n" | |
69 | "mDMEWG+w/hYJKwYBBAHaRw8BAQdAiq1oStvDYg8ZfFs5DgisYJo8dJxD+C/AA21O\n" | |
70 | "K/aif0O0GXRvZnVfY29uZmxpY3RAZXhhbXBsZS5jb22IlgQTFggAPhYhBHoJBLaV\n" | |
71 | "DamYAgoa1L5BwMOl/x88BQJYb7D+AhsDBQkDwmcABQsJCAcCBhUICQoLAgQWAgMB\n" | |
72 | "Ah4BAheAAAoJEL5BwMOl/x88GvwA/0SxkbLyAcshGm2PRrPsFQsSVAfwaSYFVmS2\n" | |
73 | "cMVIw1PfAQDclRH1Z4MpufK07ju4qI33o4s0UFpVRBuSxt7A4P2ZD7g4BFhvsP4S\n" | |
74 | "CisGAQQBl1UBBQEBB0AmVrgaDNJ7K2BSalsRo2EkRJjHGqnp5bBB0tapnF81CQMB\n" | |
75 | "CAeIeAQYFggAIBYhBHoJBLaVDamYAgoa1L5BwMOl/x88BQJYb7D+AhsMAAoJEL5B\n" | |
76 | "wMOl/x88OR0BAMq4/vmJUORRTmzjHcv/DDrQB030DSq666rlckGIKTShAPoDXM9N\n" | |
77 | "0gZK+YzvrinSKZXHmn0aSwmC1/hyPybJPEljBw==\n" | |
78 | "=p2Oj\n" | |
79 | "-----END PGP PUBLIC KEY BLOCK-----\n"; | |
80 | ||
81 | static const char conflictKey2[] = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" | |
82 | "\n" | |
83 | "mDMEWG+xShYJKwYBBAHaRw8BAQdA567gPEPJRpqKnZjlFJMRNUqruRviYMyygfF6\n" | |
84 | "6Ok+ygu0GXRvZnVfY29uZmxpY3RAZXhhbXBsZS5jb22IlgQTFggAPhYhBJ5kRh7E\n" | |
85 | "I98w8kgUcmkAfYFvqqHsBQJYb7FKAhsDBQkDwmcABQsJCAcCBhUICQoLAgQWAgMB\n" | |
86 | "Ah4BAheAAAoJEGkAfYFvqqHsYR0BAOz8JjYB4VvGkt6noLS3F5TLfsedGwQkBCw5\n" | |
87 | "znw/vGZsAQD9DSX+ekwdrN56mNO8ISt5uVS7B1ZQtouNBF+nzcwbDbg4BFhvsUoS\n" | |
88 | "CisGAQQBl1UBBQEBB0BFupW8+Xc1ikab8TJqANjQhvFVh6uLsgcK4g9lZgbGXAMB\n" | |
89 | "CAeIeAQYFggAIBYhBJ5kRh7EI98w8kgUcmkAfYFvqqHsBQJYb7FKAhsMAAoJEGkA\n" | |
90 | "fYFvqqHs15ABALdN3uiV/07cJ3RkNb3WPcijGsto+lECDS11dKEwTMFeAQDx+V36\n" | |
91 | "ocbYC/xEuwi3w45oNqGieazzcD/GBbt8OBk3BA==\n" | |
92 | "=45IR\n" | |
93 | "-----END PGP PUBLIC KEY BLOCK-----\n"; | |
94 | ||
95 | static const char conflictMsg1[] = "-----BEGIN PGP MESSAGE-----\n" | |
96 | "\n" | |
97 | "owGbwMvMwCG2z/HA4aX/5W0YT3MlMUTkb2xPSizi6ihlYRDjYJAVU2Sp4mTZNpV3\n" | |
98 | "5QwmLqkrMLWsTCCFDFycAjCR1vcMf4U0Qrs6qzqfHJ9puGOFduLN2nVmhsumxjBE\n" | |
99 | "mdw4lr1ehIWR4QdLuNBpe86PGx1PtNXfVAzm/hu+vfjCp5BVNjPTM9L0eAA=\n" | |
100 | "=MfBD\n" | |
101 | "-----END PGP MESSAGE-----\n"; | |
102 | ||
103 | static const char conflictMsg2[] = "-----BEGIN PGP MESSAGE-----\n" | |
104 | "\n" | |
105 | "owGbwMvMwCGWyVDbmL9q4RvG01xJDBH5GyvS8vO5OkpZGMQ4GGTFFFnmpbjJHVG+\n" | |
106 | "b/DJQ6QIppaVCaSQgYtTACaySZHhr/SOPrdFJ89KrcwKY5i1XnflXYf2PK76SafK\n" | |
107 | "tkxXuXzvJAvDX4kCybuqFk3HXCexz2+IrnZ+5X5EqOnuo3ens2cte+uzlhMA\n" | |
108 | "=BIAi\n" | |
109 | "-----END PGP MESSAGE-----\n"; | |
110 | ||
63 | 111 | class TofuInfoTest: public QGpgMETest |
64 | 112 | { |
65 | 113 | Q_OBJECT |
66 | ||
114 | Q_SIGNALS: | |
115 | void asyncDone(); | |
116 | ||
117 | private: | |
67 | 118 | bool testSupported() |
68 | 119 | { |
69 | 120 | return !(GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.16"); |
71 | 122 | |
72 | 123 | void testTofuCopy(TofuInfo other, const TofuInfo &orig) |
73 | 124 | { |
74 | Q_ASSERT(!orig.isNull()); | |
75 | Q_ASSERT(!other.isNull()); | |
76 | Q_ASSERT(orig.signLast() == other.signLast()); | |
77 | Q_ASSERT(orig.signCount() == other.signCount()); | |
78 | Q_ASSERT(orig.validity() == other.validity()); | |
79 | Q_ASSERT(orig.policy() == other.policy()); | |
125 | QVERIFY(!orig.isNull()); | |
126 | QVERIFY(!other.isNull()); | |
127 | QVERIFY(orig.signLast() == other.signLast()); | |
128 | QVERIFY(orig.signCount() == other.signCount()); | |
129 | QVERIFY(orig.validity() == other.validity()); | |
130 | QVERIFY(orig.policy() == other.policy()); | |
80 | 131 | } |
81 | 132 | |
82 | 133 | void signAndVerify(const QString &what, const GpgME::Key &key, int expected) |
93 | 144 | auto sigResult = job->exec(keys, what.toUtf8(), NormalSignatureMode, signedData); |
94 | 145 | delete job; |
95 | 146 | |
96 | Q_ASSERT(!sigResult.error()); | |
147 | QVERIFY(!sigResult.error()); | |
97 | 148 | foreach (const auto uid, keys[0].userIDs()) { |
98 | 149 | auto info = uid.tofuInfo(); |
99 | Q_ASSERT(info.signCount() == expected - 1); | |
150 | QVERIFY(info.signCount() == expected - 1); | |
100 | 151 | } |
101 | 152 | |
102 | 153 | auto verifyJob = openpgp()->verifyOpaqueJob(); |
105 | 156 | auto result = verifyJob->exec(signedData, verified); |
106 | 157 | delete verifyJob; |
107 | 158 | |
108 | Q_ASSERT(!result.error()); | |
109 | Q_ASSERT(verified == what.toUtf8()); | |
110 | ||
111 | Q_ASSERT(result.numSignatures() == 1); | |
159 | QVERIFY(!result.error()); | |
160 | QVERIFY(verified == what.toUtf8()); | |
161 | ||
162 | QVERIFY(result.numSignatures() == 1); | |
112 | 163 | auto sig = result.signatures()[0]; |
113 | 164 | |
114 | 165 | auto key2 = sig.key(); |
115 | Q_ASSERT(!key.isNull()); | |
116 | Q_ASSERT(!strcmp (key2.primaryFingerprint(), key.primaryFingerprint())); | |
117 | Q_ASSERT(!strcmp (key.primaryFingerprint(), sig.fingerprint())); | |
166 | QVERIFY(!key.isNull()); | |
167 | QVERIFY(!strcmp (key2.primaryFingerprint(), key.primaryFingerprint())); | |
168 | QVERIFY(!strcmp (key.primaryFingerprint(), sig.fingerprint())); | |
118 | 169 | auto stats = key2.userID(0).tofuInfo(); |
119 | Q_ASSERT(!stats.isNull()); | |
170 | QVERIFY(!stats.isNull()); | |
120 | 171 | if (stats.signCount() != expected) { |
121 | 172 | std::cout << "################ Key before verify: " |
122 | 173 | << key |
123 | 174 | << "################ Key after verify: " |
124 | 175 | << key2; |
125 | 176 | } |
126 | Q_ASSERT(stats.signCount() == expected); | |
177 | QVERIFY(stats.signCount() == expected); | |
127 | 178 | } |
128 | 179 | |
129 | 180 | private Q_SLOTS: |
133 | 184 | return; |
134 | 185 | } |
135 | 186 | TofuInfo tofu; |
136 | Q_ASSERT(tofu.isNull()); | |
137 | Q_ASSERT(!tofu.description()); | |
138 | Q_ASSERT(!tofu.signCount()); | |
139 | Q_ASSERT(!tofu.signLast()); | |
140 | Q_ASSERT(!tofu.signFirst()); | |
141 | Q_ASSERT(tofu.validity() == TofuInfo::ValidityUnknown); | |
142 | Q_ASSERT(tofu.policy() == TofuInfo::PolicyUnknown); | |
187 | QVERIFY(tofu.isNull()); | |
188 | QVERIFY(!tofu.description()); | |
189 | QVERIFY(!tofu.signCount()); | |
190 | QVERIFY(!tofu.signLast()); | |
191 | QVERIFY(!tofu.signFirst()); | |
192 | QVERIFY(tofu.validity() == TofuInfo::ValidityUnknown); | |
193 | QVERIFY(tofu.policy() == TofuInfo::PolicyUnknown); | |
143 | 194 | } |
144 | 195 | |
145 | 196 | void testTofuInfo() |
152 | 203 | QByteArray plaintext; |
153 | 204 | |
154 | 205 | auto ctx = Job::context(job); |
155 | Q_ASSERT(ctx); | |
206 | QVERIFY(ctx); | |
156 | 207 | ctx->setSender("alfa@example.net"); |
157 | 208 | |
158 | 209 | auto result = job->exec(data1, plaintext); |
159 | 210 | delete job; |
160 | 211 | |
161 | Q_ASSERT(!result.isNull()); | |
162 | Q_ASSERT(!result.error()); | |
163 | Q_ASSERT(!strcmp(plaintext.constData(), "Just GNU it!\n")); | |
164 | ||
165 | Q_ASSERT(result.numSignatures() == 1); | |
212 | QVERIFY(!result.isNull()); | |
213 | QVERIFY(!result.error()); | |
214 | QVERIFY(!strcmp(plaintext.constData(), "Just GNU it!\n")); | |
215 | ||
216 | QVERIFY(result.numSignatures() == 1); | |
166 | 217 | Signature sig = result.signatures()[0]; |
167 | 218 | /* TOFU is always marginal */ |
168 | Q_ASSERT(sig.validity() == Signature::Marginal); | |
219 | QVERIFY(sig.validity() == Signature::Marginal); | |
169 | 220 | |
170 | 221 | auto stats = sig.key().userID(0).tofuInfo(); |
171 | Q_ASSERT(!stats.isNull()); | |
172 | Q_ASSERT(sig.key().primaryFingerprint()); | |
173 | Q_ASSERT(sig.fingerprint()); | |
174 | Q_ASSERT(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint())); | |
175 | Q_ASSERT(stats.signFirst() == stats.signLast()); | |
176 | Q_ASSERT(stats.signCount() == 1); | |
177 | Q_ASSERT(stats.policy() == TofuInfo::PolicyAuto); | |
178 | Q_ASSERT(stats.validity() == TofuInfo::LittleHistory); | |
222 | QVERIFY(!stats.isNull()); | |
223 | QVERIFY(sig.key().primaryFingerprint()); | |
224 | QVERIFY(sig.fingerprint()); | |
225 | QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint())); | |
226 | QVERIFY(stats.signFirst() == stats.signLast()); | |
227 | QVERIFY(stats.signCount() == 1); | |
228 | QVERIFY(stats.policy() == TofuInfo::PolicyAuto); | |
229 | QVERIFY(stats.validity() == TofuInfo::LittleHistory); | |
179 | 230 | |
180 | 231 | testTofuCopy(stats, stats); |
181 | 232 | |
185 | 236 | result = job->exec(data1, plaintext); |
186 | 237 | delete job; |
187 | 238 | |
188 | Q_ASSERT(!result.isNull()); | |
189 | Q_ASSERT(!result.error()); | |
190 | ||
191 | Q_ASSERT(result.numSignatures() == 1); | |
239 | QVERIFY(!result.isNull()); | |
240 | QVERIFY(!result.error()); | |
241 | ||
242 | QVERIFY(result.numSignatures() == 1); | |
192 | 243 | sig = result.signatures()[0]; |
193 | 244 | /* TOFU is always marginal */ |
194 | Q_ASSERT(sig.validity() == Signature::Marginal); | |
245 | QVERIFY(sig.validity() == Signature::Marginal); | |
195 | 246 | |
196 | 247 | stats = sig.key().userID(0).tofuInfo(); |
197 | Q_ASSERT(!stats.isNull()); | |
198 | Q_ASSERT(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint())); | |
199 | Q_ASSERT(stats.signFirst() == stats.signLast()); | |
200 | Q_ASSERT(stats.signCount() == 1); | |
201 | Q_ASSERT(stats.policy() == TofuInfo::PolicyAuto); | |
202 | Q_ASSERT(stats.validity() == TofuInfo::LittleHistory); | |
248 | QVERIFY(!stats.isNull()); | |
249 | QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint())); | |
250 | QVERIFY(stats.signFirst() == stats.signLast()); | |
251 | QVERIFY(stats.signCount() == 1); | |
252 | QVERIFY(stats.policy() == TofuInfo::PolicyAuto); | |
253 | QVERIFY(stats.validity() == TofuInfo::LittleHistory); | |
203 | 254 | |
204 | 255 | /* Verify that another call yields the same result */ |
205 | 256 | job = openpgp()->verifyOpaqueJob(true); |
206 | 257 | result = job->exec(data1, plaintext); |
207 | 258 | delete job; |
208 | 259 | |
209 | Q_ASSERT(!result.isNull()); | |
210 | Q_ASSERT(!result.error()); | |
211 | ||
212 | Q_ASSERT(result.numSignatures() == 1); | |
260 | QVERIFY(!result.isNull()); | |
261 | QVERIFY(!result.error()); | |
262 | ||
263 | QVERIFY(result.numSignatures() == 1); | |
213 | 264 | sig = result.signatures()[0]; |
214 | 265 | /* TOFU is always marginal */ |
215 | Q_ASSERT(sig.validity() == Signature::Marginal); | |
266 | QVERIFY(sig.validity() == Signature::Marginal); | |
216 | 267 | |
217 | 268 | stats = sig.key().userID(0).tofuInfo(); |
218 | Q_ASSERT(!stats.isNull()); | |
219 | Q_ASSERT(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint())); | |
220 | Q_ASSERT(stats.signFirst() == stats.signLast()); | |
221 | Q_ASSERT(stats.signCount() == 1); | |
222 | Q_ASSERT(stats.policy() == TofuInfo::PolicyAuto); | |
223 | Q_ASSERT(stats.validity() == TofuInfo::LittleHistory); | |
269 | QVERIFY(!stats.isNull()); | |
270 | QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint())); | |
271 | QVERIFY(stats.signFirst() == stats.signLast()); | |
272 | QVERIFY(stats.signCount() == 1); | |
273 | QVERIFY(stats.policy() == TofuInfo::PolicyAuto); | |
274 | QVERIFY(stats.validity() == TofuInfo::LittleHistory); | |
224 | 275 | } |
225 | 276 | |
226 | 277 | void testTofuSignCount() |
234 | 285 | GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("zulu@example.net"), |
235 | 286 | true, keys); |
236 | 287 | delete job; |
237 | Q_ASSERT(!keys.empty()); | |
288 | QVERIFY(!keys.empty()); | |
238 | 289 | Key key = keys[0]; |
239 | Q_ASSERT(!key.isNull()); | |
290 | QVERIFY(!key.isNull()); | |
240 | 291 | |
241 | 292 | /* As we sign & verify quickly here we need different |
242 | 293 | * messages to avoid having them treated as the same |
265 | 316 | auto result = job->exec(QStringList() << QStringLiteral("zulu@example.net"), |
266 | 317 | true, keys); |
267 | 318 | delete job; |
268 | Q_ASSERT(!keys.empty()); | |
319 | QVERIFY(!keys.empty()); | |
269 | 320 | auto key = keys[0]; |
270 | Q_ASSERT(!key.isNull()); | |
271 | Q_ASSERT(key.userID(0).tofuInfo().isNull()); | |
321 | QVERIFY(!key.isNull()); | |
322 | QVERIFY(key.userID(0).tofuInfo().isNull()); | |
272 | 323 | auto keyCopy = key; |
273 | 324 | keyCopy.update(); |
274 | 325 | auto sigCnt = keyCopy.userID(0).tofuInfo().signCount(); |
284 | 335 | result = job->exec(QStringList() << QStringLiteral("zulu@example.net"), |
285 | 336 | true, keys); |
286 | 337 | delete job; |
287 | Q_ASSERT(!result.error()); | |
288 | Q_ASSERT(!keys.empty()); | |
338 | QVERIFY(!result.error()); | |
339 | QVERIFY(!keys.empty()); | |
289 | 340 | auto key2 = keys[0]; |
290 | Q_ASSERT(!key2.isNull()); | |
341 | QVERIFY(!key2.isNull()); | |
291 | 342 | auto info = key2.userID(0).tofuInfo(); |
292 | Q_ASSERT(!info.isNull()); | |
293 | Q_ASSERT(info.signCount()); | |
343 | QVERIFY(!info.isNull()); | |
344 | QVERIFY(info.signCount()); | |
294 | 345 | } |
295 | 346 | |
296 | 347 | void testTofuPolicy() |
325 | 376 | << ">\n fpr: " << key.primaryFingerprint(); |
326 | 377 | } |
327 | 378 | } |
328 | Q_ASSERT(!result.error()); | |
329 | Q_ASSERT(!keys.empty()); | |
379 | QVERIFY(!result.error()); | |
380 | QVERIFY(!keys.empty()); | |
330 | 381 | auto key = keys[0]; |
331 | Q_ASSERT(!key.isNull()); | |
332 | Q_ASSERT(key.userID(0).tofuInfo().policy() != TofuInfo::PolicyBad); | |
382 | QVERIFY(!key.isNull()); | |
383 | QVERIFY(key.userID(0).tofuInfo().policy() != TofuInfo::PolicyBad); | |
333 | 384 | auto *tofuJob = openpgp()->tofuPolicyJob(); |
334 | 385 | auto err = tofuJob->exec(key, TofuInfo::PolicyBad); |
335 | Q_ASSERT(!err); | |
386 | QVERIFY(!err); | |
336 | 387 | result = job->exec(QStringList() << QStringLiteral("bravo@example.net"), |
337 | 388 | false, keys); |
338 | Q_ASSERT(!keys.empty()); | |
389 | QVERIFY(!keys.empty()); | |
339 | 390 | key = keys[0]; |
340 | Q_ASSERT(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyBad); | |
391 | QVERIFY(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyBad); | |
341 | 392 | err = tofuJob->exec(key, TofuInfo::PolicyGood); |
342 | 393 | |
343 | 394 | result = job->exec(QStringList() << QStringLiteral("bravo@example.net"), |
344 | 395 | false, keys); |
345 | 396 | key = keys[0]; |
346 | Q_ASSERT(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyGood); | |
397 | QVERIFY(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyGood); | |
347 | 398 | delete tofuJob; |
348 | 399 | delete job; |
349 | 400 | } |
401 | ||
402 | void testTofuConflict() | |
403 | { | |
404 | if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.19") { | |
405 | return; | |
406 | } | |
407 | ||
408 | // Import key 1 | |
409 | auto importjob = openpgp()->importJob(); | |
410 | connect(importjob, &ImportJob::result, this, | |
411 | [this](ImportResult result, QString, Error) | |
412 | { | |
413 | QVERIFY(!result.error()); | |
414 | QVERIFY(!result.imports().empty()); | |
415 | QVERIFY(result.numImported()); | |
416 | Q_EMIT asyncDone(); | |
417 | }); | |
418 | importjob->start(QByteArray(conflictKey1)); | |
419 | QSignalSpy spy (this, SIGNAL(asyncDone())); | |
420 | QVERIFY(spy.wait()); | |
421 | ||
422 | // Verify Message 1 | |
423 | const QByteArray signedData(conflictMsg1); | |
424 | auto verifyJob = openpgp()->verifyOpaqueJob(true); | |
425 | QByteArray verified; | |
426 | auto result = verifyJob->exec(signedData, verified); | |
427 | delete verifyJob; | |
428 | ||
429 | QVERIFY(!result.isNull()); | |
430 | QVERIFY(!result.error()); | |
431 | ||
432 | QVERIFY(result.numSignatures() == 1); | |
433 | auto sig = result.signatures()[0]; | |
434 | QVERIFY(sig.validity() == Signature::Marginal); | |
435 | ||
436 | auto stats = sig.key().userID(0).tofuInfo(); | |
437 | QVERIFY(!stats.isNull()); | |
438 | QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint())); | |
439 | QVERIFY(stats.signFirst() == stats.signLast()); | |
440 | QVERIFY(stats.signCount() == 1); | |
441 | QVERIFY(stats.policy() == TofuInfo::PolicyAuto); | |
442 | QVERIFY(stats.validity() == TofuInfo::LittleHistory); | |
443 | ||
444 | // Import key 2 | |
445 | importjob = openpgp()->importJob(); | |
446 | connect(importjob, &ImportJob::result, this, | |
447 | [this](ImportResult result, QString, Error) | |
448 | { | |
449 | QVERIFY(!result.error()); | |
450 | QVERIFY(!result.imports().empty()); | |
451 | QVERIFY(result.numImported()); | |
452 | Q_EMIT asyncDone(); | |
453 | }); | |
454 | importjob->start(QByteArray(conflictKey2)); | |
455 | QSignalSpy spy2 (this, SIGNAL(asyncDone())); | |
456 | QVERIFY(spy2.wait()); | |
457 | ||
458 | // Verify Message 2 | |
459 | const QByteArray signedData2(conflictMsg2); | |
460 | QByteArray verified2; | |
461 | verifyJob = openpgp()->verifyOpaqueJob(true); | |
462 | result = verifyJob->exec(signedData2, verified2); | |
463 | delete verifyJob; | |
464 | ||
465 | QVERIFY(!result.isNull()); | |
466 | QVERIFY(!result.error()); | |
467 | ||
468 | QVERIFY(result.numSignatures() == 1); | |
469 | sig = result.signatures()[0]; | |
470 | QVERIFY(sig.validity() == Signature::Unknown); | |
471 | // TODO activate when implemented | |
472 | // QVERIFY(sig.summary() == Signature::TofuConflict); | |
473 | ||
474 | stats = sig.key().userID(0).tofuInfo(); | |
475 | QVERIFY(!stats.isNull()); | |
476 | QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint())); | |
477 | QVERIFY(stats.signFirst() == stats.signLast()); | |
478 | QVERIFY(stats.signCount() == 1); | |
479 | QVERIFY(stats.policy() == TofuInfo::PolicyAsk); | |
480 | QVERIFY(stats.validity() == TofuInfo::Conflict); | |
481 | } | |
482 | ||
350 | 483 | |
351 | 484 | void initTestCase() |
352 | 485 | { |
353 | 486 | QGpgMETest::initTestCase(); |
354 | 487 | const QString gpgHome = qgetenv("GNUPGHOME"); |
355 | 488 | qputenv("GNUPGHOME", mDir.path().toUtf8()); |
356 | Q_ASSERT(mDir.isValid()); | |
489 | QVERIFY(mDir.isValid()); | |
357 | 490 | QFile conf(mDir.path() + QStringLiteral("/gpg.conf")); |
358 | Q_ASSERT(conf.open(QIODevice::WriteOnly)); | |
491 | QVERIFY(conf.open(QIODevice::WriteOnly)); | |
359 | 492 | conf.write("trust-model tofu+pgp"); |
360 | 493 | conf.close(); |
361 | 494 | QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf")); |
362 | Q_ASSERT(agentConf.open(QIODevice::WriteOnly)); | |
495 | QVERIFY(agentConf.open(QIODevice::WriteOnly)); | |
363 | 496 | agentConf.write("allow-loopback-pinentry"); |
364 | 497 | agentConf.close(); |
365 | Q_ASSERT(copyKeyrings(gpgHome, mDir.path())); | |
498 | QVERIFY(copyKeyrings(gpgHome, mDir.path())); | |
366 | 499 | } |
367 | 500 | private: |
368 | 501 | QTemporaryDir mDir; |
0 | /* t-various.cpp | |
1 | ||
2 | This file is part of qgpgme, the Qt API binding for gpgme | |
3 | Copyright (c) 2017 Intevation GmbH | |
4 | ||
5 | QGpgME is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU General Public License as | |
7 | published by the Free Software Foundation; either version 2 of the | |
8 | License, or (at your option) any later version. | |
9 | ||
10 | QGpgME is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program; if not, write to the Free Software | |
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | ||
19 | In addition, as a special exception, the copyright holders give | |
20 | permission to link the code of this program with any edition of | |
21 | the Qt library by Trolltech AS, Norway (or with modified versions | |
22 | of Qt that use the same license as Qt), and distribute linked | |
23 | combinations including the two. You must obey the GNU General | |
24 | Public License in all respects for all of the code used other than | |
25 | Qt. If you modify this file, you may extend this exception to | |
26 | your version of the file, but you are not obligated to do so. If | |
27 | you do not wish to do so, delete this exception statement from | |
28 | your version. | |
29 | */ | |
30 | ||
31 | #ifdef HAVE_CONFIG_H | |
32 | #include "config.h" | |
33 | #endif | |
34 | ||
35 | #include <QDebug> | |
36 | #include <QTest> | |
37 | #include <QSignalSpy> | |
38 | #include <QTemporaryDir> | |
39 | #include "keylistjob.h" | |
40 | #include "protocol.h" | |
41 | #include "keylistresult.h" | |
42 | #include "context.h" | |
43 | #include "engineinfo.h" | |
44 | #include "dn.h" | |
45 | #include "data.h" | |
46 | #include "dataprovider.h" | |
47 | ||
48 | #include "t-support.h" | |
49 | ||
50 | using namespace QGpgME; | |
51 | using namespace GpgME; | |
52 | ||
53 | static const char aKey[] = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" | |
54 | "\n" | |
55 | "mDMEWG+w/hYJKwYBBAHaRw8BAQdAiq1oStvDYg8ZfFs5DgisYJo8dJxD+C/AA21O\n" | |
56 | "K/aif0O0GXRvZnVfY29uZmxpY3RAZXhhbXBsZS5jb22IlgQTFggAPhYhBHoJBLaV\n" | |
57 | "DamYAgoa1L5BwMOl/x88BQJYb7D+AhsDBQkDwmcABQsJCAcCBhUICQoLAgQWAgMB\n" | |
58 | "Ah4BAheAAAoJEL5BwMOl/x88GvwA/0SxkbLyAcshGm2PRrPsFQsSVAfwaSYFVmS2\n" | |
59 | "cMVIw1PfAQDclRH1Z4MpufK07ju4qI33o4s0UFpVRBuSxt7A4P2ZD7g4BFhvsP4S\n" | |
60 | "CisGAQQBl1UBBQEBB0AmVrgaDNJ7K2BSalsRo2EkRJjHGqnp5bBB0tapnF81CQMB\n" | |
61 | "CAeIeAQYFggAIBYhBHoJBLaVDamYAgoa1L5BwMOl/x88BQJYb7D+AhsMAAoJEL5B\n" | |
62 | "wMOl/x88OR0BAMq4/vmJUORRTmzjHcv/DDrQB030DSq666rlckGIKTShAPoDXM9N\n" | |
63 | "0gZK+YzvrinSKZXHmn0aSwmC1/hyPybJPEljBw==\n" | |
64 | "=p2Oj\n" | |
65 | "-----END PGP PUBLIC KEY BLOCK-----\n"; | |
66 | ||
67 | class TestVarious: public QGpgMETest | |
68 | { | |
69 | Q_OBJECT | |
70 | ||
71 | Q_SIGNALS: | |
72 | void asyncDone(); | |
73 | ||
74 | private Q_SLOTS: | |
75 | void testDN() | |
76 | { | |
77 | DN dn(QStringLiteral("CN=Before\\0DAfter,OU=Test,DC=North America,DC=Fabrikam,DC=COM")); | |
78 | QVERIFY(dn.dn() == QStringLiteral("CN=Before\rAfter,OU=Test,DC=North America,DC=Fabrikam,DC=COM")); | |
79 | QStringList attrOrder; | |
80 | attrOrder << QStringLiteral("DC") << QStringLiteral("OU") << QStringLiteral("CN"); | |
81 | dn.setAttributeOrder(attrOrder); | |
82 | QVERIFY(dn.prettyDN() == QStringLiteral("DC=North America,DC=Fabrikam,DC=COM,OU=Test,CN=Before\rAfter")); | |
83 | } | |
84 | ||
85 | void testKeyFromFile() | |
86 | { | |
87 | if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.14") { | |
88 | return; | |
89 | } | |
90 | QGpgME::QByteArrayDataProvider dp(aKey); | |
91 | Data data(&dp); | |
92 | const auto keys = data.toKeys(); | |
93 | QVERIFY(keys.size() == 1); | |
94 | const auto key = keys[0]; | |
95 | QVERIFY(!key.isNull()); | |
96 | QVERIFY(key.primaryFingerprint() == QStringLiteral("7A0904B6950DA998020A1AD4BE41C0C3A5FF1F3C")); | |
97 | } | |
98 | ||
99 | void testQuickUid() | |
100 | { | |
101 | if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.13") { | |
102 | return; | |
103 | } | |
104 | KeyListJob *job = openpgp()->keyListJob(false, true, true); | |
105 | std::vector<GpgME::Key> keys; | |
106 | GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa@example.net"), | |
107 | false, keys); | |
108 | delete job; | |
109 | QVERIFY (!result.error()); | |
110 | QVERIFY (keys.size() == 1); | |
111 | Key key = keys.front(); | |
112 | ||
113 | QVERIFY (key.numUserIDs() == 3); | |
114 | const char uid[] = "Foo Bar (with comment) <foo@bar.baz>"; | |
115 | ||
116 | auto ctx = Context::createForProtocol(key.protocol()); | |
117 | QVERIFY (ctx); | |
118 | TestPassphraseProvider provider; | |
119 | ctx->setPassphraseProvider(&provider); | |
120 | ctx->setPinentryMode(Context::PinentryLoopback); | |
121 | ||
122 | QVERIFY(!ctx->addUid(key, uid)); | |
123 | delete ctx; | |
124 | key.update(); | |
125 | ||
126 | QVERIFY (key.numUserIDs() == 4); | |
127 | bool id_found = false;; | |
128 | for (const auto &u: key.userIDs()) { | |
129 | if (!strcmp (u.id(), uid)) { | |
130 | QVERIFY (!u.isRevoked()); | |
131 | id_found = true; | |
132 | break; | |
133 | } | |
134 | } | |
135 | QVERIFY (id_found); | |
136 | ||
137 | ctx = Context::createForProtocol(key.protocol()); | |
138 | QVERIFY (!ctx->revUid(key, uid)); | |
139 | delete ctx; | |
140 | key.update(); | |
141 | ||
142 | bool id_revoked = false;; | |
143 | for (const auto &u: key.userIDs()) { | |
144 | if (!strcmp (u.id(), uid)) { | |
145 | id_revoked = true; | |
146 | break; | |
147 | } | |
148 | } | |
149 | QVERIFY(id_revoked); | |
150 | } | |
151 | ||
152 | void initTestCase() | |
153 | { | |
154 | QGpgMETest::initTestCase(); | |
155 | const QString gpgHome = qgetenv("GNUPGHOME"); | |
156 | QVERIFY(copyKeyrings(gpgHome, mDir.path())); | |
157 | qputenv("GNUPGHOME", mDir.path().toUtf8()); | |
158 | } | |
159 | ||
160 | private: | |
161 | QTemporaryDir mDir; | |
162 | }; | |
163 | ||
164 | QTEST_MAIN(TestVarious) | |
165 | ||
166 | #include "t-various.moc" |
69 | 69 | QByteArray verified; |
70 | 70 | |
71 | 71 | auto result = verifyJob->exec(signedData, verified); |
72 | Q_ASSERT(!result.error()); | |
72 | QVERIFY(!result.error()); | |
73 | 73 | delete verifyJob; |
74 | 74 | |
75 | Q_ASSERT(result.numSignatures() == 1); | |
75 | QVERIFY(result.numSignatures() == 1); | |
76 | 76 | auto sig = result.signatures()[0]; |
77 | 77 | |
78 | 78 | const auto key = sig.key(true, false); |
79 | Q_ASSERT(!key.isNull()); | |
79 | QVERIFY(!key.isNull()); | |
80 | 80 | |
81 | 81 | bool found = false; |
82 | 82 | for (const auto subkey: key.subkeys()) { |
84 | 84 | found = true; |
85 | 85 | } |
86 | 86 | } |
87 | Q_ASSERT(found); | |
87 | QVERIFY(found); | |
88 | 88 | } |
89 | 89 | }; |
90 | 90 |
126 | 126 | auto job = openpgp()->wksPublishJob(); |
127 | 127 | connect(job, &WKSPublishJob::result, this, |
128 | 128 | [this] (Error err, QByteArray, QByteArray, QString, Error) { |
129 | Q_ASSERT(err); | |
129 | QVERIFY(err); | |
130 | 130 | Q_EMIT asyncDone(); |
131 | 131 | }); |
132 | 132 | job->startCheck ("testuser1@localhost"); |
133 | 133 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
134 | Q_ASSERT(spy.wait()); | |
134 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
135 | 135 | } |
136 | 136 | #ifdef DO_ONLINE_TESTS |
137 | 137 | private Q_SLOTS: |
146 | 146 | [this] (Error err, QByteArray, QByteArray, QString, Error) { |
147 | 147 | if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") { |
148 | 148 | std::cout << err; |
149 | Q_ASSERT(err); | |
149 | QVERIFY(err); | |
150 | 150 | } else { |
151 | Q_ASSERT(!err); | |
151 | QVERIFY(!err); | |
152 | 152 | } |
153 | 153 | Q_EMIT asyncDone(); |
154 | 154 | }); |
155 | 155 | job->startCheck ("testuser1@test.gnupg.org"); |
156 | 156 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
157 | Q_ASSERT(spy.wait()); | |
157 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
158 | 158 | } |
159 | 159 | |
160 | 160 | void testWKSPublishErrors() { |
165 | 165 | auto job = openpgp()->wksPublishJob(); |
166 | 166 | connect(job, &WKSPublishJob::result, this, |
167 | 167 | [this] (Error err, QByteArray, QByteArray, QString, Error) { |
168 | Q_ASSERT(err); | |
168 | QVERIFY(err); | |
169 | 169 | Q_EMIT asyncDone(); |
170 | 170 | }); |
171 | 171 | job->startCreate("AB874F24E98EBB8487EE7B170F8E3D97FE7011B7", |
172 | 172 | QStringLiteral("Foo@bar.baz")); |
173 | 173 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
174 | Q_ASSERT(spy.wait()); | |
174 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
175 | 175 | } |
176 | 176 | |
177 | 177 | void testWKSPublishCreate() { |
198 | 198 | connect(keygenjob, &KeyGenerationJob::result, this, |
199 | 199 | [this, &fpr](KeyGenerationResult result, QByteArray, QString, Error) |
200 | 200 | { |
201 | Q_ASSERT(!result.error()); | |
201 | QVERIFY(!result.error()); | |
202 | 202 | fpr = QByteArray(result.fingerprint()); |
203 | Q_ASSERT(!fpr.isEmpty()); | |
203 | QVERIFY(!fpr.isEmpty()); | |
204 | 204 | Q_EMIT asyncDone(); |
205 | 205 | }); |
206 | 206 | keygenjob->start(args); |
207 | 207 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
208 | Q_ASSERT(spy.wait()); | |
208 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
209 | 209 | |
210 | 210 | /* Then try to create a request. */ |
211 | 211 | auto job = openpgp()->wksPublishJob(); |
212 | 212 | connect(job, &WKSPublishJob::result, this, |
213 | 213 | [this] (Error err, QByteArray out, QByteArray, QString, Error) { |
214 | Q_ASSERT(!err); | |
214 | QVERIFY(!err); | |
215 | 215 | Q_EMIT asyncDone(); |
216 | 216 | const QString outstr = QString(out); |
217 | Q_ASSERT(outstr.contains( | |
217 | QVERIFY(outstr.contains( | |
218 | 218 | QStringLiteral("-----BEGIN PGP PUBLIC KEY BLOCK-----"))); |
219 | Q_ASSERT(outstr.contains( | |
219 | QVERIFY(outstr.contains( | |
220 | 220 | QStringLiteral("Content-Type: application/pgp-keys"))); |
221 | Q_ASSERT(outstr.contains( | |
221 | QVERIFY(outstr.contains( | |
222 | 222 | QStringLiteral("From: " TEST_ADDRESS))); |
223 | 223 | }); |
224 | 224 | job->startCreate(fpr.constData(), QLatin1String(TEST_ADDRESS)); |
225 | Q_ASSERT(spy.wait()); | |
225 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
226 | 226 | } |
227 | 227 | |
228 | 228 | void testWKSPublishReceive() { |
234 | 234 | connect(importjob, &ImportJob::result, this, |
235 | 235 | [this](ImportResult result, QString, Error) |
236 | 236 | { |
237 | Q_ASSERT(!result.error()); | |
238 | Q_ASSERT(!result.imports().empty()); | |
239 | Q_ASSERT(result.numSecretKeysImported()); | |
237 | QVERIFY(!result.error()); | |
238 | QVERIFY(!result.imports().empty()); | |
239 | QVERIFY(result.numSecretKeysImported()); | |
240 | 240 | Q_EMIT asyncDone(); |
241 | 241 | }); |
242 | 242 | importjob->start(QByteArray(testSecKey)); |
243 | 243 | QSignalSpy spy (this, SIGNAL(asyncDone())); |
244 | Q_ASSERT(spy.wait()); | |
244 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
245 | 245 | |
246 | 246 | /* Get a response. */ |
247 | 247 | auto job = openpgp()->wksPublishJob(); |
248 | 248 | connect(job, &WKSPublishJob::result, this, |
249 | 249 | [this] (Error err, QByteArray out, QByteArray, QString, Error) { |
250 | Q_ASSERT(!err); | |
250 | QVERIFY(!err); | |
251 | 251 | Q_EMIT asyncDone(); |
252 | 252 | const QString outstr = QString(out); |
253 | Q_ASSERT(outstr.contains( | |
253 | QVERIFY(outstr.contains( | |
254 | 254 | QStringLiteral("-----BEGIN PGP MESSAGE-----"))); |
255 | Q_ASSERT(outstr.contains( | |
255 | QVERIFY(outstr.contains( | |
256 | 256 | QStringLiteral("Content-Type: multipart/encrypted;"))); |
257 | Q_ASSERT(outstr.contains( | |
257 | QVERIFY(outstr.contains( | |
258 | 258 | QStringLiteral("From: " TEST_ADDRESS))); |
259 | 259 | }); |
260 | 260 | job->startReceive(QByteArray(testResponse)); |
261 | Q_ASSERT(spy.wait()); | |
261 | QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT)); | |
262 | 262 | } |
263 | 263 | |
264 | 264 | void initTestCase() |
266 | 266 | QGpgMETest::initTestCase(); |
267 | 267 | const QString gpgHome = qgetenv("GNUPGHOME"); |
268 | 268 | qputenv("GNUPGHOME", mDir.path().toUtf8()); |
269 | Q_ASSERT(mDir.isValid()); | |
269 | QVERIFY(mDir.isValid()); | |
270 | 270 | QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf")); |
271 | Q_ASSERT(agentConf.open(QIODevice::WriteOnly)); | |
271 | QVERIFY(agentConf.open(QIODevice::WriteOnly)); | |
272 | 272 | agentConf.write("allow-loopback-pinentry"); |
273 | 273 | agentConf.close(); |
274 | 274 | } |
194 | 194 | fi |
195 | 195 | |
196 | 196 | # Make the versioning information available to the compiler |
197 | AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"], | |
198 | [If available, contains the Python version number currently in use.]) | |
197 | ||
198 | # JW: We don't need it and it interferes with the hack | |
199 | # to detect multiple Pyhton versions | |
200 | #AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"], | |
201 | # [If available, contains the Python version number currently in use.]) | |
199 | 202 | |
200 | 203 | # First, the library directory: |
201 | 204 | ac_python_libdir=`cat<<EOD | $PYTHON - |
0 | ## ------------------------ -*- Autoconf -*- | |
1 | ## Python file handling | |
2 | ## From Andrew Dalke | |
3 | ## Updated by James Henstridge | |
4 | ## ------------------------ | |
5 | # Copyright (C) 1999-2017 Free Software Foundation, Inc. | |
6 | # | |
7 | # This file is free software; the Free Software Foundation | |
8 | # gives unlimited permission to copy and/or distribute it, | |
9 | # with or without modifications, as long as this notice is preserved. | |
10 | ||
11 | ||
12 | # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | |
13 | # --------------------------------------------------------------------------- | |
14 | # Adds support for distributing Python modules and packages. To | |
15 | # install modules, copy them to $(pythondir), using the python_PYTHON | |
16 | # automake variable. To install a package with the same name as the | |
17 | # automake package, install to $(pkgpythondir), or use the | |
18 | # pkgpython_PYTHON automake variable. | |
19 | # | |
20 | # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as | |
21 | # locations to install python extension modules (shared libraries). | |
22 | # Another macro is required to find the appropriate flags to compile | |
23 | # extension modules. | |
24 | # | |
25 | # If your package is configured with a different prefix to python, | |
26 | # users will have to add the install directory to the PYTHONPATH | |
27 | # environment variable, or create a .pth file (see the python | |
28 | # documentation for details). | |
29 | # | |
30 | # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will | |
31 | # cause an error if the version of python installed on the system | |
32 | # doesn't meet the requirement. MINIMUM-VERSION should consist of | |
33 | # numbers and dots only. | |
34 | AC_DEFUN([AM_PATH_PYTHON], | |
35 | [ | |
36 | dnl Find a Python interpreter. Python versions prior to 2.0 are not | |
37 | dnl supported. (2.0 was released on October 16, 2000). | |
38 | m4_define_default([_AM_PYTHON_INTERPRETER_LIST], | |
39 | [python2 python2.7 dnl | |
40 | python dnl | |
41 | python3 python3.0 python3.1 python3.2 python3.3 dnl | |
42 | python3.4 python3.5 python3.6 python3.7 python3.8]) | |
43 | ||
44 | AC_ARG_VAR([PYTHON], [the Python interpreter]) | |
45 | ||
46 | m4_if([$1],[],[ | |
47 | dnl No version check is needed. | |
48 | # Find any Python interpreter. | |
49 | if test -z "$PYTHON"; then | |
50 | AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) | |
51 | fi | |
52 | am_display_PYTHON=python | |
53 | ], [ | |
54 | dnl A version check is needed. | |
55 | if test -n "$PYTHON"; then | |
56 | # If the user set $PYTHON, use it and don't search something else. | |
57 | AC_MSG_CHECKING([whether $PYTHON version is >= $1]) | |
58 | AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], | |
59 | [AC_MSG_RESULT([yes])], | |
60 | [AC_MSG_RESULT([no]) | |
61 | AC_MSG_ERROR([Python interpreter is too old])]) | |
62 | am_display_PYTHON=$PYTHON | |
63 | else | |
64 | # Otherwise, try each interpreter until we find one that satisfies | |
65 | # VERSION. | |
66 | AC_CACHE_CHECK([for a Python interpreter with version >= $1], | |
67 | [am_cv_pathless_PYTHON],[ | |
68 | for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do | |
69 | test "$am_cv_pathless_PYTHON" = none && break | |
70 | AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) | |
71 | done]) | |
72 | # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. | |
73 | if test "$am_cv_pathless_PYTHON" = none; then | |
74 | PYTHON=: | |
75 | else | |
76 | AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) | |
77 | fi | |
78 | am_display_PYTHON=$am_cv_pathless_PYTHON | |
79 | fi | |
80 | ]) | |
81 | ||
82 | if test "$PYTHON" = :; then | |
83 | dnl Run any user-specified action, or abort. | |
84 | m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) | |
85 | else | |
86 | ||
87 | dnl Query Python for its version number. Getting [:3] seems to be | |
88 | dnl the best way to do this; it's what "site.py" does in the standard | |
89 | dnl library. | |
90 | ||
91 | AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], | |
92 | [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) | |
93 | AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) | |
94 | ||
95 | dnl Use the values of $prefix and $exec_prefix for the corresponding | |
96 | dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made | |
97 | dnl distinct variables so they can be overridden if need be. However, | |
98 | dnl general consensus is that you shouldn't need this ability. | |
99 | ||
100 | AC_SUBST([PYTHON_PREFIX], ['${prefix}']) | |
101 | AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) | |
102 | ||
103 | dnl At times (like when building shared libraries) you may want | |
104 | dnl to know which OS platform Python thinks this is. | |
105 | ||
106 | AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], | |
107 | [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) | |
108 | AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) | |
109 | ||
110 | # Just factor out some code duplication. | |
111 | am_python_setup_sysconfig="\ | |
112 | import sys | |
113 | # Prefer sysconfig over distutils.sysconfig, for better compatibility | |
114 | # with python 3.x. See automake bug#10227. | |
115 | try: | |
116 | import sysconfig | |
117 | except ImportError: | |
118 | can_use_sysconfig = 0 | |
119 | else: | |
120 | can_use_sysconfig = 1 | |
121 | # Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: | |
122 | # <https://github.com/pypa/virtualenv/issues/118> | |
123 | try: | |
124 | from platform import python_implementation | |
125 | if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': | |
126 | can_use_sysconfig = 0 | |
127 | except ImportError: | |
128 | pass" | |
129 | ||
130 | dnl Set up 4 directories: | |
131 | ||
132 | dnl pythondir -- where to install python scripts. This is the | |
133 | dnl site-packages directory, not the python standard library | |
134 | dnl directory like in previous automake betas. This behavior | |
135 | dnl is more consistent with lispdir.m4 for example. | |
136 | dnl Query distutils for this directory. | |
137 | AC_CACHE_CHECK([for $am_display_PYTHON script directory], | |
138 | [am_cv_python_pythondir], | |
139 | [if test "x$prefix" = xNONE | |
140 | then | |
141 | am_py_prefix=$ac_default_prefix | |
142 | else | |
143 | am_py_prefix=$prefix | |
144 | fi | |
145 | am_cv_python_pythondir=`$PYTHON -c " | |
146 | $am_python_setup_sysconfig | |
147 | if can_use_sysconfig: | |
148 | sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) | |
149 | else: | |
150 | from distutils import sysconfig | |
151 | sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') | |
152 | sys.stdout.write(sitedir)"` | |
153 | case $am_cv_python_pythondir in | |
154 | $am_py_prefix*) | |
155 | am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` | |
156 | am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` | |
157 | ;; | |
158 | *) | |
159 | case $am_py_prefix in | |
160 | /usr|/System*) ;; | |
161 | *) | |
162 | am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages | |
163 | ;; | |
164 | esac | |
165 | ;; | |
166 | esac | |
167 | ]) | |
168 | AC_SUBST([pythondir], [$am_cv_python_pythondir]) | |
169 | ||
170 | dnl pkgpythondir -- $PACKAGE directory under pythondir. Was | |
171 | dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is | |
172 | dnl more consistent with the rest of automake. | |
173 | ||
174 | AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) | |
175 | ||
176 | dnl pyexecdir -- directory for installing python extension modules | |
177 | dnl (shared libraries) | |
178 | dnl Query distutils for this directory. | |
179 | AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], | |
180 | [am_cv_python_pyexecdir], | |
181 | [if test "x$exec_prefix" = xNONE | |
182 | then | |
183 | am_py_exec_prefix=$am_py_prefix | |
184 | else | |
185 | am_py_exec_prefix=$exec_prefix | |
186 | fi | |
187 | am_cv_python_pyexecdir=`$PYTHON -c " | |
188 | $am_python_setup_sysconfig | |
189 | if can_use_sysconfig: | |
190 | sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) | |
191 | else: | |
192 | from distutils import sysconfig | |
193 | sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') | |
194 | sys.stdout.write(sitedir)"` | |
195 | case $am_cv_python_pyexecdir in | |
196 | $am_py_exec_prefix*) | |
197 | am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` | |
198 | am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` | |
199 | ;; | |
200 | *) | |
201 | case $am_py_exec_prefix in | |
202 | /usr|/System*) ;; | |
203 | *) | |
204 | am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages | |
205 | ;; | |
206 | esac | |
207 | ;; | |
208 | esac | |
209 | ]) | |
210 | AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) | |
211 | ||
212 | dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) | |
213 | ||
214 | AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) | |
215 | ||
216 | dnl Run any user-specified action. | |
217 | $2 | |
218 | fi | |
219 | ||
220 | ]) | |
221 | ||
222 | ||
223 | # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) | |
224 | # --------------------------------------------------------------------------- | |
225 | # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. | |
226 | # Run ACTION-IF-FALSE otherwise. | |
227 | # This test uses sys.hexversion instead of the string equivalent (first | |
228 | # word of sys.version), in order to cope with versions such as 2.2c1. | |
229 | # This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). | |
230 | AC_DEFUN([AM_PYTHON_CHECK_VERSION], | |
231 | [prog="import sys | |
232 | # split strings by '.' and convert to numeric. Append some zeros | |
233 | # because we need at least 4 digits for the hex conversion. | |
234 | # map returns an iterator in Python 3.0 and a list in 2.x | |
235 | minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] | |
236 | minverhex = 0 | |
237 | # xrange is not present in Python 3.0 and range returns an iterator | |
238 | for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] | |
239 | sys.exit(sys.hexversion < minverhex)" | |
240 | AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) |
31 | 31 | AC_CHECK_TOOL(MOC, moc) |
32 | 32 | AC_MSG_CHECKING([moc version]) |
33 | 33 | mocversion=`$MOC -v 2>&1` |
34 | mocversiongrep=`echo $mocversion | grep "Qt 5\|moc 5"` | |
34 | mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"` | |
35 | 35 | if test x"$mocversiongrep" != x"$mocversion"; then |
36 | 36 | AC_MSG_RESULT([no]) |
37 | 37 | # moc was not the qt5 one, try with moc-qt5 |
38 | 38 | AC_CHECK_TOOL(MOC2, moc-qt5) |
39 | 39 | mocversion=`$MOC2 -v 2>&1` |
40 | mocversiongrep=`echo $mocversion | grep "Qt 5\|moc-qt5 5\|moc 5"` | |
40 | mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc-qt5 5|moc 5"` | |
41 | 41 | if test x"$mocversiongrep" != x"$mocversion"; then |
42 | 42 | AC_CHECK_TOOL(QTCHOOSER, qtchooser) |
43 | 43 | qt5tooldir=`QT_SELECT=qt5 qtchooser -print-env | grep QTTOOLDIR | cut -d '=' -f 2 | cut -d \" -f 2` |
44 | 44 | mocversion=`$qt5tooldir/moc -v 2>&1` |
45 | mocversiongrep=`echo $mocversion | grep "Qt 5\|moc 5"` | |
45 | mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"` | |
46 | 46 | if test x"$mocversiongrep" != x"$mocversion"; then |
47 | 47 | # no valid moc found |
48 | 48 | have_qt5_libs="no"; |
113 | 113 | /* True if session keys should be exported upon decryption. */ |
114 | 114 | unsigned int export_session_keys : 1; |
115 | 115 | |
116 | /* True if a Pinentry was launched during the last operation. This | |
117 | * flag is cleared with each operation. */ | |
118 | unsigned int redraw_suggested : 1; | |
119 | ||
116 | 120 | /* Flags for keylist mode. */ |
117 | 121 | gpgme_keylist_mode_t keylist_mode; |
118 | 122 | |
119 | /* The current pinnetry mode. */ | |
123 | /* The current pinentry mode. */ | |
120 | 124 | gpgme_pinentry_mode_t pinentry_mode; |
121 | 125 | |
122 | 126 | /* Number of certs to be included. */ |
535 | 535 | } |
536 | 536 | |
537 | 537 | |
538 | /* This function is similar to _gpgme_parse_timestamp but returns an | |
539 | * unsigned long and 0 on error. */ | |
540 | unsigned long | |
541 | _gpgme_parse_timestamp_ul (const char *timestamp) | |
542 | { | |
543 | time_t tim; | |
544 | char *tail; | |
545 | ||
546 | if (!*timestamp) | |
547 | return 0; /* Shortcut empty strings. */ | |
548 | ||
549 | tim = _gpgme_parse_timestamp (timestamp, &tail); | |
550 | if (tim == -1 || timestamp == tail || (*tail && *tail != ' ')) | |
551 | tim = 0; /* No time given or invalid engine. */ | |
552 | ||
553 | return (unsigned long)tim; | |
554 | } | |
555 | ||
556 | ||
538 | 557 | /* The GPG backend uses OpenPGP algorithm numbers which we need to map |
539 | 558 | to our algorithm numbers. This function MUST not change ERRNO. */ |
540 | 559 | int |
238 | 238 | (*r_dh)->data.old_user.handle = read_cb_value; |
239 | 239 | return TRACE_ERR (0); |
240 | 240 | } |
241 | ||
242 | ||
243 | gpgme_error_t | |
244 | gpgme_data_rewind (gpgme_data_t dh) | |
245 | { | |
246 | gpgme_error_t err; | |
247 | TRACE_BEG (DEBUG_DATA, "gpgme_data_rewind", dh); | |
248 | ||
249 | err = ((gpgme_data_seek (dh, 0, SEEK_SET) == -1) | |
250 | ? gpg_error_from_syserror () : 0); | |
251 | ||
252 | return TRACE_ERR (err); | |
253 | } |
154 | 154 | dh->pending_len = 0; |
155 | 155 | |
156 | 156 | return TRACE_SYSRES (offset); |
157 | } | |
158 | ||
159 | ||
160 | /* Convenience function to do a gpgme_data_seek (dh, 0, SEEK_SET). */ | |
161 | gpgme_error_t | |
162 | gpgme_data_rewind (gpgme_data_t dh) | |
163 | { | |
164 | gpgme_error_t err; | |
165 | TRACE_BEG (DEBUG_DATA, "gpgme_data_rewind", dh); | |
166 | ||
167 | err = ((gpgme_data_seek (dh, 0, SEEK_SET) == -1) | |
168 | ? gpg_error_from_syserror () : 0); | |
169 | ||
170 | return TRACE_ERR (err); | |
157 | 171 | } |
158 | 172 | |
159 | 173 |
312 | 312 | } |
313 | 313 | |
314 | 314 | va_start (arg_ptr, format); |
315 | res = vasprintf ((char **) line, format, arg_ptr); | |
315 | res = gpgrt_vasprintf ((char **) line, format, arg_ptr); | |
316 | 316 | va_end (arg_ptr); |
317 | 317 | if (res < 0) |
318 | 318 | *line = NULL; |
332 | 332 | return; |
333 | 333 | |
334 | 334 | va_start (arg_ptr, format); |
335 | res = vasprintf (&toadd, format, arg_ptr); | |
335 | res = gpgrt_vasprintf (&toadd, format, arg_ptr); | |
336 | 336 | va_end (arg_ptr); |
337 | 337 | if (res < 0) |
338 | 338 | { |
339 | free (*line); | |
339 | gpgrt_free (*line); | |
340 | 340 | *line = NULL; |
341 | 341 | } |
342 | res = asprintf (&result, "%s%s", *(char **) line, toadd); | |
343 | free (toadd); | |
344 | free (*line); | |
342 | res = gpgrt_asprintf (&result, "%s%s", *(char **) line, toadd); | |
343 | gpgrt_free (toadd); | |
344 | gpgrt_free (*line); | |
345 | 345 | if (res < 0) |
346 | 346 | *line = NULL; |
347 | 347 | else |
360 | 360 | /* The smallest possible level is 1, so force logging here by |
361 | 361 | using that. */ |
362 | 362 | _gpgme_debug (1, "%s", *line); |
363 | free (*line); | |
363 | gpgrt_free (*line); | |
364 | 364 | *line = NULL; |
365 | 365 | } |
366 | 366 |
22 | 22 | #include <config.h> |
23 | 23 | #endif |
24 | 24 | |
25 | #include <assert.h> | |
26 | ||
25 | 27 | #include "debug.h" |
26 | 28 | #include "gpgme.h" |
27 | 29 | #include "ops.h" |
44 | 46 | |
45 | 47 | static gpgme_error_t |
46 | 48 | decrypt_verify_start (gpgme_ctx_t ctx, int synchronous, |
49 | gpgme_decrypt_flags_t flags, | |
47 | 50 | gpgme_data_t cipher, gpgme_data_t plain) |
48 | 51 | { |
49 | 52 | gpgme_error_t err; |
53 | ||
54 | assert ((flags & GPGME_DECRYPT_VERIFY)); | |
50 | 55 | |
51 | 56 | err = _gpgme_op_reset (ctx, synchronous); |
52 | 57 | if (err) |
76 | 81 | _gpgme_engine_set_status_handler (ctx->engine, |
77 | 82 | decrypt_verify_status_handler, ctx); |
78 | 83 | |
79 | return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain, | |
80 | ctx->export_session_keys, | |
81 | ctx->override_session_key); | |
84 | return _gpgme_engine_op_decrypt (ctx->engine, | |
85 | flags, | |
86 | cipher, plain, | |
87 | ctx->export_session_keys, | |
88 | ctx->override_session_key); | |
82 | 89 | } |
83 | 90 | |
84 | 91 | |
96 | 103 | if (!ctx) |
97 | 104 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); |
98 | 105 | |
99 | err = decrypt_verify_start (ctx, 0, cipher, plain); | |
106 | err = decrypt_verify_start (ctx, 0, GPGME_DECRYPT_VERIFY, cipher, plain); | |
100 | 107 | return TRACE_ERR (err); |
101 | 108 | } |
102 | 109 | |
115 | 122 | if (!ctx) |
116 | 123 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); |
117 | 124 | |
118 | err = decrypt_verify_start (ctx, 1, cipher, plain); | |
125 | err = decrypt_verify_start (ctx, 1, GPGME_DECRYPT_VERIFY, cipher, plain); | |
119 | 126 | if (!err) |
120 | 127 | err = _gpgme_wait_one (ctx); |
121 | 128 | return TRACE_ERR (err); |
122 | 129 | } |
130 | ||
131 | ||
132 | /* Decrypt ciphertext CIPHER within CTX and store the resulting | |
133 | plaintext in PLAIN. */ | |
134 | gpgme_error_t | |
135 | gpgme_op_decrypt_ext_start (gpgme_ctx_t ctx, | |
136 | gpgme_decrypt_flags_t flags, | |
137 | gpgme_data_t cipher, | |
138 | gpgme_data_t plain) | |
139 | { | |
140 | gpgme_error_t err; | |
141 | ||
142 | TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_ext_start", ctx, | |
143 | "cipher=%p, plain=%p", cipher, plain); | |
144 | ||
145 | if (!ctx) | |
146 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); | |
147 | ||
148 | if ((flags & GPGME_DECRYPT_VERIFY)) | |
149 | err = decrypt_verify_start (ctx, 0, flags, cipher, plain); | |
150 | else | |
151 | err = _gpgme_decrypt_start (ctx, 0, flags, cipher, plain); | |
152 | return TRACE_ERR (err); | |
153 | } | |
154 | ||
155 | ||
156 | /* Decrypt ciphertext CIPHER within CTX and store the resulting | |
157 | plaintext in PLAIN. */ | |
158 | gpgme_error_t | |
159 | gpgme_op_decrypt_ext (gpgme_ctx_t ctx, | |
160 | gpgme_decrypt_flags_t flags, | |
161 | gpgme_data_t cipher, | |
162 | gpgme_data_t plain) | |
163 | { | |
164 | gpgme_error_t err; | |
165 | ||
166 | TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_ext", ctx, | |
167 | "cipher=%p, plain=%p", cipher, plain); | |
168 | ||
169 | if (!ctx) | |
170 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); | |
171 | ||
172 | if ((flags & GPGME_DECRYPT_VERIFY)) | |
173 | err = decrypt_verify_start (ctx, 1, flags, cipher, plain); | |
174 | else | |
175 | err = _gpgme_decrypt_start (ctx, 1, flags, cipher, plain); | |
176 | if (!err) | |
177 | err = _gpgme_wait_one (ctx); | |
178 | return TRACE_ERR (err); | |
179 | } |
24 | 24 | #include <stdlib.h> |
25 | 25 | #include <string.h> |
26 | 26 | #include <errno.h> |
27 | #include <assert.h> | |
27 | 28 | |
28 | 29 | #include "debug.h" |
29 | 30 | #include "gpgme.h" |
357 | 358 | } |
358 | 359 | |
359 | 360 | |
360 | static gpgme_error_t | |
361 | decrypt_start (gpgme_ctx_t ctx, int synchronous, | |
362 | gpgme_data_t cipher, gpgme_data_t plain) | |
363 | { | |
364 | gpgme_error_t err; | |
361 | gpgme_error_t | |
362 | _gpgme_decrypt_start (gpgme_ctx_t ctx, int synchronous, | |
363 | gpgme_decrypt_flags_t flags, | |
364 | gpgme_data_t cipher, gpgme_data_t plain) | |
365 | { | |
366 | gpgme_error_t err; | |
367 | ||
368 | assert (!(flags & GPGME_DECRYPT_VERIFY)); | |
365 | 369 | |
366 | 370 | err = _gpgme_op_reset (ctx, synchronous); |
367 | 371 | if (err) |
389 | 393 | |
390 | 394 | _gpgme_engine_set_status_handler (ctx->engine, decrypt_status_handler, ctx); |
391 | 395 | |
392 | return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain, | |
396 | return _gpgme_engine_op_decrypt (ctx->engine, | |
397 | flags, | |
398 | cipher, plain, | |
393 | 399 | ctx->export_session_keys, |
394 | 400 | ctx->override_session_key); |
395 | 401 | } |
407 | 413 | if (!ctx) |
408 | 414 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); |
409 | 415 | |
410 | err = decrypt_start (ctx, 0, cipher, plain); | |
416 | err = _gpgme_decrypt_start (ctx, 0, 0, cipher, plain); | |
411 | 417 | return TRACE_ERR (err); |
412 | 418 | } |
413 | 419 | |
425 | 431 | if (!ctx) |
426 | 432 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); |
427 | 433 | |
428 | err = decrypt_start (ctx, 1, cipher, plain); | |
434 | err = _gpgme_decrypt_start (ctx, 1, 0, cipher, plain); | |
429 | 435 | if (!err) |
430 | 436 | err = _gpgme_wait_one (ctx); |
431 | 437 | return TRACE_ERR (err); |
50 | 50 | WANT_GPG_NAME, |
51 | 51 | WANT_GPGSM_NAME, |
52 | 52 | WANT_G13_NAME, |
53 | WANT_GPG_WKS_CLIENT_NAME, | |
53 | 54 | WANT_GPG_ONE_MODE |
54 | 55 | }; |
55 | 56 | |
72 | 73 | char *gpg_name; |
73 | 74 | char *gpgsm_name; |
74 | 75 | char *g13_name; |
76 | char *gpg_wks_client_name; | |
75 | 77 | int gpg_one_mode; /* System is in gpg1 mode. */ |
76 | 78 | } dirinfo; |
77 | 79 | |
332 | 334 | case WANT_G13_NAME: result = dirinfo.g13_name; break; |
333 | 335 | case WANT_UISRV_SOCKET: result = dirinfo.uisrv_socket; break; |
334 | 336 | case WANT_GPG_ONE_MODE: result = dirinfo.gpg_one_mode? "1":NULL; break; |
337 | case WANT_GPG_WKS_CLIENT_NAME: | |
338 | if (!dirinfo.gpg_wks_client_name && dirinfo.libexecdir) | |
339 | dirinfo.gpg_wks_client_name = _gpgme_strconcat (dirinfo.libexecdir, | |
340 | "/", | |
341 | "gpg-wks-client", | |
342 | NULL); | |
343 | result = dirinfo.gpg_wks_client_name; | |
344 | break; | |
335 | 345 | } |
336 | 346 | UNLOCK (dirinfo_lock); |
337 | 347 | return result; |
437 | 447 | return get_gpgconf_item (WANT_GPGSM_NAME); |
438 | 448 | else if (!strcmp (what, "g13-name")) |
439 | 449 | return get_gpgconf_item (WANT_G13_NAME); |
450 | else if (!strcmp (what, "gpg-wks-client-name")) | |
451 | return get_gpgconf_item (WANT_GPG_WKS_CLIENT_NAME); | |
440 | 452 | else if (!strcmp (what, "agent-ssh-socket")) |
441 | 453 | return get_gpgconf_item (WANT_AGENT_SSH_SOCKET); |
442 | 454 | else if (!strcmp (what, "dirmngr-socket")) |
264 | 264 | goto leave; |
265 | 265 | if (dft_display) |
266 | 266 | { |
267 | if (asprintf (&optstr, "OPTION display=%s", dft_display) < 0) | |
267 | if (gpgrt_asprintf (&optstr, "OPTION display=%s", dft_display) < 0) | |
268 | 268 | { |
269 | 269 | err = gpg_error_from_syserror (); |
270 | 270 | free (dft_display); |
274 | 274 | |
275 | 275 | err = assuan_transact (llass->assuan_ctx, optstr, NULL, NULL, NULL, |
276 | 276 | NULL, NULL, NULL); |
277 | free (optstr); | |
277 | gpgrt_free (optstr); | |
278 | 278 | if (err) |
279 | 279 | goto leave; |
280 | 280 | } |
303 | 303 | ways, e.g., when /dev/pts is not accessible under chroot. */ |
304 | 304 | if (!rc) |
305 | 305 | { |
306 | if (asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0) | |
306 | if (gpgrt_asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0) | |
307 | 307 | { |
308 | 308 | err = gpg_error_from_syserror (); |
309 | 309 | goto leave; |
310 | 310 | } |
311 | 311 | err = assuan_transact (llass->assuan_ctx, optstr, NULL, NULL, NULL, |
312 | 312 | NULL, NULL, NULL); |
313 | free (optstr); | |
313 | gpgrt_free (optstr); | |
314 | 314 | if (err) |
315 | 315 | goto leave; |
316 | 316 | |
319 | 319 | goto leave; |
320 | 320 | if (dft_ttytype) |
321 | 321 | { |
322 | if (asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype) < 0) | |
322 | if (gpgrt_asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype)< 0) | |
323 | 323 | { |
324 | 324 | err = gpg_error_from_syserror (); |
325 | 325 | free (dft_ttytype); |
329 | 329 | |
330 | 330 | err = assuan_transact (llass->assuan_ctx, optstr, NULL, NULL, |
331 | 331 | NULL, NULL, NULL, NULL); |
332 | free (optstr); | |
332 | gpgrt_free (optstr); | |
333 | 333 | if (err) |
334 | 334 | goto leave; |
335 | 335 | } |
407 | 407 | if (!value) |
408 | 408 | return 0; |
409 | 409 | |
410 | if (asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) | |
410 | if (gpgrt_asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) | |
411 | 411 | err = gpg_error_from_syserror (); |
412 | 412 | else |
413 | 413 | { |
414 | 414 | err = assuan_transact (llass->assuan_ctx, optstr, NULL, NULL, |
415 | 415 | NULL, NULL, NULL, NULL); |
416 | free (optstr); | |
416 | gpgrt_free (optstr); | |
417 | 417 | } |
418 | 418 | return err; |
419 | 419 | } |
775 | 775 | llass_set_locale, |
776 | 776 | NULL, /* set_protocol */ |
777 | 777 | NULL, /* decrypt */ |
778 | NULL, /* decrypt_verify */ | |
779 | 778 | NULL, /* delete */ |
780 | 779 | NULL, /* edit */ |
781 | 780 | NULL, /* encrypt */ |
786 | 785 | NULL, /* import */ |
787 | 786 | NULL, /* keylist */ |
788 | 787 | NULL, /* keylist_ext */ |
788 | NULL, /* keylist_data */ | |
789 | 789 | NULL, /* keysign */ |
790 | 790 | NULL, /* tofu_policy */ |
791 | 791 | NULL, /* sign */ |
60 | 60 | void *fnc_value); |
61 | 61 | gpgme_error_t (*set_locale) (void *engine, int category, const char *value); |
62 | 62 | gpgme_error_t (*set_protocol) (void *engine, gpgme_protocol_t protocol); |
63 | gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph, | |
63 | gpgme_error_t (*decrypt) (void *engine, | |
64 | gpgme_decrypt_flags_t flags, | |
65 | gpgme_data_t ciph, | |
64 | 66 | gpgme_data_t plain, int export_session_key, |
65 | 67 | const char *override_session_key); |
66 | gpgme_error_t (*decrypt_verify) (void *engine, gpgme_data_t ciph, | |
67 | gpgme_data_t plain, int export_session_key, | |
68 | const char *override_session_key); | |
69 | 68 | gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret); |
70 | 69 | gpgme_error_t (*edit) (void *engine, int type, gpgme_key_t key, |
71 | 70 | gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */); |
99 | 98 | int secret_only, int reserved, |
100 | 99 | gpgme_keylist_mode_t mode, |
101 | 100 | int engine_flags); |
101 | gpgme_error_t (*keylist_data) (void *engine, gpgme_data_t data); | |
102 | 102 | gpgme_error_t (*keysign) (void *engine, |
103 | 103 | gpgme_key_t key, const char *userid, |
104 | 104 | unsigned long expires, unsigned int flags, |
269 | 269 | goto leave; |
270 | 270 | if (dft_display) |
271 | 271 | { |
272 | if (asprintf (&optstr, "OPTION display=%s", dft_display) < 0) | |
272 | if (gpgrt_asprintf (&optstr, "OPTION display=%s", dft_display) < 0) | |
273 | 273 | { |
274 | 274 | free (dft_display); |
275 | 275 | err = gpg_error_from_syserror (); |
279 | 279 | |
280 | 280 | err = assuan_transact (g13->assuan_ctx, optstr, NULL, NULL, NULL, |
281 | 281 | NULL, NULL, NULL); |
282 | free (optstr); | |
282 | gpgrt_free (optstr); | |
283 | 283 | if (err) |
284 | 284 | goto leave; |
285 | 285 | } |
303 | 303 | ways, e.g., when /dev/pts is not accessible under chroot. */ |
304 | 304 | if (!rc) |
305 | 305 | { |
306 | if (asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0) | |
306 | if (gpgrt_asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0) | |
307 | 307 | { |
308 | 308 | err = gpg_error_from_syserror (); |
309 | 309 | goto leave; |
310 | 310 | } |
311 | 311 | err = assuan_transact (g13->assuan_ctx, optstr, NULL, NULL, NULL, |
312 | 312 | NULL, NULL, NULL); |
313 | free (optstr); | |
313 | gpgrt_free (optstr); | |
314 | 314 | if (err) |
315 | 315 | goto leave; |
316 | 316 | |
319 | 319 | goto leave; |
320 | 320 | if (dft_ttytype) |
321 | 321 | { |
322 | if (asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype) < 0) | |
322 | if (gpgrt_asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype)< 0) | |
323 | 323 | { |
324 | 324 | free (dft_ttytype); |
325 | 325 | err = gpg_error_from_syserror (); |
329 | 329 | |
330 | 330 | err = assuan_transact (g13->assuan_ctx, optstr, NULL, NULL, |
331 | 331 | NULL, NULL, NULL, NULL); |
332 | free (optstr); | |
332 | gpgrt_free (optstr); | |
333 | 333 | if (err) |
334 | 334 | goto leave; |
335 | 335 | } |
399 | 399 | if (!value) |
400 | 400 | return 0; |
401 | 401 | |
402 | if (asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) | |
402 | if (gpgrt_asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) | |
403 | 403 | err = gpg_error_from_syserror (); |
404 | 404 | else |
405 | 405 | { |
406 | 406 | err = assuan_transact (g13->assuan_ctx, optstr, NULL, NULL, |
407 | 407 | NULL, NULL, NULL, NULL); |
408 | free (optstr); | |
408 | gpgrt_free (optstr); | |
409 | 409 | } |
410 | 410 | |
411 | 411 | return err; |
790 | 790 | g13_set_locale, |
791 | 791 | NULL, /* set_protocol */ |
792 | 792 | NULL, /* decrypt */ |
793 | NULL, /* decrypt_verify */ | |
794 | 793 | NULL, /* delete */ |
795 | 794 | NULL, /* edit */ |
796 | 795 | NULL, /* encrypt */ |
801 | 800 | NULL, /* import */ |
802 | 801 | NULL, /* keylist */ |
803 | 802 | NULL, /* keylist_ext */ |
803 | NULL, /* keylist_data */ | |
804 | 804 | NULL, /* keysign */ |
805 | 805 | NULL, /* tofu_policy */ |
806 | 806 | NULL, /* sign */ |
73 | 73 | }; |
74 | 74 | |
75 | 75 | |
76 | /* NB.: R_LINE is allocated an gpgrt function and thus gpgrt_free | |
77 | * shall be used to release it. This takes care of custom memory | |
78 | * allocators and avoids problems on Windows with different runtimes | |
79 | * used for libgpg-error/gpgrt and gpgme. */ | |
76 | 80 | typedef gpgme_error_t (*colon_preprocessor_t) (char *line, char **rline); |
77 | 81 | |
78 | 82 | struct engine_gpg |
1345 | 1349 | } |
1346 | 1350 | while (linep && *linep); |
1347 | 1351 | |
1348 | free (line); | |
1352 | gpgrt_free (line); | |
1349 | 1353 | } |
1350 | 1354 | else |
1351 | 1355 | gpg->colon.fnc (gpg->colon.fnc_value, buffer); |
1554 | 1558 | |
1555 | 1559 | |
1556 | 1560 | static gpgme_error_t |
1557 | gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, | |
1561 | gpg_decrypt (void *engine, | |
1562 | gpgme_decrypt_flags_t flags, | |
1563 | gpgme_data_t ciph, gpgme_data_t plain, | |
1558 | 1564 | int export_session_key, const char *override_session_key) |
1559 | 1565 | { |
1560 | 1566 | engine_gpg_t gpg = engine; |
1561 | 1567 | gpgme_error_t err; |
1562 | 1568 | |
1563 | 1569 | err = add_arg (gpg, "--decrypt"); |
1570 | ||
1571 | if (!err && (flags & GPGME_DECRYPT_UNWRAP)) | |
1572 | { | |
1573 | if (!have_gpg_version (gpg, "2.1.12")) | |
1574 | err = gpg_error (GPG_ERR_NOT_SUPPORTED); | |
1575 | else | |
1576 | err = add_arg (gpg, "--unwrap"); | |
1577 | } | |
1564 | 1578 | |
1565 | 1579 | if (!err && export_session_key) |
1566 | 1580 | err = add_arg (gpg, "--show-session-key"); |
1852 | 1866 | if (!err && use_armor) |
1853 | 1867 | err = add_arg (gpg, "--armor"); |
1854 | 1868 | |
1869 | if (!err && (flags & GPGME_ENCRYPT_WRAP)) | |
1870 | { | |
1871 | /* gpg is current not abale to detect already compressed | |
1872 | * packets. Thus when using | |
1873 | * gpg --unwrap -d | gpg --no-literal -e | |
1874 | * the encryption would add an additional compression layer. | |
1875 | * We better suppress that. */ | |
1876 | flags |= GPGME_ENCRYPT_NO_COMPRESS; | |
1877 | err = add_arg (gpg, "--no-literal"); | |
1878 | } | |
1879 | ||
1855 | 1880 | if (!err && (flags & GPGME_ENCRYPT_NO_COMPRESS)) |
1856 | 1881 | err = add_arg (gpg, "--compress-algo=none"); |
1882 | ||
1883 | if (!err && (flags & GPGME_ENCRYPT_THROW_KEYIDS)) | |
1884 | err = add_arg (gpg, "--throw-keyids"); | |
1857 | 1885 | |
1858 | 1886 | if (gpgme_data_get_encoding (plain) == GPGME_DATA_ENCODING_MIME |
1859 | 1887 | && have_gpg_version (gpg, "2.1.14")) |
1923 | 1951 | |
1924 | 1952 | if (!err && (flags & GPGME_ENCRYPT_NO_COMPRESS)) |
1925 | 1953 | err = add_arg (gpg, "--compress-algo=none"); |
1954 | ||
1955 | if (!err && (flags & GPGME_ENCRYPT_THROW_KEYIDS)) | |
1956 | err = add_arg (gpg, "--throw-keyids"); | |
1926 | 1957 | |
1927 | 1958 | if (gpgme_data_get_encoding (plain) == GPGME_DATA_ENCODING_MIME |
1928 | 1959 | && have_gpg_version (gpg, "2.1.14")) |
2071 | 2102 | /* This condition is only required to allow the use of gpg < 2.1.16 */ |
2072 | 2103 | if (algo |
2073 | 2104 | || (flags & (GPGME_CREATE_SIGN | GPGME_CREATE_ENCR |
2074 | | GPGME_CREATE_CERT | GPGME_CREATE_AUTH)) | |
2105 | | GPGME_CREATE_CERT | GPGME_CREATE_AUTH | |
2106 | | GPGME_CREATE_NOEXPIRE)) | |
2075 | 2107 | || expires) |
2076 | 2108 | { |
2077 | 2109 | err = add_arg (gpg, algo? algo : "default"); |
2085 | 2117 | (flags & GPGME_CREATE_AUTH)? " auth":""); |
2086 | 2118 | err = add_arg (gpg, *tmpbuf? tmpbuf : "default"); |
2087 | 2119 | } |
2088 | if (!err && expires) | |
2120 | if (!err) | |
2089 | 2121 | { |
2090 | char tmpbuf[8+20]; | |
2091 | snprintf (tmpbuf, sizeof tmpbuf, "seconds=%lu", expires); | |
2092 | err = add_arg (gpg, tmpbuf); | |
2122 | if ((flags & GPGME_CREATE_NOEXPIRE)) | |
2123 | err = add_arg (gpg, "never"); | |
2124 | else if (expires == 0) | |
2125 | err = add_arg (gpg, "-"); | |
2126 | else | |
2127 | { | |
2128 | char tmpbuf[8+20]; | |
2129 | snprintf (tmpbuf, sizeof tmpbuf, "seconds=%lu", expires); | |
2130 | err = add_arg (gpg, tmpbuf); | |
2131 | } | |
2093 | 2132 | } |
2094 | 2133 | } |
2095 | 2134 | else |
2135 | 2174 | err = add_arg (gpg, "--passphrase"); |
2136 | 2175 | if (!err) |
2137 | 2176 | err = add_arg (gpg, ""); |
2177 | if (!err) | |
2178 | err = add_arg (gpg, "--batch"); | |
2138 | 2179 | } |
2139 | 2180 | if (!err && (flags & GPGME_CREATE_FORCE)) |
2140 | 2181 | err = add_arg (gpg, "--yes"); |
2173 | 2214 | err = add_arg (gpg, "--passphrase"); |
2174 | 2215 | if (!err) |
2175 | 2216 | err = add_arg (gpg, ""); |
2217 | if (!err) | |
2218 | err = add_arg (gpg, "--batch"); | |
2176 | 2219 | } |
2177 | 2220 | if (!err) |
2178 | 2221 | err = add_arg (gpg, "--"); |
2199 | 2242 | if (!key || !key->fpr || !userid) |
2200 | 2243 | return gpg_error (GPG_ERR_INV_ARG); |
2201 | 2244 | |
2202 | if ((extraflags & GENKEY_EXTRAFLAG_REVOKE)) | |
2245 | if ((extraflags & GENKEY_EXTRAFLAG_SETPRIMARY)) | |
2246 | { | |
2247 | if (!have_gpg_version (gpg, "2.1.20")) | |
2248 | err = gpg_error (GPG_ERR_NOT_SUPPORTED); | |
2249 | else | |
2250 | err = add_arg (gpg, "--quick-set-primary-uid"); | |
2251 | } | |
2252 | else if ((extraflags & GENKEY_EXTRAFLAG_REVOKE)) | |
2203 | 2253 | err = add_arg (gpg, "--quick-revuid"); |
2204 | 2254 | else |
2205 | 2255 | err = add_arg (gpg, "--quick-adduid"); |
2239 | 2289 | * USERID && !KEY - Create a new keyblock. |
2240 | 2290 | * !USERID && KEY - Add a new subkey to KEY (gpg >= 2.1.14) |
2241 | 2291 | * USERID && KEY && !ALGO - Add a new user id to KEY (gpg >= 2.1.14). |
2242 | * | |
2292 | * or set a flag on a user id. | |
2243 | 2293 | */ |
2244 | 2294 | if (help_data) |
2245 | 2295 | { |
2508 | 2558 | n = strlen (field[1]); |
2509 | 2559 | if (n > 16) |
2510 | 2560 | { |
2511 | if (asprintf (r_line, | |
2561 | if (gpgrt_asprintf (r_line, | |
2512 | 2562 | "pub:o%s:%s:%s:%s:%s:%s::::::::\n" |
2513 | 2563 | "fpr:::::::::%s:", |
2514 | 2564 | field[6], field[3], field[2], field[1] + n - 16, |
2517 | 2567 | } |
2518 | 2568 | else |
2519 | 2569 | { |
2520 | if (asprintf (r_line, | |
2570 | if (gpgrt_asprintf (r_line, | |
2521 | 2571 | "pub:o%s:%s:%s:%s:%s:%s::::::::", |
2522 | 2572 | field[6], field[3], field[2], field[1], |
2523 | 2573 | field[4], field[5]) < 0) |
2575 | 2625 | } |
2576 | 2626 | *dst = '\0'; |
2577 | 2627 | |
2578 | if (asprintf (r_line, "uid:o%s::::%s:%s:::%s:", | |
2628 | if (gpgrt_asprintf (r_line, "uid:o%s::::%s:%s:::%s:", | |
2579 | 2629 | field[4], field[2], field[3], uid) < 0) |
2580 | 2630 | return gpg_error_from_syserror (); |
2581 | 2631 | } |
2714 | 2764 | |
2715 | 2765 | |
2716 | 2766 | static gpgme_error_t |
2767 | gpg_keylist_data (void *engine, gpgme_data_t data) | |
2768 | { | |
2769 | engine_gpg_t gpg = engine; | |
2770 | gpgme_error_t err; | |
2771 | ||
2772 | if (!have_gpg_version (gpg, "2.1.14")) | |
2773 | return gpg_error (GPG_ERR_NOT_SUPPORTED); | |
2774 | ||
2775 | err = add_arg (gpg, "--with-colons"); | |
2776 | if (!err) | |
2777 | err = add_arg (gpg, "--with-fingerprint"); | |
2778 | if (!err) | |
2779 | err = add_arg (gpg, "--import-options"); | |
2780 | if (!err) | |
2781 | err = add_arg (gpg, "import-show"); | |
2782 | if (!err) | |
2783 | err = add_arg (gpg, "--dry-run"); | |
2784 | if (!err) | |
2785 | err = add_arg (gpg, "--import"); | |
2786 | if (!err) | |
2787 | err = add_arg (gpg, "--"); | |
2788 | if (!err) | |
2789 | err = add_data (gpg, data, -1, 0); | |
2790 | ||
2791 | if (!err) | |
2792 | err = start (gpg); | |
2793 | ||
2794 | return err; | |
2795 | } | |
2796 | ||
2797 | ||
2798 | static gpgme_error_t | |
2717 | 2799 | gpg_keysign (void *engine, gpgme_key_t key, const char *userid, |
2718 | 2800 | unsigned long expire, unsigned int flags, |
2719 | 2801 | gpgme_ctx_t ctx) |
2985 | 3067 | gpg_set_locale, |
2986 | 3068 | NULL, /* set_protocol */ |
2987 | 3069 | gpg_decrypt, |
2988 | gpg_decrypt, /* decrypt_verify */ | |
2989 | 3070 | gpg_delete, |
2990 | 3071 | gpg_edit, |
2991 | 3072 | gpg_encrypt, |
2996 | 3077 | gpg_import, |
2997 | 3078 | gpg_keylist, |
2998 | 3079 | gpg_keylist_ext, |
3080 | gpg_keylist_data, | |
2999 | 3081 | gpg_keysign, |
3000 | 3082 | gpg_tofu_policy, /* tofu_policy */ |
3001 | 3083 | gpg_sign, |
707 | 707 | #define BUFLEN 1024 |
708 | 708 | char buf[BUFLEN]; |
709 | 709 | int buflen = 0; |
710 | char *argv[6]; | |
710 | char *argv[7]; | |
711 | 711 | int argc = 0; |
712 | int rp[2]; | |
713 | struct spawn_fd_item_s cfd[] = { {-1, 0 /* STDIN_FILENO */}, {-1, -1} }; | |
712 | int rp[2] = { -1, -1 }; | |
713 | int errp[2] = { -1, -1 }; | |
714 | struct spawn_fd_item_s cfd[] = { {-1, 0 /* STDIN_FILENO */}, | |
715 | {-1, 2 /* STDERR_FILENO */, -1}, | |
716 | {-1, -1} }; | |
714 | 717 | int status; |
715 | 718 | int nwrite; |
716 | 719 | |
723 | 726 | argv[argc++] = gpgconf->home_dir; |
724 | 727 | } |
725 | 728 | |
729 | argv[argc++] = (char*)"--runtime"; | |
726 | 730 | argv[argc++] = (char*)arg1; |
727 | 731 | argv[argc++] = arg2; |
728 | 732 | argv[argc] = NULL; |
729 | 733 | assert (argc < DIM (argv)); |
730 | 734 | |
731 | 735 | if (_gpgme_io_pipe (rp, 0) < 0) |
732 | return gpg_error_from_syserror (); | |
736 | { | |
737 | err = gpg_error_from_syserror (); | |
738 | goto leave; | |
739 | } | |
740 | ||
741 | if (_gpgme_io_pipe (errp, 1) < 0) | |
742 | { | |
743 | err = gpg_error_from_syserror (); | |
744 | goto leave; | |
745 | } | |
733 | 746 | |
734 | 747 | cfd[0].fd = rp[0]; |
748 | cfd[1].fd = errp[1]; | |
735 | 749 | |
736 | 750 | status = _gpgme_io_spawn (gpgconf->file_name, argv, |
737 | 751 | IOSPAWN_FLAG_DETACHED, cfd, NULL, NULL, NULL); |
738 | 752 | if (status < 0) |
739 | 753 | { |
740 | _gpgme_io_close (rp[0]); | |
741 | _gpgme_io_close (rp[1]); | |
742 | return gpg_error_from_syserror (); | |
743 | } | |
754 | err = gpg_error_from_syserror (); | |
755 | goto leave; | |
756 | } | |
757 | ||
758 | rp[0] = -1; | |
759 | errp[1] = -1; | |
744 | 760 | |
745 | 761 | for (;;) |
746 | 762 | { |
755 | 771 | if (buflen < 0) |
756 | 772 | { |
757 | 773 | err = gpg_error_from_syserror (); |
758 | _gpgme_io_close (rp[1]); | |
759 | return err; | |
774 | goto leave; | |
760 | 775 | } |
761 | 776 | else if (buflen == 0) |
762 | 777 | { |
763 | 778 | /* All is written. */ |
764 | 779 | _gpgme_io_close (rp[1]); |
765 | return 0; | |
780 | rp[1] = -1; | |
781 | ||
782 | for (;;) | |
783 | { | |
784 | do | |
785 | { | |
786 | buflen = _gpgme_io_read (errp[0], buf, BUFLEN); | |
787 | } | |
788 | while (buflen < 0 && errno == EAGAIN); | |
789 | ||
790 | if (buflen == 0) | |
791 | { | |
792 | err = 0; | |
793 | goto leave; | |
794 | } | |
795 | /* XXX: Do something useful with BUF. */ | |
796 | } | |
766 | 797 | } |
767 | 798 | } |
768 | 799 | |
780 | 811 | } |
781 | 812 | else if (nwrite < 0) |
782 | 813 | { |
783 | _gpgme_io_close (rp[1]); | |
784 | return gpg_error_from_syserror (); | |
814 | err = gpg_error_from_syserror (); | |
815 | goto leave; | |
785 | 816 | } |
786 | 817 | } |
787 | 818 | |
788 | return 0; | |
819 | assert (! "reached"); | |
820 | ||
821 | leave: | |
822 | if (rp[0] != -1) | |
823 | _gpgme_io_close (rp[0]); | |
824 | if (rp[1] != -1) | |
825 | _gpgme_io_close (rp[1]); | |
826 | if (errp[0] != -1) | |
827 | _gpgme_io_close (errp[0]); | |
828 | if (errp[1] != -1) | |
829 | _gpgme_io_close (errp[1]); | |
830 | ||
831 | return err; | |
789 | 832 | } |
790 | 833 | |
791 | 834 | |
1189 | 1232 | NULL, /* set_locale */ |
1190 | 1233 | NULL, /* set_protocol */ |
1191 | 1234 | NULL, /* decrypt */ |
1192 | NULL, /* decrypt_verify */ | |
1193 | 1235 | NULL, /* delete */ |
1194 | 1236 | NULL, /* edit */ |
1195 | 1237 | NULL, /* encrypt */ |
1200 | 1242 | NULL, /* import */ |
1201 | 1243 | NULL, /* keylist */ |
1202 | 1244 | NULL, /* keylist_ext */ |
1245 | NULL, /* keylist_data */ | |
1203 | 1246 | NULL, /* keysign */ |
1204 | 1247 | NULL, /* tofu_policy */ |
1205 | 1248 | NULL, /* sign */ |
395 | 395 | goto leave; |
396 | 396 | if (dft_display) |
397 | 397 | { |
398 | if (asprintf (&optstr, "OPTION display=%s", dft_display) < 0) | |
398 | if (gpgrt_asprintf (&optstr, "OPTION display=%s", dft_display) < 0) | |
399 | 399 | { |
400 | 400 | free (dft_display); |
401 | 401 | err = gpg_error_from_syserror (); |
405 | 405 | |
406 | 406 | err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL, |
407 | 407 | NULL, NULL, NULL); |
408 | free (optstr); | |
408 | gpgrt_free (optstr); | |
409 | 409 | if (err) |
410 | 410 | goto leave; |
411 | 411 | } |
429 | 429 | ways, e.g., when /dev/pts is not accessible under chroot. */ |
430 | 430 | if (!rc) |
431 | 431 | { |
432 | if (asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0) | |
432 | if (gpgrt_asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0) | |
433 | 433 | { |
434 | 434 | err = gpg_error_from_syserror (); |
435 | 435 | goto leave; |
436 | 436 | } |
437 | 437 | err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL, |
438 | 438 | NULL, NULL, NULL); |
439 | free (optstr); | |
439 | gpgrt_free (optstr); | |
440 | 440 | if (err) |
441 | 441 | goto leave; |
442 | 442 | |
445 | 445 | goto leave; |
446 | 446 | if (dft_ttytype) |
447 | 447 | { |
448 | if (asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype) < 0) | |
448 | if (gpgrt_asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype)< 0) | |
449 | 449 | { |
450 | 450 | free (dft_ttytype); |
451 | 451 | err = gpg_error_from_syserror (); |
455 | 455 | |
456 | 456 | err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, |
457 | 457 | NULL, NULL, NULL, NULL); |
458 | free (optstr); | |
458 | gpgrt_free (optstr); | |
459 | 459 | if (err) |
460 | 460 | goto leave; |
461 | 461 | } |
560 | 560 | if (!value) |
561 | 561 | return 0; |
562 | 562 | |
563 | if (asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) | |
563 | if (gpgrt_asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) | |
564 | 564 | err = gpg_error_from_syserror (); |
565 | 565 | else |
566 | 566 | { |
567 | 567 | err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, |
568 | 568 | NULL, NULL, NULL, NULL); |
569 | free (optstr); | |
569 | gpgrt_free (optstr); | |
570 | 570 | } |
571 | 571 | |
572 | 572 | return err; |
592 | 592 | { |
593 | 593 | err = assuan_read_line (ctx, &line, &linelen); |
594 | 594 | if (err) |
595 | return err; | |
595 | break; | |
596 | 596 | |
597 | 597 | if (*line == '#' || !linelen) |
598 | 598 | continue; |
600 | 600 | if (linelen >= 2 |
601 | 601 | && line[0] == 'O' && line[1] == 'K' |
602 | 602 | && (line[2] == '\0' || line[2] == ' ')) |
603 | return cb_err; | |
603 | break; | |
604 | 604 | else if (linelen >= 4 |
605 | 605 | && line[0] == 'E' && line[1] == 'R' && line[2] == 'R' |
606 | 606 | && line[3] == ' ') |
609 | 609 | more related to gpgme and thus probably more important |
610 | 610 | than the error returned by the engine. */ |
611 | 611 | err = cb_err? cb_err : atoi (&line[4]); |
612 | cb_err = 0; | |
612 | 613 | } |
613 | 614 | else if (linelen >= 2 |
614 | 615 | && line[0] == 'S' && line[1] == ' ') |
645 | 646 | to stop. As with ERR we prefer a status callback |
646 | 647 | generated error code, though. */ |
647 | 648 | err = cb_err ? cb_err : gpg_error (GPG_ERR_GENERAL); |
649 | cb_err = 0; | |
648 | 650 | } |
649 | 651 | } |
650 | 652 | while (!err); |
653 | ||
654 | /* We only want the first error from the status handler, thus we | |
655 | * take the one saved in CB_ERR. */ | |
656 | if (!err && cb_err) | |
657 | err = cb_err; | |
651 | 658 | |
652 | 659 | return err; |
653 | 660 | } |
1119 | 1126 | |
1120 | 1127 | |
1121 | 1128 | static gpgme_error_t |
1122 | gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, | |
1129 | gpgsm_decrypt (void *engine, | |
1130 | gpgme_decrypt_flags_t flags, | |
1131 | gpgme_data_t ciph, gpgme_data_t plain, | |
1123 | 1132 | int export_session_key, const char *override_session_key) |
1124 | 1133 | { |
1125 | 1134 | engine_gpgsm_t gpgsm = engine; |
1126 | 1135 | gpgme_error_t err; |
1136 | ||
1137 | (void)flags; | |
1127 | 1138 | |
1128 | 1139 | /* gpgsm is not capable of exporting session keys right now, so we |
1129 | 1140 | * will ignore this if requested. */ |
1641 | 1652 | gpgsm_assuan_simple_command (gpgsm, "GETINFO agent-check", NULL, NULL); |
1642 | 1653 | |
1643 | 1654 | /* Always send list-mode option because RESET does not reset it. */ |
1644 | if (asprintf (&line, "OPTION list-mode=%d", (list_mode & 3)) < 0) | |
1655 | if (gpgrt_asprintf (&line, "OPTION list-mode=%d", (list_mode & 3)) < 0) | |
1645 | 1656 | return gpg_error_from_syserror (); |
1646 | 1657 | err = gpgsm_assuan_simple_command (gpgsm, line, NULL, NULL); |
1647 | free (line); | |
1658 | gpgrt_free (line); | |
1648 | 1659 | if (err) |
1649 | 1660 | return err; |
1650 | 1661 | |
1725 | 1736 | list_mode |= 2; |
1726 | 1737 | |
1727 | 1738 | /* Always send list-mode option because RESET does not reset it. */ |
1728 | if (asprintf (&line, "OPTION list-mode=%d", (list_mode & 3)) < 0) | |
1739 | if (gpgrt_asprintf (&line, "OPTION list-mode=%d", (list_mode & 3)) < 0) | |
1729 | 1740 | return gpg_error_from_syserror (); |
1730 | 1741 | err = gpgsm_assuan_simple_command (gpgsm, line, NULL, NULL); |
1731 | free (line); | |
1742 | gpgrt_free (line); | |
1732 | 1743 | if (err) |
1733 | 1744 | return err; |
1734 | 1745 | |
1859 | 1870 | can reset any previously set value in case the default is |
1860 | 1871 | requested. */ |
1861 | 1872 | |
1862 | if (asprintf (&assuan_cmd, "OPTION include-certs %i", include_certs) < 0) | |
1873 | if (gpgrt_asprintf (&assuan_cmd, | |
1874 | "OPTION include-certs %i", include_certs) < 0) | |
1863 | 1875 | return gpg_error_from_syserror (); |
1864 | 1876 | err = gpgsm_assuan_simple_command (gpgsm, assuan_cmd, NULL, NULL); |
1865 | free (assuan_cmd); | |
1877 | gpgrt_free (assuan_cmd); | |
1866 | 1878 | if (err) |
1867 | 1879 | return err; |
1868 | 1880 | } |
2047 | 2059 | if (!key || !key->subkeys || !key->subkeys->fpr) |
2048 | 2060 | return gpg_error (GPG_ERR_INV_CERT_OBJ); |
2049 | 2061 | |
2050 | if (asprintf (&line, "PASSWD -- %s", key->subkeys->fpr) < 0) | |
2062 | if (gpgrt_asprintf (&line, "PASSWD -- %s", key->subkeys->fpr) < 0) | |
2051 | 2063 | return gpg_error_from_syserror (); |
2052 | 2064 | |
2053 | 2065 | gpgsm_clear_fd (gpgsm, OUTPUT_FD); |
2056 | 2068 | gpgsm->inline_data = NULL; |
2057 | 2069 | |
2058 | 2070 | err = start (gpgsm, line); |
2059 | free (line); | |
2071 | gpgrt_free (line); | |
2060 | 2072 | |
2061 | 2073 | return err; |
2062 | 2074 | } |
2086 | 2098 | gpgsm_set_locale, |
2087 | 2099 | NULL, /* set_protocol */ |
2088 | 2100 | gpgsm_decrypt, |
2089 | gpgsm_decrypt, | |
2090 | 2101 | gpgsm_delete, /* decrypt_verify */ |
2091 | 2102 | NULL, /* edit */ |
2092 | 2103 | gpgsm_encrypt, |
2097 | 2108 | gpgsm_import, |
2098 | 2109 | gpgsm_keylist, |
2099 | 2110 | gpgsm_keylist_ext, |
2111 | NULL, /* keylist_data */ | |
2100 | 2112 | NULL, /* keysign */ |
2101 | 2113 | NULL, /* tofu_policy */ |
2102 | 2114 | gpgsm_sign, |
448 | 448 | NULL, /* set_locale */ |
449 | 449 | NULL, /* set_protocol */ |
450 | 450 | NULL, /* decrypt */ |
451 | NULL, /* decrypt_verify */ | |
452 | 451 | NULL, /* delete */ |
453 | 452 | NULL, /* edit */ |
454 | 453 | NULL, /* encrypt */ |
459 | 458 | NULL, /* import */ |
460 | 459 | NULL, /* keylist */ |
461 | 460 | NULL, /* keylist_ext */ |
461 | NULL, /* keylist_data */ | |
462 | 462 | NULL, /* keysign */ |
463 | 463 | NULL, /* tofu_policy */ |
464 | 464 | NULL, /* sign */ |
315 | 315 | goto leave; |
316 | 316 | if (dft_display) |
317 | 317 | { |
318 | if (asprintf (&optstr, "OPTION display=%s", dft_display) < 0) | |
318 | if (gpgrt_asprintf (&optstr, "OPTION display=%s", dft_display) < 0) | |
319 | 319 | { |
320 | 320 | err = gpg_error_from_syserror (); |
321 | 321 | free (dft_display); |
325 | 325 | |
326 | 326 | err = assuan_transact (uiserver->assuan_ctx, optstr, NULL, NULL, NULL, |
327 | 327 | NULL, NULL, NULL); |
328 | free (optstr); | |
328 | gpgrt_free (optstr); | |
329 | 329 | if (err) |
330 | 330 | goto leave; |
331 | 331 | } |
349 | 349 | ways, e.g., when /dev/pts is not accessible under chroot. */ |
350 | 350 | if (!rc) |
351 | 351 | { |
352 | if (asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0) | |
352 | if (gpgrt_asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0) | |
353 | 353 | { |
354 | 354 | err = gpg_error_from_syserror (); |
355 | 355 | goto leave; |
356 | 356 | } |
357 | 357 | err = assuan_transact (uiserver->assuan_ctx, optstr, NULL, NULL, NULL, |
358 | 358 | NULL, NULL, NULL); |
359 | free (optstr); | |
359 | gpgrt_free (optstr); | |
360 | 360 | if (err) |
361 | 361 | goto leave; |
362 | 362 | |
365 | 365 | goto leave; |
366 | 366 | if (dft_ttytype) |
367 | 367 | { |
368 | if (asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype) < 0) | |
368 | if (gpgrt_asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype)< 0) | |
369 | 369 | { |
370 | 370 | err = gpg_error_from_syserror (); |
371 | 371 | free (dft_ttytype); |
375 | 375 | |
376 | 376 | err = assuan_transact (uiserver->assuan_ctx, optstr, NULL, NULL, |
377 | 377 | NULL, NULL, NULL, NULL); |
378 | free (optstr); | |
378 | gpgrt_free (optstr); | |
379 | 379 | if (err) |
380 | 380 | goto leave; |
381 | 381 | } |
440 | 440 | if (!value) |
441 | 441 | return 0; |
442 | 442 | |
443 | if (asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) | |
443 | if (gpgrt_asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) | |
444 | 444 | err = gpg_error_from_syserror (); |
445 | 445 | else |
446 | 446 | { |
447 | 447 | err = assuan_transact (uiserver->assuan_ctx, optstr, NULL, NULL, |
448 | 448 | NULL, NULL, NULL, NULL); |
449 | free (optstr); | |
449 | gpgrt_free (optstr); | |
450 | 450 | } |
451 | 451 | |
452 | 452 | return err; |
958 | 958 | |
959 | 959 | |
960 | 960 | static gpgme_error_t |
961 | _uiserver_decrypt (void *engine, int verify, | |
962 | gpgme_data_t ciph, gpgme_data_t plain, | |
963 | int export_session_key, const char *override_session_key) | |
961 | uiserver_decrypt (void *engine, | |
962 | gpgme_decrypt_flags_t flags, | |
963 | gpgme_data_t ciph, gpgme_data_t plain, | |
964 | int export_session_key, const char *override_session_key) | |
964 | 965 | { |
965 | 966 | engine_uiserver_t uiserver = engine; |
966 | 967 | gpgme_error_t err; |
967 | 968 | const char *protocol; |
968 | 969 | char *cmd; |
970 | int verify = !!(flags & GPGME_DECRYPT_VERIFY); | |
969 | 971 | |
970 | 972 | (void)override_session_key; /* Fixme: We need to see now to add this |
971 | 973 | * to the UI server protocol */ |
981 | 983 | else |
982 | 984 | return gpgme_error (GPG_ERR_UNSUPPORTED_PROTOCOL); |
983 | 985 | |
984 | if (asprintf (&cmd, "DECRYPT%s%s%s", protocol, | |
986 | if (gpgrt_asprintf (&cmd, "DECRYPT%s%s%s", protocol, | |
985 | 987 | verify ? "" : " --no-verify", |
986 | 988 | export_session_key ? " --export-session-key" : "") < 0) |
987 | 989 | return gpg_error_from_syserror (); |
991 | 993 | map_data_enc (uiserver->input_cb.data)); |
992 | 994 | if (err) |
993 | 995 | { |
994 | free (cmd); | |
996 | gpgrt_free (cmd); | |
995 | 997 | return gpg_error (GPG_ERR_GENERAL); /* FIXME */ |
996 | 998 | } |
997 | 999 | uiserver->output_cb.data = plain; |
998 | 1000 | err = uiserver_set_fd (uiserver, OUTPUT_FD, 0); |
999 | 1001 | if (err) |
1000 | 1002 | { |
1001 | free (cmd); | |
1003 | gpgrt_free (cmd); | |
1002 | 1004 | return gpg_error (GPG_ERR_GENERAL); /* FIXME */ |
1003 | 1005 | } |
1004 | 1006 | uiserver->inline_data = NULL; |
1005 | 1007 | |
1006 | 1008 | err = start (engine, cmd); |
1007 | free (cmd); | |
1009 | gpgrt_free (cmd); | |
1008 | 1010 | return err; |
1009 | } | |
1010 | ||
1011 | ||
1012 | static gpgme_error_t | |
1013 | uiserver_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, | |
1014 | int export_session_key, const char *override_session_key) | |
1015 | { | |
1016 | return _uiserver_decrypt (engine, 0, ciph, plain, | |
1017 | export_session_key, override_session_key); | |
1018 | } | |
1019 | ||
1020 | ||
1021 | static gpgme_error_t | |
1022 | uiserver_decrypt_verify (void *engine, gpgme_data_t ciph, gpgme_data_t plain, | |
1023 | int export_session_key, | |
1024 | const char *override_session_key) | |
1025 | { | |
1026 | return _uiserver_decrypt (engine, 1, ciph, plain, | |
1027 | export_session_key, override_session_key); | |
1028 | 1011 | } |
1029 | 1012 | |
1030 | 1013 | |
1113 | 1096 | if (!recp || plain || ciph) |
1114 | 1097 | return gpg_error (GPG_ERR_INV_VALUE); |
1115 | 1098 | |
1116 | if (asprintf (&cmd, "PREP_ENCRYPT%s%s", protocol, | |
1099 | if (gpgrt_asprintf (&cmd, "PREP_ENCRYPT%s%s", protocol, | |
1117 | 1100 | (flags & GPGME_ENCRYPT_EXPECT_SIGN) |
1118 | 1101 | ? " --expect-sign" : "") < 0) |
1119 | 1102 | return gpg_error_from_syserror (); |
1123 | 1106 | if (!plain || !ciph) |
1124 | 1107 | return gpg_error (GPG_ERR_INV_VALUE); |
1125 | 1108 | |
1126 | if (asprintf (&cmd, "ENCRYPT%s", protocol) < 0) | |
1109 | if (gpgrt_asprintf (&cmd, "ENCRYPT%s", protocol) < 0) | |
1127 | 1110 | return gpg_error_from_syserror (); |
1128 | 1111 | } |
1129 | 1112 | |
1134 | 1117 | map_data_enc (uiserver->input_cb.data)); |
1135 | 1118 | if (err) |
1136 | 1119 | { |
1137 | free (cmd); | |
1120 | gpgrt_free (cmd); | |
1138 | 1121 | return err; |
1139 | 1122 | } |
1140 | 1123 | } |
1146 | 1129 | : map_data_enc (uiserver->output_cb.data)); |
1147 | 1130 | if (err) |
1148 | 1131 | { |
1149 | free (cmd); | |
1132 | gpgrt_free (cmd); | |
1150 | 1133 | return err; |
1151 | 1134 | } |
1152 | 1135 | } |
1158 | 1141 | err = set_recipients (uiserver, recp); |
1159 | 1142 | if (err) |
1160 | 1143 | { |
1161 | free (cmd); | |
1144 | gpgrt_free (cmd); | |
1162 | 1145 | return err; |
1163 | 1146 | } |
1164 | 1147 | } |
1165 | 1148 | |
1166 | 1149 | err = start (uiserver, cmd); |
1167 | free (cmd); | |
1150 | gpgrt_free (cmd); | |
1168 | 1151 | return err; |
1169 | 1152 | } |
1170 | 1153 | |
1194 | 1177 | else |
1195 | 1178 | return gpgme_error (GPG_ERR_UNSUPPORTED_PROTOCOL); |
1196 | 1179 | |
1197 | if (asprintf (&cmd, "SIGN%s%s", protocol, | |
1180 | if (gpgrt_asprintf (&cmd, "SIGN%s%s", protocol, | |
1198 | 1181 | (mode == GPGME_SIG_MODE_DETACH) ? " --detached" : "") < 0) |
1199 | 1182 | return gpg_error_from_syserror (); |
1200 | 1183 | |
1219 | 1202 | err = gpg_error (GPG_ERR_INV_VALUE); |
1220 | 1203 | gpgme_key_unref (key); |
1221 | 1204 | if (err) |
1222 | { | |
1223 | free (cmd); | |
1224 | return err; | |
1225 | } | |
1205 | { | |
1206 | gpgrt_free (cmd); | |
1207 | return err; | |
1208 | } | |
1226 | 1209 | } |
1227 | 1210 | |
1228 | 1211 | uiserver->input_cb.data = in; |
1230 | 1213 | map_data_enc (uiserver->input_cb.data)); |
1231 | 1214 | if (err) |
1232 | 1215 | { |
1233 | free (cmd); | |
1216 | gpgrt_free (cmd); | |
1234 | 1217 | return err; |
1235 | 1218 | } |
1236 | 1219 | uiserver->output_cb.data = out; |
1238 | 1221 | : map_data_enc (uiserver->output_cb.data)); |
1239 | 1222 | if (err) |
1240 | 1223 | { |
1241 | free (cmd); | |
1224 | gpgrt_free (cmd); | |
1242 | 1225 | return err; |
1243 | 1226 | } |
1244 | 1227 | uiserver->inline_data = NULL; |
1245 | 1228 | |
1246 | 1229 | err = start (uiserver, cmd); |
1247 | free (cmd); | |
1230 | gpgrt_free (cmd); | |
1248 | 1231 | return err; |
1249 | 1232 | } |
1250 | 1233 | |
1273 | 1256 | else |
1274 | 1257 | return gpgme_error (GPG_ERR_UNSUPPORTED_PROTOCOL); |
1275 | 1258 | |
1276 | if (asprintf (&cmd, "VERIFY%s", protocol) < 0) | |
1259 | if (gpgrt_asprintf (&cmd, "VERIFY%s", protocol) < 0) | |
1277 | 1260 | return gpg_error_from_syserror (); |
1278 | 1261 | |
1279 | 1262 | uiserver->input_cb.data = sig; |
1281 | 1264 | map_data_enc (uiserver->input_cb.data)); |
1282 | 1265 | if (err) |
1283 | 1266 | { |
1284 | free (cmd); | |
1267 | gpgrt_free (cmd); | |
1285 | 1268 | return err; |
1286 | 1269 | } |
1287 | 1270 | if (plaintext) |
1301 | 1284 | if (!err) |
1302 | 1285 | err = start (uiserver, cmd); |
1303 | 1286 | |
1304 | free (cmd); | |
1287 | gpgrt_free (cmd); | |
1305 | 1288 | return err; |
1306 | 1289 | } |
1307 | 1290 | |
1382 | 1365 | uiserver_set_locale, |
1383 | 1366 | uiserver_set_protocol, |
1384 | 1367 | uiserver_decrypt, |
1385 | uiserver_decrypt_verify, | |
1386 | 1368 | NULL, /* delete */ |
1387 | 1369 | NULL, /* edit */ |
1388 | 1370 | uiserver_encrypt, |
1393 | 1375 | NULL, /* import */ |
1394 | 1376 | NULL, /* keylist */ |
1395 | 1377 | NULL, /* keylist_ext */ |
1378 | NULL, /* keylist_data */ | |
1396 | 1379 | NULL, /* keysign */ |
1397 | 1380 | NULL, /* tofu_policy */ |
1398 | 1381 | uiserver_sign, |
651 | 651 | |
652 | 652 | |
653 | 653 | gpgme_error_t |
654 | _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, | |
654 | _gpgme_engine_op_decrypt (engine_t engine, | |
655 | gpgme_decrypt_flags_t flags, | |
656 | gpgme_data_t ciph, | |
655 | 657 | gpgme_data_t plain, int export_session_key, |
656 | 658 | const char *override_session_key) |
657 | 659 | { |
661 | 663 | if (!engine->ops->decrypt) |
662 | 664 | return gpg_error (GPG_ERR_NOT_IMPLEMENTED); |
663 | 665 | |
664 | return (*engine->ops->decrypt) (engine->engine, ciph, plain, | |
666 | return (*engine->ops->decrypt) (engine->engine, flags, ciph, plain, | |
665 | 667 | export_session_key, override_session_key); |
666 | } | |
667 | ||
668 | ||
669 | gpgme_error_t | |
670 | _gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph, | |
671 | gpgme_data_t plain, int export_session_key, | |
672 | const char *override_session_key) | |
673 | { | |
674 | if (!engine) | |
675 | return gpg_error (GPG_ERR_INV_VALUE); | |
676 | ||
677 | if (!engine->ops->decrypt_verify) | |
678 | return gpg_error (GPG_ERR_NOT_IMPLEMENTED); | |
679 | ||
680 | return (*engine->ops->decrypt_verify) (engine->engine, ciph, plain, | |
681 | export_session_key, | |
682 | override_session_key); | |
683 | 668 | } |
684 | 669 | |
685 | 670 | |
871 | 856 | |
872 | 857 | return (*engine->ops->keylist_ext) (engine->engine, pattern, secret_only, |
873 | 858 | reserved, mode, engine_flags); |
859 | } | |
860 | ||
861 | ||
862 | gpgme_error_t | |
863 | _gpgme_engine_op_keylist_data (engine_t engine, gpgme_data_t data) | |
864 | { | |
865 | if (!engine) | |
866 | return gpg_error (GPG_ERR_INV_VALUE); | |
867 | ||
868 | if (!engine->ops->keylist_data) | |
869 | return gpg_error (GPG_ERR_NOT_IMPLEMENTED); | |
870 | ||
871 | return (*engine->ops->keylist_data) (engine->engine, data); | |
874 | 872 | } |
875 | 873 | |
876 | 874 |
24 | 24 | #include "gpgme.h" |
25 | 25 | |
26 | 26 | /* Flags used by the EXTRAFLAGS arg of _gpgme_engine_op_genkey. */ |
27 | #define GENKEY_EXTRAFLAG_ARMOR 1 | |
28 | #define GENKEY_EXTRAFLAG_REVOKE 2 | |
27 | #define GENKEY_EXTRAFLAG_ARMOR 1 | |
28 | #define GENKEY_EXTRAFLAG_REVOKE 2 | |
29 | #define GENKEY_EXTRAFLAG_SETPRIMARY 4 | |
29 | 30 | |
30 | 31 | |
31 | 32 | struct engine; |
81 | 82 | _gpgme_engine_set_colon_line_handler (engine_t engine, |
82 | 83 | engine_colon_line_handler_t fnc, |
83 | 84 | void *fnc_value); |
84 | gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, | |
85 | gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, | |
86 | gpgme_decrypt_flags_t flags, | |
87 | gpgme_data_t ciph, | |
85 | 88 | gpgme_data_t plain, |
86 | 89 | int export_session_key, |
87 | 90 | const char *override_session_key); |
88 | gpgme_error_t _gpgme_engine_op_decrypt_verify (engine_t engine, | |
89 | gpgme_data_t ciph, | |
90 | gpgme_data_t plain, | |
91 | int export_session_key, | |
92 | const char *override_session_key | |
93 | ); | |
94 | 91 | gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key, |
95 | 92 | int allow_secret); |
96 | 93 | gpgme_error_t _gpgme_engine_op_edit (engine_t engine, int type, |
147 | 144 | int reserved, |
148 | 145 | gpgme_keylist_mode_t mode, |
149 | 146 | int engine_flags); |
147 | gpgme_error_t _gpgme_engine_op_keylist_data (engine_t engine, | |
148 | gpgme_data_t data); | |
150 | 149 | gpgme_error_t _gpgme_engine_op_sign (engine_t engine, gpgme_data_t in, |
151 | 150 | gpgme_data_t out, gpgme_sig_mode_t mode, |
152 | 151 | int use_armor, int use_textmode, |
0 | /* funopen.c - Replacement for funopen. | |
1 | Copyright (C) 2004 g10 Code GmbH | |
2 | ||
3 | This file is part of GPGME | |
4 | ||
5 | GPGME is free software; you can redistribute it and/or modify it | |
6 | under the terms of the GNU Lesser General Public License as | |
7 | published by the Free Software Foundation; either version 2.1 of | |
8 | the License, or (at your option) any later version. | |
9 | ||
10 | GPGME is distributed in the hope that it will be useful, but | |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with this program; if not, write to the Free Software | |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
18 | 02111-1307, USA. */ | |
19 | ||
20 | #ifdef HAVE_CONFIG_H | |
21 | #include <config.h> | |
22 | #endif | |
23 | ||
24 | #include <stdio.h> | |
25 | ||
26 | ||
27 | /* Replacement for the *BSD function: | |
28 | ||
29 | FILE *funopen (void *cookie, | |
30 | int (*readfn)(void *, char *, int), | |
31 | int (*writefn)(void *, const char *, int), | |
32 | fpos_t (*seekfn)(void *, fpos_t, int), | |
33 | int (*closefn)(void *)); | |
34 | ||
35 | The functions to provide my either be NULL if not required or | |
36 | similar to the unistd function with the exception of using the | |
37 | cookie instead of the file descriptor. | |
38 | */ | |
39 | ||
40 | ||
41 | #ifdef HAVE_FOPENCOOKIE | |
42 | FILE * | |
43 | _gpgme_funopen(void *cookie, | |
44 | cookie_read_function_t *readfn, | |
45 | cookie_write_function_t *writefn, | |
46 | cookie_seek_function_t *seekfn, | |
47 | cookie_close_function_t *closefn) | |
48 | { | |
49 | cookie_io_functions_t io = { NULL }; | |
50 | ||
51 | io.read = readfn; | |
52 | io.write = writefn; | |
53 | io.seek = seekfn; | |
54 | io.close = closefn; | |
55 | ||
56 | return fopencookie (cookie, | |
57 | readfn ? ( writefn ? "rw" : "r" ) | |
58 | : ( writefn ? "w" : ""), io); | |
59 | } | |
60 | #else | |
61 | #error No known way to implement funopen. | |
62 | #endif |
488 | 488 | |
489 | 489 | |
490 | 490 | static gpgme_error_t |
491 | addrevuid_start (gpgme_ctx_t ctx, int synchronous, int revoke, | |
491 | addrevuid_start (gpgme_ctx_t ctx, int synchronous, int extraflags, | |
492 | 492 | gpgme_key_t key, const char *userid, unsigned int flags) |
493 | 493 | { |
494 | 494 | gpgme_error_t err; |
511 | 511 | if (err) |
512 | 512 | return err; |
513 | 513 | |
514 | opd->uidmode = revoke? 2 : 1; | |
514 | opd->uidmode = extraflags? 2 : 1; | |
515 | 515 | |
516 | 516 | _gpgme_engine_set_status_handler (ctx->engine, genkey_status_handler, ctx); |
517 | 517 | |
527 | 527 | userid, NULL, 0, 0, |
528 | 528 | key, flags, |
529 | 529 | NULL, |
530 | revoke? GENKEY_EXTRAFLAG_REVOKE : 0, | |
530 | extraflags, | |
531 | 531 | NULL, NULL); |
532 | 532 | |
533 | 533 | } |
583 | 583 | if (!ctx) |
584 | 584 | return TRACE_ERR (gpg_error (GPG_ERR_INV_ARG)); |
585 | 585 | |
586 | err = addrevuid_start (ctx, 0, 1, key, userid, flags); | |
586 | err = addrevuid_start (ctx, 0, GENKEY_EXTRAFLAG_REVOKE, key, userid, flags); | |
587 | 587 | return TRACE_ERR (err); |
588 | 588 | } |
589 | 589 | |
600 | 600 | if (!ctx) |
601 | 601 | return TRACE_ERR (gpg_error (GPG_ERR_INV_ARG)); |
602 | 602 | |
603 | err = addrevuid_start (ctx, 1, 1, key, userid, flags); | |
603 | err = addrevuid_start (ctx, 1, GENKEY_EXTRAFLAG_REVOKE, key, userid, flags); | |
604 | 604 | if (!err) |
605 | 605 | err = _gpgme_wait_one (ctx); |
606 | 606 | return TRACE_ERR (err); |
607 | 607 | } |
608 | ||
609 | ||
610 | /* Set a flag on the USERID of KEY. The only supported flag right now | |
611 | * is "primary" to mark the primary key. */ | |
612 | static gpg_error_t | |
613 | set_uid_flag (gpgme_ctx_t ctx, int synchronous, | |
614 | gpgme_key_t key, const char *userid, | |
615 | const char *name, const char *value) | |
616 | { | |
617 | gpgme_error_t err; | |
618 | ||
619 | TRACE_BEG4 (DEBUG_CTX, "gpgme_op_set_uid_flag", ctx, | |
620 | "%d uid='%s' '%s'='%s'", synchronous, userid, name, value); | |
621 | ||
622 | if (!ctx || !name || !key || !userid) | |
623 | return TRACE_ERR (gpg_error (GPG_ERR_INV_ARG)); | |
624 | ||
625 | if (!strcmp (name, "primary")) | |
626 | { | |
627 | if (value) | |
628 | err = gpg_error (GPG_ERR_INV_ARG); | |
629 | else | |
630 | err = addrevuid_start (ctx, synchronous, | |
631 | GENKEY_EXTRAFLAG_SETPRIMARY, key, userid, 0); | |
632 | } | |
633 | else | |
634 | return err = gpg_error (GPG_ERR_UNKNOWN_NAME); | |
635 | ||
636 | if (synchronous && !err) | |
637 | err = _gpgme_wait_one (ctx); | |
638 | return TRACE_ERR (err); | |
639 | } | |
640 | ||
641 | ||
642 | /* See set_uid_flag. */ | |
643 | gpgme_error_t | |
644 | gpgme_op_set_uid_flag_start (gpgme_ctx_t ctx, | |
645 | gpgme_key_t key, const char *userid, | |
646 | const char *name, const char *value) | |
647 | { | |
648 | return set_uid_flag (ctx, 0, key, userid, name, value); | |
649 | } | |
650 | ||
651 | ||
652 | /* See set_uid_flag. Thsi is the synchronous variant. */ | |
653 | gpgme_error_t | |
654 | gpgme_op_set_uid_flag (gpgme_ctx_t ctx, | |
655 | gpgme_key_t key, const char *userid, | |
656 | const char *name, const char *value) | |
657 | { | |
658 | return set_uid_flag (ctx, 1, key, userid, name, value); | |
659 | } |
507 | 507 | |
508 | 508 | if (!ctx || !name || !value) |
509 | 509 | err = gpg_error (GPG_ERR_INV_VALUE); |
510 | else if (!strcmp (name, "redraw")) | |
511 | { | |
512 | ctx->redraw_suggested = abool; | |
513 | } | |
510 | 514 | else if (!strcmp (name, "full-status")) |
511 | 515 | { |
512 | 516 | ctx->full_status = abool; |
543 | 547 | { |
544 | 548 | if (!ctx || !name) |
545 | 549 | return NULL; |
550 | else if (!strcmp (name, "redraw")) | |
551 | { | |
552 | return ctx->redraw_suggested? "1":""; | |
553 | } | |
546 | 554 | else if (!strcmp (name, "full-status")) |
547 | 555 | { |
548 | 556 | return ctx->full_status? "1":""; |
176 | 176 | gpgme_io_read @136 |
177 | 177 | gpgme_io_write @137 |
178 | 178 | |
179 | gpgme_result_ref @138 | |
180 | gpgme_result_unref @139 | |
179 | gpgme_result_ref @138 | |
180 | gpgme_result_unref @139 | |
181 | 181 | |
182 | 182 | gpgme_op_import_keys @140 |
183 | 183 | gpgme_op_import_keys_start @141 |
252 | 252 | gpgme_op_query_swdb_result @190 |
253 | 253 | |
254 | 254 | gpgme_get_ctx_flag @191 |
255 | ||
256 | gpgme_op_keylist_from_data_start @192 | |
257 | ||
258 | gpgme_op_set_uid_flag_start @193 | |
259 | gpgme_op_set_uid_flag @194 | |
260 | ||
261 | gpgme_op_decrypt_ext @195 | |
262 | gpgme_op_decrypt_ext_start @196 | |
263 | ||
255 | 264 | ; END |
256 | 265 |
0 | 0 | /* gpgme.h - Public interface to GnuPG Made Easy. -*- c -*- |
1 | 1 | * Copyright (C) 2000 Werner Koch (dd9jn) |
2 | * Copyright (C) 2001-2016 g10 Code GmbH | |
2 | * Copyright (C) 2001-2017 g10 Code GmbH | |
3 | 3 | * |
4 | 4 | * This file is part of GPGME. |
5 | 5 | * |
293 | 293 | gpgme_hash_algo_t; |
294 | 294 | |
295 | 295 | |
296 | /* The possible signature stati. Deprecated, use error value in sig | |
297 | status. */ | |
298 | typedef enum | |
299 | { | |
300 | GPGME_SIG_STAT_NONE = 0, | |
301 | GPGME_SIG_STAT_GOOD = 1, | |
302 | GPGME_SIG_STAT_BAD = 2, | |
303 | GPGME_SIG_STAT_NOKEY = 3, | |
304 | GPGME_SIG_STAT_NOSIG = 4, | |
305 | GPGME_SIG_STAT_ERROR = 5, | |
306 | GPGME_SIG_STAT_DIFF = 6, | |
307 | GPGME_SIG_STAT_GOOD_EXP = 7, | |
308 | GPGME_SIG_STAT_GOOD_EXPKEY = 8 | |
309 | } | |
310 | _gpgme_sig_stat_t; | |
311 | typedef _gpgme_sig_stat_t gpgme_sig_stat_t _GPGME_DEPRECATED(0,4); | |
312 | ||
313 | ||
314 | 296 | /* The available signature modes. */ |
315 | 297 | typedef enum |
316 | 298 | { |
319 | 301 | GPGME_SIG_MODE_CLEAR = 2 |
320 | 302 | } |
321 | 303 | gpgme_sig_mode_t; |
322 | ||
323 | ||
324 | /* The available key and signature attributes. Deprecated, use the | |
325 | individual result structures instead. */ | |
326 | typedef enum | |
327 | { | |
328 | GPGME_ATTR_KEYID = 1, | |
329 | GPGME_ATTR_FPR = 2, | |
330 | GPGME_ATTR_ALGO = 3, | |
331 | GPGME_ATTR_LEN = 4, | |
332 | GPGME_ATTR_CREATED = 5, | |
333 | GPGME_ATTR_EXPIRE = 6, | |
334 | GPGME_ATTR_OTRUST = 7, | |
335 | GPGME_ATTR_USERID = 8, | |
336 | GPGME_ATTR_NAME = 9, | |
337 | GPGME_ATTR_EMAIL = 10, | |
338 | GPGME_ATTR_COMMENT = 11, | |
339 | GPGME_ATTR_VALIDITY = 12, | |
340 | GPGME_ATTR_LEVEL = 13, | |
341 | GPGME_ATTR_TYPE = 14, | |
342 | GPGME_ATTR_IS_SECRET = 15, | |
343 | GPGME_ATTR_KEY_REVOKED = 16, | |
344 | GPGME_ATTR_KEY_INVALID = 17, | |
345 | GPGME_ATTR_UID_REVOKED = 18, | |
346 | GPGME_ATTR_UID_INVALID = 19, | |
347 | GPGME_ATTR_KEY_CAPS = 20, | |
348 | GPGME_ATTR_CAN_ENCRYPT = 21, | |
349 | GPGME_ATTR_CAN_SIGN = 22, | |
350 | GPGME_ATTR_CAN_CERTIFY = 23, | |
351 | GPGME_ATTR_KEY_EXPIRED = 24, | |
352 | GPGME_ATTR_KEY_DISABLED = 25, | |
353 | GPGME_ATTR_SERIAL = 26, | |
354 | GPGME_ATTR_ISSUER = 27, | |
355 | GPGME_ATTR_CHAINID = 28, | |
356 | GPGME_ATTR_SIG_STATUS = 29, | |
357 | GPGME_ATTR_ERRTOK = 30, | |
358 | GPGME_ATTR_SIG_SUMMARY = 31, | |
359 | GPGME_ATTR_SIG_CLASS = 32 | |
360 | } | |
361 | _gpgme_attr_t; | |
362 | typedef _gpgme_attr_t gpgme_attr_t _GPGME_DEPRECATED(0,4); | |
363 | 304 | |
364 | 305 | |
365 | 306 | /* The available validities for a trust item or key. */ |
445 | 386 | #define GPGME_AUDITLOG_HTML 1 |
446 | 387 | #define GPGME_AUDITLOG_WITH_HELP 128 |
447 | 388 | |
389 | ||
390 | /* The available signature notation flags. */ | |
391 | #define GPGME_SIG_NOTATION_HUMAN_READABLE 1 | |
392 | #define GPGME_SIG_NOTATION_CRITICAL 2 | |
393 | ||
394 | typedef unsigned int gpgme_sig_notation_flags_t; | |
395 | ||
396 | /* An object to hold information about notation data. This structure | |
397 | * shall be considered read-only and an application must not allocate | |
398 | * such a structure on its own. */ | |
399 | struct _gpgme_sig_notation | |
400 | { | |
401 | struct _gpgme_sig_notation *next; | |
402 | ||
403 | /* If NAME is a null pointer, then VALUE contains a policy URL | |
404 | rather than a notation. */ | |
405 | char *name; | |
406 | ||
407 | /* The value of the notation data. */ | |
408 | char *value; | |
409 | ||
410 | /* The length of the name of the notation data. */ | |
411 | int name_len; | |
412 | ||
413 | /* The length of the value of the notation data. */ | |
414 | int value_len; | |
415 | ||
416 | /* The accumulated flags. */ | |
417 | gpgme_sig_notation_flags_t flags; | |
418 | ||
419 | /* Notation data is human-readable. */ | |
420 | unsigned int human_readable : 1; | |
421 | ||
422 | /* Notation data is critical. */ | |
423 | unsigned int critical : 1; | |
424 | ||
425 | /* Internal to GPGME, do not use. */ | |
426 | int _unused : 30; | |
427 | }; | |
428 | typedef struct _gpgme_sig_notation *gpgme_sig_notation_t; | |
429 | ||
430 | ||
431 | ||
432 | /* | |
433 | * Public structures. | |
434 | */ | |
435 | ||
436 | /* The engine information structure. | |
437 | * This structure shall be considered read-only and an application | |
438 | * must not allocate such a structure on its own. */ | |
439 | struct _gpgme_engine_info | |
440 | { | |
441 | struct _gpgme_engine_info *next; | |
442 | ||
443 | /* The protocol ID. */ | |
444 | gpgme_protocol_t protocol; | |
445 | ||
446 | /* The file name of the engine binary. */ | |
447 | char *file_name; | |
448 | ||
449 | /* The version string of the installed engine. */ | |
450 | char *version; | |
451 | ||
452 | /* The minimum version required for GPGME. */ | |
453 | const char *req_version; | |
454 | ||
455 | /* The home directory used, or NULL if default. */ | |
456 | char *home_dir; | |
457 | }; | |
458 | typedef struct _gpgme_engine_info *gpgme_engine_info_t; | |
459 | ||
460 | ||
461 | /* An object with TOFU information. | |
462 | * This structure shall be considered read-only and an application | |
463 | * must not allocate such a structure on its own. */ | |
464 | struct _gpgme_tofu_info | |
465 | { | |
466 | struct _gpgme_tofu_info *next; | |
467 | ||
468 | /* The TOFU validity: | |
469 | * 0 := conflict | |
470 | * 1 := key without history | |
471 | * 2 := key with too little history | |
472 | * 3 := key with enough history for basic trust | |
473 | * 4 := key with a lot of history | |
474 | */ | |
475 | unsigned int validity : 3; | |
476 | ||
477 | /* The TOFU policy (gpgme_tofu_policy_t). */ | |
478 | unsigned int policy : 4; | |
479 | ||
480 | unsigned int _rfu : 25; | |
481 | ||
482 | /* Number of signatures seen for this binding. Capped at USHRT_MAX. */ | |
483 | unsigned short signcount; | |
484 | /* Number of encryptions done with this binding. Capped at USHRT_MAX. */ | |
485 | unsigned short encrcount; | |
486 | ||
487 | /* Number of seconds since Epoch when the first and the most | |
488 | * recently seen message were verified/decrypted. 0 means unknown. */ | |
489 | unsigned long signfirst; | |
490 | unsigned long signlast; | |
491 | unsigned long encrfirst; | |
492 | unsigned long encrlast; | |
493 | ||
494 | /* If non-NULL a human readable string summarizing the TOFU data. */ | |
495 | char *description; | |
496 | }; | |
497 | typedef struct _gpgme_tofu_info *gpgme_tofu_info_t; | |
498 | ||
499 | ||
500 | /* A subkey from a key. | |
501 | * This structure shall be considered read-only and an application | |
502 | * must not allocate such a structure on its own. */ | |
503 | struct _gpgme_subkey | |
504 | { | |
505 | struct _gpgme_subkey *next; | |
506 | ||
507 | /* True if subkey is revoked. */ | |
508 | unsigned int revoked : 1; | |
509 | ||
510 | /* True if subkey is expired. */ | |
511 | unsigned int expired : 1; | |
512 | ||
513 | /* True if subkey is disabled. */ | |
514 | unsigned int disabled : 1; | |
515 | ||
516 | /* True if subkey is invalid. */ | |
517 | unsigned int invalid : 1; | |
518 | ||
519 | /* True if subkey can be used for encryption. */ | |
520 | unsigned int can_encrypt : 1; | |
521 | ||
522 | /* True if subkey can be used for signing. */ | |
523 | unsigned int can_sign : 1; | |
524 | ||
525 | /* True if subkey can be used for certification. */ | |
526 | unsigned int can_certify : 1; | |
527 | ||
528 | /* True if subkey is secret. */ | |
529 | unsigned int secret : 1; | |
530 | ||
531 | /* True if subkey can be used for authentication. */ | |
532 | unsigned int can_authenticate : 1; | |
533 | ||
534 | /* True if subkey is qualified for signatures according to German law. */ | |
535 | unsigned int is_qualified : 1; | |
536 | ||
537 | /* True if the secret key is stored on a smart card. */ | |
538 | unsigned int is_cardkey : 1; | |
539 | ||
540 | /* True if the key is compliant to the de-vs mode. */ | |
541 | unsigned int is_de_vs : 1; | |
542 | ||
543 | /* Internal to GPGME, do not use. */ | |
544 | unsigned int _unused : 20; | |
545 | ||
546 | /* Public key algorithm supported by this subkey. */ | |
547 | gpgme_pubkey_algo_t pubkey_algo; | |
548 | ||
549 | /* Length of the subkey. */ | |
550 | unsigned int length; | |
551 | ||
552 | /* The key ID of the subkey. */ | |
553 | char *keyid; | |
554 | ||
555 | /* Internal to GPGME, do not use. */ | |
556 | char _keyid[16 + 1]; | |
557 | ||
558 | /* The fingerprint of the subkey in hex digit form. */ | |
559 | char *fpr; | |
560 | ||
561 | /* The creation timestamp, -1 if invalid, 0 if not available. */ | |
562 | long int timestamp; | |
563 | ||
564 | /* The expiration timestamp, 0 if the subkey does not expire. */ | |
565 | long int expires; | |
566 | ||
567 | /* The serial number of a smart card holding this key or NULL. */ | |
568 | char *card_number; | |
569 | ||
570 | /* The name of the curve for ECC algorithms or NULL. */ | |
571 | char *curve; | |
572 | ||
573 | /* The keygrip of the subkey in hex digit form or NULL if not availabale. */ | |
574 | char *keygrip; | |
575 | }; | |
576 | typedef struct _gpgme_subkey *gpgme_subkey_t; | |
577 | ||
578 | ||
579 | /* A signature on a user ID. | |
580 | * This structure shall be considered read-only and an application | |
581 | * must not allocate such a structure on its own. */ | |
582 | struct _gpgme_key_sig | |
583 | { | |
584 | struct _gpgme_key_sig *next; | |
585 | ||
586 | /* True if the signature is a revocation signature. */ | |
587 | unsigned int revoked : 1; | |
588 | ||
589 | /* True if the signature is expired. */ | |
590 | unsigned int expired : 1; | |
591 | ||
592 | /* True if the signature is invalid. */ | |
593 | unsigned int invalid : 1; | |
594 | ||
595 | /* True if the signature should be exported. */ | |
596 | unsigned int exportable : 1; | |
597 | ||
598 | /* Internal to GPGME, do not use. */ | |
599 | unsigned int _unused : 28; | |
600 | ||
601 | /* The public key algorithm used to create the signature. */ | |
602 | gpgme_pubkey_algo_t pubkey_algo; | |
603 | ||
604 | /* The key ID of key used to create the signature. */ | |
605 | char *keyid; | |
606 | ||
607 | /* Internal to GPGME, do not use. */ | |
608 | char _keyid[16 + 1]; | |
609 | ||
610 | /* The creation timestamp, -1 if invalid, 0 if not available. */ | |
611 | long int timestamp; | |
612 | ||
613 | /* The expiration timestamp, 0 if the subkey does not expire. */ | |
614 | long int expires; | |
615 | ||
616 | /* Same as in gpgme_signature_t. */ | |
617 | gpgme_error_t status; | |
618 | ||
619 | #ifdef __cplusplus | |
620 | unsigned int _obsolete_class _GPGME_DEPRECATED(0,4); | |
621 | #else | |
622 | /* Must be set to SIG_CLASS below. */ | |
623 | unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME(0,4); | |
624 | #endif | |
625 | ||
626 | /* The user ID string. */ | |
627 | char *uid; | |
628 | ||
629 | /* The name part of the user ID. */ | |
630 | char *name; | |
631 | ||
632 | /* The email part of the user ID. */ | |
633 | char *email; | |
634 | ||
635 | /* The comment part of the user ID. */ | |
636 | char *comment; | |
637 | ||
638 | /* Crypto backend specific signature class. */ | |
639 | unsigned int sig_class; | |
640 | ||
641 | /* Notation data and policy URLs. */ | |
642 | gpgme_sig_notation_t notations; | |
643 | ||
644 | /* Internal to GPGME, do not use. */ | |
645 | gpgme_sig_notation_t _last_notation; | |
646 | }; | |
647 | typedef struct _gpgme_key_sig *gpgme_key_sig_t; | |
648 | ||
649 | ||
650 | /* An user ID from a key. | |
651 | * This structure shall be considered read-only and an application | |
652 | * must not allocate such a structure on its own. */ | |
653 | struct _gpgme_user_id | |
654 | { | |
655 | struct _gpgme_user_id *next; | |
656 | ||
657 | /* True if the user ID is revoked. */ | |
658 | unsigned int revoked : 1; | |
659 | ||
660 | /* True if the user ID is invalid. */ | |
661 | unsigned int invalid : 1; | |
662 | ||
663 | /* Internal to GPGME, do not use. */ | |
664 | unsigned int _unused : 25; | |
665 | ||
666 | /* Origin of this user ID. */ | |
667 | unsigned int origin : 5; | |
668 | ||
669 | /* The validity of the user ID. */ | |
670 | gpgme_validity_t validity; | |
671 | ||
672 | /* The user ID string. */ | |
673 | char *uid; | |
674 | ||
675 | /* The name part of the user ID. */ | |
676 | char *name; | |
677 | ||
678 | /* The email part of the user ID. */ | |
679 | char *email; | |
680 | ||
681 | /* The comment part of the user ID. */ | |
682 | char *comment; | |
683 | ||
684 | /* The signatures of the user ID. */ | |
685 | gpgme_key_sig_t signatures; | |
686 | ||
687 | /* Internal to GPGME, do not use. */ | |
688 | gpgme_key_sig_t _last_keysig; | |
689 | ||
690 | /* The mail address (addr-spec from RFC5322) of the UID string. | |
691 | * This is general the same as the EMAIL part of this struct but | |
692 | * might be slightly different. If no mail address is available | |
693 | * NULL is stored. */ | |
694 | char *address; | |
695 | ||
696 | /* The malloced TOFU information or NULL. */ | |
697 | gpgme_tofu_info_t tofu; | |
698 | ||
699 | /* Time of the last refresh of thsi user id. 0 if unknown. */ | |
700 | unsigned long last_update; | |
701 | }; | |
702 | typedef struct _gpgme_user_id *gpgme_user_id_t; | |
703 | ||
704 | ||
705 | /* A key from the keyring. | |
706 | * This structure shall be considered read-only and an application | |
707 | * must not allocate such a structure on its own. */ | |
708 | struct _gpgme_key | |
709 | { | |
710 | /* Internal to GPGME, do not use. */ | |
711 | unsigned int _refs; | |
712 | ||
713 | /* True if key is revoked. */ | |
714 | unsigned int revoked : 1; | |
715 | ||
716 | /* True if key is expired. */ | |
717 | unsigned int expired : 1; | |
718 | ||
719 | /* True if key is disabled. */ | |
720 | unsigned int disabled : 1; | |
721 | ||
722 | /* True if key is invalid. */ | |
723 | unsigned int invalid : 1; | |
724 | ||
725 | /* True if key can be used for encryption. */ | |
726 | unsigned int can_encrypt : 1; | |
727 | ||
728 | /* True if key can be used for signing. */ | |
729 | unsigned int can_sign : 1; | |
730 | ||
731 | /* True if key can be used for certification. */ | |
732 | unsigned int can_certify : 1; | |
733 | ||
734 | /* True if key is secret. */ | |
735 | unsigned int secret : 1; | |
736 | ||
737 | /* True if key can be used for authentication. */ | |
738 | unsigned int can_authenticate : 1; | |
739 | ||
740 | /* True if subkey is qualified for signatures according to German law. */ | |
741 | unsigned int is_qualified : 1; | |
742 | ||
743 | /* Internal to GPGME, do not use. */ | |
744 | unsigned int _unused : 17; | |
745 | ||
746 | /* Origin of this key. */ | |
747 | unsigned int origin : 5; | |
748 | ||
749 | /* This is the protocol supported by this key. */ | |
750 | gpgme_protocol_t protocol; | |
751 | ||
752 | /* If protocol is GPGME_PROTOCOL_CMS, this string contains the | |
753 | issuer serial. */ | |
754 | char *issuer_serial; | |
755 | ||
756 | /* If protocol is GPGME_PROTOCOL_CMS, this string contains the | |
757 | issuer name. */ | |
758 | char *issuer_name; | |
759 | ||
760 | /* If protocol is GPGME_PROTOCOL_CMS, this string contains the chain | |
761 | ID. */ | |
762 | char *chain_id; | |
763 | ||
764 | /* If protocol is GPGME_PROTOCOL_OpenPGP, this field contains the | |
765 | owner trust. */ | |
766 | gpgme_validity_t owner_trust; | |
767 | ||
768 | /* The subkeys of the key. */ | |
769 | gpgme_subkey_t subkeys; | |
770 | ||
771 | /* The user IDs of the key. */ | |
772 | gpgme_user_id_t uids; | |
773 | ||
774 | /* Internal to GPGME, do not use. */ | |
775 | gpgme_subkey_t _last_subkey; | |
776 | ||
777 | /* Internal to GPGME, do not use. */ | |
778 | gpgme_user_id_t _last_uid; | |
779 | ||
780 | /* The keylist mode that was active when listing the key. */ | |
781 | gpgme_keylist_mode_t keylist_mode; | |
782 | ||
783 | /* This field gives the fingerprint of the primary key. Note that | |
784 | * this is a copy of the FPR of the first subkey. We need it here | |
785 | * to allow for an incomplete key object. */ | |
786 | char *fpr; | |
787 | ||
788 | /* Time of the last refresh of the entire key. 0 if unknown. */ | |
789 | unsigned long last_update; | |
790 | }; | |
791 | typedef struct _gpgme_key *gpgme_key_t; | |
792 | ||
793 | ||
794 | /* An invalid key object. | |
795 | * This structure shall be considered read-only and an application | |
796 | * must not allocate such a structure on its own. */ | |
797 | struct _gpgme_invalid_key | |
798 | { | |
799 | struct _gpgme_invalid_key *next; | |
800 | ||
801 | /* The string used to request the key. Despite the name this may | |
802 | * not be a fingerprint. */ | |
803 | char *fpr; | |
804 | ||
805 | /* The error code. */ | |
806 | gpgme_error_t reason; | |
807 | }; | |
808 | typedef struct _gpgme_invalid_key *gpgme_invalid_key_t; | |
809 | ||
810 | ||
811 | ||
812 | /* | |
813 | * Types for callback functions. | |
814 | */ | |
815 | ||
816 | /* Request a passphrase from the user. */ | |
817 | typedef gpgme_error_t (*gpgme_passphrase_cb_t) (void *hook, | |
818 | const char *uid_hint, | |
819 | const char *passphrase_info, | |
820 | int prev_was_bad, int fd); | |
821 | ||
822 | /* Inform the user about progress made. */ | |
823 | typedef void (*gpgme_progress_cb_t) (void *opaque, const char *what, | |
824 | int type, int current, int total); | |
825 | ||
826 | /* Status messages from gpg. */ | |
827 | typedef gpgme_error_t (*gpgme_status_cb_t) (void *opaque, const char *keyword, | |
828 | const char *args); | |
829 | ||
830 | /* Interact with the user about an edit operation. */ | |
831 | typedef gpgme_error_t (*gpgme_interact_cb_t) (void *opaque, | |
832 | const char *keyword, | |
833 | const char *args, int fd); | |
834 | ||
835 | ||
836 | ||
837 | /* | |
838 | * Context management functions. | |
839 | */ | |
840 | ||
841 | /* Create a new context and return it in CTX. */ | |
842 | gpgme_error_t gpgme_new (gpgme_ctx_t *ctx); | |
843 | ||
844 | /* Release the context CTX. */ | |
845 | void gpgme_release (gpgme_ctx_t ctx); | |
846 | ||
847 | /* Set the flag NAME for CTX to VALUE. */ | |
848 | gpgme_error_t gpgme_set_ctx_flag (gpgme_ctx_t ctx, | |
849 | const char *name, const char *value); | |
850 | ||
851 | /* Get the value of the flag NAME from CTX. */ | |
852 | const char *gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name); | |
853 | ||
854 | /* Set the protocol to be used by CTX to PROTO. */ | |
855 | gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto); | |
856 | ||
857 | /* Get the protocol used with CTX */ | |
858 | gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx); | |
859 | ||
860 | /* Set the crypto protocol to be used by CTX to PROTO. | |
861 | gpgme_set_protocol actually sets the backend engine. This sets the | |
862 | crypto protocol used in engines that support more than one crypto | |
863 | prococol (for example, an UISERVER can support OpenPGP and CMS). | |
864 | This is reset to the default with gpgme_set_protocol. */ | |
865 | gpgme_error_t gpgme_set_sub_protocol (gpgme_ctx_t ctx, | |
866 | gpgme_protocol_t proto); | |
867 | ||
868 | /* Get the sub protocol. */ | |
869 | gpgme_protocol_t gpgme_get_sub_protocol (gpgme_ctx_t ctx); | |
870 | ||
871 | /* Get the string describing protocol PROTO, or NULL if invalid. */ | |
872 | const char *gpgme_get_protocol_name (gpgme_protocol_t proto); | |
873 | ||
874 | /* If YES is non-zero, enable armor mode in CTX, disable it otherwise. */ | |
875 | void gpgme_set_armor (gpgme_ctx_t ctx, int yes); | |
876 | ||
877 | /* Return non-zero if armor mode is set in CTX. */ | |
878 | int gpgme_get_armor (gpgme_ctx_t ctx); | |
879 | ||
880 | /* If YES is non-zero, enable text mode in CTX, disable it otherwise. */ | |
881 | void gpgme_set_textmode (gpgme_ctx_t ctx, int yes); | |
882 | ||
883 | /* Return non-zero if text mode is set in CTX. */ | |
884 | int gpgme_get_textmode (gpgme_ctx_t ctx); | |
885 | ||
886 | /* If YES is non-zero, enable offline mode in CTX, disable it otherwise. */ | |
887 | void gpgme_set_offline (gpgme_ctx_t ctx, int yes); | |
888 | ||
889 | /* Return non-zero if offline mode is set in CTX. */ | |
890 | int gpgme_get_offline (gpgme_ctx_t ctx); | |
891 | ||
892 | /* Use whatever the default of the backend crypto engine is. */ | |
893 | #define GPGME_INCLUDE_CERTS_DEFAULT -256 | |
894 | ||
895 | /* Include up to NR_OF_CERTS certificates in an S/MIME message. */ | |
896 | void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs); | |
897 | ||
898 | /* Return the number of certs to include in an S/MIME message. */ | |
899 | int gpgme_get_include_certs (gpgme_ctx_t ctx); | |
900 | ||
901 | /* Set keylist mode in CTX to MODE. */ | |
902 | gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t ctx, | |
903 | gpgme_keylist_mode_t mode); | |
904 | ||
905 | /* Get keylist mode in CTX. */ | |
906 | gpgme_keylist_mode_t gpgme_get_keylist_mode (gpgme_ctx_t ctx); | |
907 | ||
908 | /* Set the pinentry mode for CTX to MODE. */ | |
909 | gpgme_error_t gpgme_set_pinentry_mode (gpgme_ctx_t ctx, | |
910 | gpgme_pinentry_mode_t mode); | |
911 | ||
912 | /* Get the pinentry mode of CTX. */ | |
913 | gpgme_pinentry_mode_t gpgme_get_pinentry_mode (gpgme_ctx_t ctx); | |
914 | ||
915 | /* Set the passphrase callback function in CTX to CB. HOOK_VALUE is | |
916 | passed as first argument to the passphrase callback function. */ | |
917 | void gpgme_set_passphrase_cb (gpgme_ctx_t ctx, | |
918 | gpgme_passphrase_cb_t cb, void *hook_value); | |
919 | ||
920 | /* Get the current passphrase callback function in *CB and the current | |
921 | hook value in *HOOK_VALUE. */ | |
922 | void gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *cb, | |
923 | void **hook_value); | |
924 | ||
925 | /* Set the progress callback function in CTX to CB. HOOK_VALUE is | |
926 | passed as first argument to the progress callback function. */ | |
927 | void gpgme_set_progress_cb (gpgme_ctx_t c, gpgme_progress_cb_t cb, | |
928 | void *hook_value); | |
929 | ||
930 | /* Get the current progress callback function in *CB and the current | |
931 | hook value in *HOOK_VALUE. */ | |
932 | void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *cb, | |
933 | void **hook_value); | |
934 | ||
935 | /* Set the status callback function in CTX to CB. HOOK_VALUE is | |
936 | passed as first argument to the status callback function. */ | |
937 | void gpgme_set_status_cb (gpgme_ctx_t c, gpgme_status_cb_t cb, | |
938 | void *hook_value); | |
939 | ||
940 | /* Get the current status callback function in *CB and the current | |
941 | hook value in *HOOK_VALUE. */ | |
942 | void gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *cb, | |
943 | void **hook_value); | |
944 | ||
945 | /* This function sets the locale for the context CTX, or the default | |
946 | locale if CTX is a null pointer. */ | |
947 | gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category, | |
948 | const char *value); | |
949 | ||
950 | /* Get the information about the configured engines. A pointer to the | |
951 | first engine in the statically allocated linked list is returned. | |
952 | The returned data is valid until the next gpgme_ctx_set_engine_info. */ | |
953 | gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx); | |
954 | ||
955 | /* Set the engine info for the context CTX, protocol PROTO, to the | |
956 | file name FILE_NAME and the home directory HOME_DIR. */ | |
957 | gpgme_error_t gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, | |
958 | gpgme_protocol_t proto, | |
959 | const char *file_name, | |
960 | const char *home_dir); | |
961 | ||
962 | /* Delete all signers from CTX. */ | |
963 | void gpgme_signers_clear (gpgme_ctx_t ctx); | |
964 | ||
965 | /* Add KEY to list of signers in CTX. */ | |
966 | gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key); | |
967 | ||
968 | /* Return the number of signers in CTX. */ | |
969 | unsigned int gpgme_signers_count (const gpgme_ctx_t ctx); | |
970 | ||
971 | /* Return the SEQth signer's key in CTX. */ | |
972 | gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq); | |
973 | ||
974 | /* Clear all notation data from the context. */ | |
975 | void gpgme_sig_notation_clear (gpgme_ctx_t ctx); | |
976 | ||
977 | /* Add the human-readable notation data with name NAME and value VALUE | |
978 | to the context CTX, using the flags FLAGS. If NAME is NULL, then | |
979 | VALUE should be a policy URL. The flag | |
980 | GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation | |
981 | data, and false for policy URLs. */ | |
982 | gpgme_error_t gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name, | |
983 | const char *value, | |
984 | gpgme_sig_notation_flags_t flags); | |
985 | ||
986 | /* Get the sig notations for this context. */ | |
987 | gpgme_sig_notation_t gpgme_sig_notation_get (gpgme_ctx_t ctx); | |
988 | ||
989 | /* Store a sender address in the context. */ | |
990 | gpgme_error_t gpgme_set_sender (gpgme_ctx_t ctx, const char *address); | |
991 | ||
992 | /* Get the sender address from the context. */ | |
993 | const char *gpgme_get_sender (gpgme_ctx_t ctx); | |
994 | ||
995 | ||
996 | ||
997 | /* | |
998 | * Run control. | |
999 | */ | |
1000 | ||
1001 | /* The type of an I/O callback function. */ | |
1002 | typedef gpgme_error_t (*gpgme_io_cb_t) (void *data, int fd); | |
1003 | ||
1004 | /* The type of a function that can register FNC as the I/O callback | |
1005 | function for the file descriptor FD with direction dir (0: for writing, | |
1006 | 1: for reading). FNC_DATA should be passed as DATA to FNC. The | |
1007 | function should return a TAG suitable for the corresponding | |
1008 | gpgme_remove_io_cb_t, and an error value. */ | |
1009 | typedef gpgme_error_t (*gpgme_register_io_cb_t) (void *data, int fd, int dir, | |
1010 | gpgme_io_cb_t fnc, | |
1011 | void *fnc_data, void **tag); | |
1012 | ||
1013 | /* The type of a function that can remove a previously registered I/O | |
1014 | callback function given TAG as returned by the register | |
1015 | function. */ | |
1016 | typedef void (*gpgme_remove_io_cb_t) (void *tag); | |
1017 | ||
1018 | typedef enum | |
1019 | { | |
1020 | GPGME_EVENT_START, | |
1021 | GPGME_EVENT_DONE, | |
1022 | GPGME_EVENT_NEXT_KEY, | |
1023 | GPGME_EVENT_NEXT_TRUSTITEM | |
1024 | } | |
1025 | gpgme_event_io_t; | |
1026 | ||
1027 | struct gpgme_io_event_done_data | |
1028 | { | |
1029 | /* A fatal IPC error or an operational error in state-less | |
1030 | protocols. */ | |
1031 | gpgme_error_t err; | |
1032 | ||
1033 | /* An operational errors in session-based protocols. */ | |
1034 | gpgme_error_t op_err; | |
1035 | }; | |
1036 | typedef struct gpgme_io_event_done_data *gpgme_io_event_done_data_t; | |
1037 | ||
1038 | /* The type of a function that is called when a context finished an | |
1039 | operation. */ | |
1040 | typedef void (*gpgme_event_io_cb_t) (void *data, gpgme_event_io_t type, | |
1041 | void *type_data); | |
1042 | ||
1043 | struct gpgme_io_cbs | |
1044 | { | |
1045 | gpgme_register_io_cb_t add; | |
1046 | void *add_priv; | |
1047 | gpgme_remove_io_cb_t remove; | |
1048 | gpgme_event_io_cb_t event; | |
1049 | void *event_priv; | |
1050 | }; | |
1051 | typedef struct gpgme_io_cbs *gpgme_io_cbs_t; | |
1052 | ||
1053 | /* Set the I/O callback functions in CTX to IO_CBS. */ | |
1054 | void gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs); | |
1055 | ||
1056 | /* Get the current I/O callback functions. */ | |
1057 | void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs); | |
1058 | ||
1059 | /* Wrappers around the internal I/O functions for use with | |
1060 | gpgme_passphrase_cb_t and gpgme_interact_cb_t. */ | |
1061 | @API__SSIZE_T@ gpgme_io_read (int fd, void *buffer, size_t count); | |
1062 | @API__SSIZE_T@ gpgme_io_write (int fd, const void *buffer, size_t count); | |
1063 | int gpgme_io_writen (int fd, const void *buffer, size_t count); | |
1064 | ||
1065 | /* Process the pending operation and, if HANG is non-zero, wait for | |
1066 | the pending operation to finish. */ | |
1067 | gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang); | |
1068 | ||
1069 | gpgme_ctx_t gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status, | |
1070 | gpgme_error_t *op_err, int hang); | |
1071 | ||
1072 | /* Cancel a pending asynchronous operation. */ | |
1073 | gpgme_error_t gpgme_cancel (gpgme_ctx_t ctx); | |
1074 | ||
1075 | /* Cancel a pending operation asynchronously. */ | |
1076 | gpgme_error_t gpgme_cancel_async (gpgme_ctx_t ctx); | |
1077 | ||
1078 | ||
1079 | ||
1080 | /* | |
1081 | * Functions to handle data objects. | |
1082 | */ | |
1083 | ||
1084 | /* Read up to SIZE bytes into buffer BUFFER from the data object with | |
1085 | the handle HANDLE. Return the number of characters read, 0 on EOF | |
1086 | and -1 on error. If an error occurs, errno is set. */ | |
1087 | typedef @API__SSIZE_T@ (*gpgme_data_read_cb_t) (void *handle, void *buffer, | |
1088 | size_t size); | |
1089 | ||
1090 | /* Write up to SIZE bytes from buffer BUFFER to the data object with | |
1091 | the handle HANDLE. Return the number of characters written, or -1 | |
1092 | on error. If an error occurs, errno is set. */ | |
1093 | typedef @API__SSIZE_T@ (*gpgme_data_write_cb_t) (void *handle, const void *buffer, | |
1094 | size_t size); | |
1095 | ||
1096 | /* Set the current position from where the next read or write starts | |
1097 | in the data object with the handle HANDLE to OFFSET, relativ to | |
1098 | WHENCE. Returns the new offset in bytes from the beginning of the | |
1099 | data object. */ | |
1100 | typedef @API__OFF_T@ (*gpgme_data_seek_cb_t) (void *handle, | |
1101 | @API__OFF_T@ offset, int whence); | |
1102 | ||
1103 | /* Close the data object with the handle HANDLE. */ | |
1104 | typedef void (*gpgme_data_release_cb_t) (void *handle); | |
1105 | ||
1106 | struct gpgme_data_cbs | |
1107 | { | |
1108 | gpgme_data_read_cb_t read; | |
1109 | gpgme_data_write_cb_t write; | |
1110 | gpgme_data_seek_cb_t seek; | |
1111 | gpgme_data_release_cb_t release; | |
1112 | }; | |
1113 | typedef struct gpgme_data_cbs *gpgme_data_cbs_t; | |
1114 | ||
1115 | /* Read up to SIZE bytes into buffer BUFFER from the data object with | |
1116 | the handle DH. Return the number of characters read, 0 on EOF and | |
1117 | -1 on error. If an error occurs, errno is set. */ | |
1118 | @API__SSIZE_T@ gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size); | |
1119 | ||
1120 | /* Write up to SIZE bytes from buffer BUFFER to the data object with | |
1121 | the handle DH. Return the number of characters written, or -1 on | |
1122 | error. If an error occurs, errno is set. */ | |
1123 | @API__SSIZE_T@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size); | |
1124 | ||
1125 | /* Set the current position from where the next read or write starts | |
1126 | in the data object with the handle DH to OFFSET, relativ to WHENCE. | |
1127 | Returns the new offset in bytes from the beginning of the data | |
1128 | object. */ | |
1129 | @API__OFF_T@ gpgme_data_seek (gpgme_data_t dh, @API__OFF_T@ offset, int whence); | |
1130 | ||
1131 | /* Create a new data buffer and return it in R_DH. */ | |
1132 | gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh); | |
1133 | ||
1134 | /* Destroy the data buffer DH. */ | |
1135 | void gpgme_data_release (gpgme_data_t dh); | |
1136 | ||
1137 | /* Create a new data buffer filled with SIZE bytes starting from | |
1138 | BUFFER. If COPY is zero, copying is delayed until necessary, and | |
1139 | the data is taken from the original location when needed. */ | |
1140 | gpgme_error_t gpgme_data_new_from_mem (gpgme_data_t *r_dh, | |
1141 | const char *buffer, size_t size, | |
1142 | int copy); | |
1143 | ||
1144 | /* Destroy the data buffer DH and return a pointer to its content. | |
1145 | The memory has be to released with gpgme_free() by the user. It's | |
1146 | size is returned in R_LEN. */ | |
1147 | char *gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len); | |
1148 | ||
1149 | /* Release the memory returned by gpgme_data_release_and_get_mem() and | |
1150 | some other functions. */ | |
1151 | void gpgme_free (void *buffer); | |
1152 | ||
1153 | gpgme_error_t gpgme_data_new_from_cbs (gpgme_data_t *dh, | |
1154 | gpgme_data_cbs_t cbs, | |
1155 | void *handle); | |
1156 | ||
1157 | gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *dh, int fd); | |
1158 | ||
1159 | gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *dh, FILE *stream); | |
1160 | ||
1161 | /* Return the encoding attribute of the data buffer DH */ | |
1162 | gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh); | |
1163 | ||
1164 | /* Set the encoding attribute of data buffer DH to ENC */ | |
1165 | gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh, | |
1166 | gpgme_data_encoding_t enc); | |
1167 | ||
1168 | /* Get the file name associated with the data object with handle DH, or | |
1169 | NULL if there is none. */ | |
1170 | char *gpgme_data_get_file_name (gpgme_data_t dh); | |
1171 | ||
1172 | /* Set the file name associated with the data object with handle DH to | |
1173 | FILE_NAME. */ | |
1174 | gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh, | |
1175 | const char *file_name); | |
1176 | ||
1177 | /* Set a flag for the data object DH. See the manual for details. */ | |
1178 | gpg_error_t gpgme_data_set_flag (gpgme_data_t dh, | |
1179 | const char *name, const char *value); | |
1180 | ||
1181 | /* Try to identify the type of the data in DH. */ | |
1182 | gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved); | |
1183 | ||
1184 | ||
1185 | /* Create a new data buffer filled with the content of file FNAME. | |
1186 | COPY must be non-zero. For delayed read, please use | |
1187 | gpgme_data_new_from_fd or gpgme_data_new_from_stream instead. */ | |
1188 | gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh, | |
1189 | const char *fname, | |
1190 | int copy); | |
1191 | ||
1192 | /* Create a new data buffer filled with LENGTH bytes starting from | |
1193 | OFFSET within the file FNAME or stream FP (exactly one must be | |
1194 | non-zero). */ | |
1195 | gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh, | |
1196 | const char *fname, FILE *fp, | |
1197 | @API__OFF_T@ offset, size_t length); | |
1198 | ||
1199 | /* Convenience function to do a gpgme_data_seek (dh, 0, SEEK_SET). */ | |
1200 | gpgme_error_t gpgme_data_rewind (gpgme_data_t dh); | |
1201 | ||
1202 | ||
1203 | ||
1204 | /* | |
1205 | * Key and trust functions. | |
1206 | */ | |
1207 | ||
1208 | /* Get the key with the fingerprint FPR from the crypto backend. If | |
1209 | SECRET is true, get the secret key. */ | |
1210 | gpgme_error_t gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, | |
1211 | gpgme_key_t *r_key, int secret); | |
1212 | ||
1213 | /* Create a dummy key to specify an email address. */ | |
1214 | gpgme_error_t gpgme_key_from_uid (gpgme_key_t *key, const char *name); | |
1215 | ||
1216 | /* Acquire a reference to KEY. */ | |
1217 | void gpgme_key_ref (gpgme_key_t key); | |
1218 | ||
1219 | /* Release a reference to KEY. If this was the last one the key is | |
1220 | destroyed. */ | |
1221 | void gpgme_key_unref (gpgme_key_t key); | |
1222 | void gpgme_key_release (gpgme_key_t key); | |
1223 | ||
1224 | ||
1225 | ||
1226 | /* | |
1227 | * Encryption. | |
1228 | */ | |
1229 | ||
1230 | /* An object to return results from an encryption operation. | |
1231 | * This structure shall be considered read-only and an application | |
1232 | * must not allocate such a structure on its own. */ | |
1233 | struct _gpgme_op_encrypt_result | |
1234 | { | |
1235 | /* The list of invalid recipients. */ | |
1236 | gpgme_invalid_key_t invalid_recipients; | |
1237 | }; | |
1238 | typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t; | |
1239 | ||
1240 | /* Retrieve a pointer to the result of the encrypt operation. */ | |
1241 | gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx); | |
1242 | ||
1243 | /* The valid encryption flags. */ | |
1244 | typedef enum | |
1245 | { | |
1246 | GPGME_ENCRYPT_ALWAYS_TRUST = 1, | |
1247 | GPGME_ENCRYPT_NO_ENCRYPT_TO = 2, | |
1248 | GPGME_ENCRYPT_PREPARE = 4, | |
1249 | GPGME_ENCRYPT_EXPECT_SIGN = 8, | |
1250 | GPGME_ENCRYPT_NO_COMPRESS = 16, | |
1251 | GPGME_ENCRYPT_SYMMETRIC = 32, | |
1252 | GPGME_ENCRYPT_THROW_KEYIDS = 64, | |
1253 | GPGME_ENCRYPT_WRAP = 128 | |
1254 | } | |
1255 | gpgme_encrypt_flags_t; | |
1256 | ||
1257 | /* Encrypt plaintext PLAIN within CTX for the recipients RECP and | |
1258 | store the resulting ciphertext in CIPHER. */ | |
1259 | gpgme_error_t gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[], | |
1260 | gpgme_encrypt_flags_t flags, | |
1261 | gpgme_data_t plain, gpgme_data_t cipher); | |
1262 | gpgme_error_t gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[], | |
1263 | gpgme_encrypt_flags_t flags, | |
1264 | gpgme_data_t plain, gpgme_data_t cipher); | |
1265 | ||
1266 | /* Encrypt plaintext PLAIN within CTX for the recipients RECP and | |
1267 | store the resulting ciphertext in CIPHER. Also sign the ciphertext | |
1268 | with the signers in CTX. */ | |
1269 | gpgme_error_t gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx, | |
1270 | gpgme_key_t recp[], | |
1271 | gpgme_encrypt_flags_t flags, | |
1272 | gpgme_data_t plain, | |
1273 | gpgme_data_t cipher); | |
1274 | gpgme_error_t gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[], | |
1275 | gpgme_encrypt_flags_t flags, | |
1276 | gpgme_data_t plain, gpgme_data_t cipher); | |
1277 | ||
1278 | ||
1279 | /* | |
1280 | * Decryption. | |
1281 | */ | |
1282 | ||
1283 | /* An object to hold information about a recipient. | |
1284 | * This structure shall be considered read-only and an application | |
1285 | * must not allocate such a structure on its own. */ | |
1286 | struct _gpgme_recipient | |
1287 | { | |
1288 | struct _gpgme_recipient *next; | |
1289 | ||
1290 | /* The key ID of key for which the text was encrypted. */ | |
1291 | char *keyid; | |
1292 | ||
1293 | /* Internal to GPGME, do not use. */ | |
1294 | char _keyid[16 + 1]; | |
1295 | ||
1296 | /* The public key algorithm of the recipient key. */ | |
1297 | gpgme_pubkey_algo_t pubkey_algo; | |
1298 | ||
1299 | /* The status of the recipient. */ | |
1300 | gpgme_error_t status; | |
1301 | }; | |
1302 | typedef struct _gpgme_recipient *gpgme_recipient_t; | |
1303 | ||
1304 | /* An object to return results from a decryption operation. | |
1305 | * This structure shall be considered read-only and an application | |
1306 | * must not allocate such a structure on its own. */ | |
1307 | struct _gpgme_op_decrypt_result | |
1308 | { | |
1309 | char *unsupported_algorithm; | |
1310 | ||
1311 | /* Key should not have been used for encryption. */ | |
1312 | unsigned int wrong_key_usage : 1; | |
1313 | ||
1314 | /* Internal to GPGME, do not use. */ | |
1315 | int _unused : 31; | |
1316 | ||
1317 | gpgme_recipient_t recipients; | |
1318 | ||
1319 | /* The original file name of the plaintext message, if | |
1320 | available. */ | |
1321 | char *file_name; | |
1322 | ||
1323 | /* A textual representation of the session key used to decrypt the | |
1324 | * message, if available */ | |
1325 | char *session_key; | |
1326 | }; | |
1327 | typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t; | |
1328 | ||
1329 | /* Retrieve a pointer to the result of the decrypt operation. */ | |
1330 | gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t ctx); | |
1331 | ||
1332 | /* The valid decryption flags. */ | |
1333 | typedef enum | |
1334 | { | |
1335 | GPGME_DECRYPT_VERIFY = 1, | |
1336 | GPGME_DECRYPT_UNWRAP = 128 | |
1337 | } | |
1338 | gpgme_decrypt_flags_t; | |
1339 | ||
1340 | /* Decrypt ciphertext CIPHER within CTX and store the resulting | |
1341 | plaintext in PLAIN. */ | |
1342 | gpgme_error_t gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher, | |
1343 | gpgme_data_t plain); | |
1344 | gpgme_error_t gpgme_op_decrypt (gpgme_ctx_t ctx, | |
1345 | gpgme_data_t cipher, gpgme_data_t plain); | |
1346 | ||
1347 | /* Decrypt ciphertext CIPHER and make a signature verification within | |
1348 | CTX and store the resulting plaintext in PLAIN. */ | |
1349 | gpgme_error_t gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, | |
1350 | gpgme_data_t cipher, | |
1351 | gpgme_data_t plain); | |
1352 | gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher, | |
1353 | gpgme_data_t plain); | |
1354 | ||
1355 | /* Decrypt ciphertext CIPHER within CTX and store the resulting | |
1356 | * plaintext in PLAIN. With the flag GPGME_DECRYPT_VERIFY also do a | |
1357 | * signature verification pn the plaintext. */ | |
1358 | gpgme_error_t gpgme_op_decrypt_ext_start (gpgme_ctx_t ctx, | |
1359 | gpgme_decrypt_flags_t flags, | |
1360 | gpgme_data_t cipher, | |
1361 | gpgme_data_t plain); | |
1362 | gpgme_error_t gpgme_op_decrypt_ext (gpgme_ctx_t ctx, | |
1363 | gpgme_decrypt_flags_t flags, | |
1364 | gpgme_data_t cipher, | |
1365 | gpgme_data_t plain); | |
1366 | ||
1367 | ||
1368 | ||
1369 | /* | |
1370 | * Signing. | |
1371 | */ | |
1372 | ||
1373 | /* An object with signatures data. | |
1374 | * This structure shall be considered read-only and an application | |
1375 | * must not allocate such a structure on its own. */ | |
1376 | struct _gpgme_new_signature | |
1377 | { | |
1378 | struct _gpgme_new_signature *next; | |
1379 | ||
1380 | /* The type of the signature. */ | |
1381 | gpgme_sig_mode_t type; | |
1382 | ||
1383 | /* The public key algorithm used to create the signature. */ | |
1384 | gpgme_pubkey_algo_t pubkey_algo; | |
1385 | ||
1386 | /* The hash algorithm used to create the signature. */ | |
1387 | gpgme_hash_algo_t hash_algo; | |
1388 | ||
1389 | /* Internal to GPGME, do not use. Must be set to the same value as | |
1390 | CLASS below. */ | |
1391 | unsigned long _obsolete_class; | |
1392 | ||
1393 | /* Signature creation time. */ | |
1394 | long int timestamp; | |
1395 | ||
1396 | /* The fingerprint of the signature. */ | |
1397 | char *fpr; | |
1398 | ||
1399 | #ifdef __cplusplus | |
1400 | unsigned int _obsolete_class_2; | |
1401 | #else | |
1402 | /* Must be set to SIG_CLASS below. */ | |
1403 | unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME(0,4); | |
1404 | #endif | |
1405 | ||
1406 | /* Crypto backend specific signature class. */ | |
1407 | unsigned int sig_class; | |
1408 | }; | |
1409 | typedef struct _gpgme_new_signature *gpgme_new_signature_t; | |
1410 | ||
1411 | ||
1412 | /* An object to return results from a signing operation. | |
1413 | * This structure shall be considered read-only and an application | |
1414 | * must not allocate such a structure on its own. */ | |
1415 | struct _gpgme_op_sign_result | |
1416 | { | |
1417 | /* The list of invalid signers. */ | |
1418 | gpgme_invalid_key_t invalid_signers; | |
1419 | gpgme_new_signature_t signatures; | |
1420 | }; | |
1421 | typedef struct _gpgme_op_sign_result *gpgme_sign_result_t; | |
1422 | ||
1423 | /* Retrieve a pointer to the result of the signing operation. */ | |
1424 | gpgme_sign_result_t gpgme_op_sign_result (gpgme_ctx_t ctx); | |
1425 | ||
1426 | /* Sign the plaintext PLAIN and store the signature in SIG. */ | |
1427 | gpgme_error_t gpgme_op_sign_start (gpgme_ctx_t ctx, | |
1428 | gpgme_data_t plain, gpgme_data_t sig, | |
1429 | gpgme_sig_mode_t mode); | |
1430 | gpgme_error_t gpgme_op_sign (gpgme_ctx_t ctx, | |
1431 | gpgme_data_t plain, gpgme_data_t sig, | |
1432 | gpgme_sig_mode_t mode); | |
1433 | ||
1434 | ||
1435 | /* | |
1436 | * Verify. | |
1437 | */ | |
1438 | ||
1439 | /* Flags used for the SUMMARY field in a gpgme_signature_t. */ | |
1440 | typedef enum | |
1441 | { | |
1442 | GPGME_SIGSUM_VALID = 0x0001, /* The signature is fully valid. */ | |
1443 | GPGME_SIGSUM_GREEN = 0x0002, /* The signature is good. */ | |
1444 | GPGME_SIGSUM_RED = 0x0004, /* The signature is bad. */ | |
1445 | GPGME_SIGSUM_KEY_REVOKED = 0x0010, /* One key has been revoked. */ | |
1446 | GPGME_SIGSUM_KEY_EXPIRED = 0x0020, /* One key has expired. */ | |
1447 | GPGME_SIGSUM_SIG_EXPIRED = 0x0040, /* The signature has expired. */ | |
1448 | GPGME_SIGSUM_KEY_MISSING = 0x0080, /* Can't verify: key missing. */ | |
1449 | GPGME_SIGSUM_CRL_MISSING = 0x0100, /* CRL not available. */ | |
1450 | GPGME_SIGSUM_CRL_TOO_OLD = 0x0200, /* Available CRL is too old. */ | |
1451 | GPGME_SIGSUM_BAD_POLICY = 0x0400, /* A policy was not met. */ | |
1452 | GPGME_SIGSUM_SYS_ERROR = 0x0800, /* A system error occurred. */ | |
1453 | GPGME_SIGSUM_TOFU_CONFLICT=0x1000 /* Tofu conflict detected. */ | |
1454 | } | |
1455 | gpgme_sigsum_t; | |
1456 | ||
1457 | ||
1458 | /* An object to hold the verification status of a signature. | |
1459 | * This structure shall be considered read-only and an application | |
1460 | * must not allocate such a structure on its own. */ | |
1461 | struct _gpgme_signature | |
1462 | { | |
1463 | struct _gpgme_signature *next; | |
1464 | ||
1465 | /* A summary of the signature status. */ | |
1466 | gpgme_sigsum_t summary; | |
1467 | ||
1468 | /* The fingerprint of the signature. This can be a subkey. */ | |
1469 | char *fpr; | |
1470 | ||
1471 | /* The status of the signature. */ | |
1472 | gpgme_error_t status; | |
1473 | ||
1474 | /* Notation data and policy URLs. */ | |
1475 | gpgme_sig_notation_t notations; | |
1476 | ||
1477 | /* Signature creation time. */ | |
1478 | unsigned long timestamp; | |
1479 | ||
1480 | /* Signature expiration time or 0. */ | |
1481 | unsigned long exp_timestamp; | |
1482 | ||
1483 | /* Key should not have been used for signing. */ | |
1484 | unsigned int wrong_key_usage : 1; | |
1485 | ||
1486 | /* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */ | |
1487 | unsigned int pka_trust : 2; | |
1488 | ||
1489 | /* Validity has been verified using the chain model. */ | |
1490 | unsigned int chain_model : 1; | |
1491 | ||
1492 | /* Internal to GPGME, do not use. */ | |
1493 | int _unused : 28; | |
1494 | ||
1495 | gpgme_validity_t validity; | |
1496 | gpgme_error_t validity_reason; | |
1497 | ||
1498 | /* The public key algorithm used to create the signature. */ | |
1499 | gpgme_pubkey_algo_t pubkey_algo; | |
1500 | ||
1501 | /* The hash algorithm used to create the signature. */ | |
1502 | gpgme_hash_algo_t hash_algo; | |
1503 | ||
1504 | /* The mailbox from the PKA information or NULL. */ | |
1505 | char *pka_address; | |
1506 | ||
1507 | /* If non-NULL, a possible incomplete key object with the data | |
1508 | * available for the signature. */ | |
1509 | gpgme_key_t key; | |
1510 | }; | |
1511 | typedef struct _gpgme_signature *gpgme_signature_t; | |
1512 | ||
1513 | /* An object to return the results of a verify operation. | |
1514 | * This structure shall be considered read-only and an application | |
1515 | * must not allocate such a structure on its own. */ | |
1516 | struct _gpgme_op_verify_result | |
1517 | { | |
1518 | gpgme_signature_t signatures; | |
1519 | ||
1520 | /* The original file name of the plaintext message, if | |
1521 | available. */ | |
1522 | char *file_name; | |
1523 | }; | |
1524 | typedef struct _gpgme_op_verify_result *gpgme_verify_result_t; | |
1525 | ||
1526 | /* Retrieve a pointer to the result of the verify operation. */ | |
1527 | gpgme_verify_result_t gpgme_op_verify_result (gpgme_ctx_t ctx); | |
1528 | ||
1529 | /* Verify within CTX that SIG is a valid signature for TEXT. */ | |
1530 | gpgme_error_t gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig, | |
1531 | gpgme_data_t signed_text, | |
1532 | gpgme_data_t plaintext); | |
1533 | gpgme_error_t gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig, | |
1534 | gpgme_data_t signed_text, | |
1535 | gpgme_data_t plaintext); | |
1536 | ||
1537 | ||
1538 | /* | |
1539 | * Import/Export | |
1540 | */ | |
1541 | ||
1542 | #define GPGME_IMPORT_NEW 1 /* The key was new. */ | |
1543 | #define GPGME_IMPORT_UID 2 /* The key contained new user IDs. */ | |
1544 | #define GPGME_IMPORT_SIG 4 /* The key contained new signatures. */ | |
1545 | #define GPGME_IMPORT_SUBKEY 8 /* The key contained new sub keys. */ | |
1546 | #define GPGME_IMPORT_SECRET 16 /* The key contained a secret key. */ | |
1547 | ||
1548 | ||
1549 | /* An object to hold results for one imported key. | |
1550 | * This structure shall be considered read-only and an application | |
1551 | * must not allocate such a structure on its own. */ | |
1552 | struct _gpgme_import_status | |
1553 | { | |
1554 | struct _gpgme_import_status *next; | |
1555 | ||
1556 | /* Fingerprint. */ | |
1557 | char *fpr; | |
1558 | ||
1559 | /* If a problem occurred, the reason why the key could not be | |
1560 | imported. Otherwise GPGME_No_Error. */ | |
1561 | gpgme_error_t result; | |
1562 | ||
1563 | /* The result of the import, the GPGME_IMPORT_* values bit-wise | |
1564 | ORed. 0 means the key was already known and no new components | |
1565 | have been added. */ | |
1566 | unsigned int status; | |
1567 | }; | |
1568 | typedef struct _gpgme_import_status *gpgme_import_status_t; | |
1569 | ||
1570 | /* Import result object. | |
1571 | * This structure shall be considered read-only and an application | |
1572 | * must not allocate such a structure on its own. */ | |
1573 | struct _gpgme_op_import_result | |
1574 | { | |
1575 | /* Number of considered keys. */ | |
1576 | int considered; | |
1577 | ||
1578 | /* Keys without user ID. */ | |
1579 | int no_user_id; | |
1580 | ||
1581 | /* Imported keys. */ | |
1582 | int imported; | |
1583 | ||
1584 | /* Imported RSA keys. */ | |
1585 | int imported_rsa; | |
1586 | ||
1587 | /* Unchanged keys. */ | |
1588 | int unchanged; | |
1589 | ||
1590 | /* Number of new user ids. */ | |
1591 | int new_user_ids; | |
1592 | ||
1593 | /* Number of new sub keys. */ | |
1594 | int new_sub_keys; | |
1595 | ||
1596 | /* Number of new signatures. */ | |
1597 | int new_signatures; | |
1598 | ||
1599 | /* Number of new revocations. */ | |
1600 | int new_revocations; | |
1601 | ||
1602 | /* Number of secret keys read. */ | |
1603 | int secret_read; | |
1604 | ||
1605 | /* Number of secret keys imported. */ | |
1606 | int secret_imported; | |
1607 | ||
1608 | /* Number of secret keys unchanged. */ | |
1609 | int secret_unchanged; | |
1610 | ||
1611 | /* Number of new keys skipped. */ | |
1612 | int skipped_new_keys; | |
1613 | ||
1614 | /* Number of keys not imported. */ | |
1615 | int not_imported; | |
1616 | ||
1617 | /* List of keys for which an import was attempted. */ | |
1618 | gpgme_import_status_t imports; | |
1619 | }; | |
1620 | typedef struct _gpgme_op_import_result *gpgme_import_result_t; | |
1621 | ||
1622 | /* Retrieve a pointer to the result of the import operation. */ | |
1623 | gpgme_import_result_t gpgme_op_import_result (gpgme_ctx_t ctx); | |
1624 | ||
1625 | /* Import the key in KEYDATA into the keyring. */ | |
1626 | gpgme_error_t gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata); | |
1627 | gpgme_error_t gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata); | |
1628 | ||
1629 | /* Import the keys from the array KEYS into the keyring. */ | |
1630 | gpgme_error_t gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t keys[]); | |
1631 | gpgme_error_t gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t keys[]); | |
1632 | ||
1633 | ||
1634 | /* Export the keys found by PATTERN into KEYDATA. */ | |
1635 | gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern, | |
1636 | gpgme_export_mode_t mode, | |
1637 | gpgme_data_t keydata); | |
1638 | gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, | |
1639 | gpgme_export_mode_t mode, | |
1640 | gpgme_data_t keydata); | |
1641 | ||
1642 | gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx, | |
1643 | const char *pattern[], | |
1644 | gpgme_export_mode_t mode, | |
1645 | gpgme_data_t keydata); | |
1646 | gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], | |
1647 | gpgme_export_mode_t mode, | |
1648 | gpgme_data_t keydata); | |
1649 | ||
1650 | /* Export the keys from the array KEYS into KEYDATA. */ | |
1651 | gpgme_error_t gpgme_op_export_keys_start (gpgme_ctx_t ctx, | |
1652 | gpgme_key_t keys[], | |
1653 | gpgme_export_mode_t mode, | |
1654 | gpgme_data_t keydata); | |
1655 | gpgme_error_t gpgme_op_export_keys (gpgme_ctx_t ctx, | |
1656 | gpgme_key_t keys[], | |
1657 | gpgme_export_mode_t mode, | |
1658 | gpgme_data_t keydata); | |
1659 | ||
1660 | ||
1661 | ||
1662 | /* | |
1663 | * Key generation. | |
1664 | */ | |
1665 | ||
1666 | /* Flags for the key creation functions. */ | |
1667 | #define GPGME_CREATE_SIGN (1 << 0) /* Allow usage: signing. */ | |
1668 | #define GPGME_CREATE_ENCR (1 << 1) /* Allow usage: encryption. */ | |
1669 | #define GPGME_CREATE_CERT (1 << 2) /* Allow usage: certification. */ | |
1670 | #define GPGME_CREATE_AUTH (1 << 3) /* Allow usage: authentication. */ | |
1671 | #define GPGME_CREATE_NOPASSWD (1 << 7) /* Create w/o passphrase. */ | |
1672 | #define GPGME_CREATE_SELFSIGNED (1 << 8) /* Create self-signed cert. */ | |
1673 | #define GPGME_CREATE_NOSTORE (1 << 9) /* Do not store the key. */ | |
1674 | #define GPGME_CREATE_WANTPUB (1 << 10) /* Return the public key. */ | |
1675 | #define GPGME_CREATE_WANTSEC (1 << 11) /* Return the secret key. */ | |
1676 | #define GPGME_CREATE_FORCE (1 << 12) /* Force creation. */ | |
1677 | #define GPGME_CREATE_NOEXPIRE (1 << 13) /* Create w/o expiration. */ | |
1678 | ||
1679 | /* An object to return result from a key generation. | |
1680 | * This structure shall be considered read-only and an application | |
1681 | * must not allocate such a structure on its own. */ | |
1682 | struct _gpgme_op_genkey_result | |
1683 | { | |
1684 | /* A primary key was generated. */ | |
1685 | unsigned int primary : 1; | |
1686 | ||
1687 | /* A sub key was generated. */ | |
1688 | unsigned int sub : 1; | |
1689 | ||
1690 | /* A user id was generated. */ | |
1691 | unsigned int uid : 1; | |
1692 | ||
1693 | /* Internal to GPGME, do not use. */ | |
1694 | unsigned int _unused : 29; | |
1695 | ||
1696 | /* The fingerprint of the generated key. */ | |
1697 | char *fpr; | |
1698 | ||
1699 | /* A memory data object with the created public key. Only set when | |
1700 | * GPGME_CREATE_WANTPUB has been used. */ | |
1701 | gpgme_data_t pubkey; | |
1702 | ||
1703 | /* A memory data object with the created secret key. Only set when | |
1704 | * GPGME_CREATE_WANTSEC has been used. */ | |
1705 | gpgme_data_t seckey; | |
1706 | }; | |
1707 | typedef struct _gpgme_op_genkey_result *gpgme_genkey_result_t; | |
1708 | ||
1709 | /* Generate a new keypair and add it to the keyring. PUBKEY and | |
1710 | SECKEY should be null for now. PARMS specifies what keys should be | |
1711 | generated. */ | |
1712 | gpgme_error_t gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms, | |
1713 | gpgme_data_t pubkey, gpgme_data_t seckey); | |
1714 | gpgme_error_t gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms, | |
1715 | gpgme_data_t pubkey, gpgme_data_t seckey); | |
1716 | ||
1717 | /* Generate a key pair using the modern interface. */ | |
1718 | gpgme_error_t gpgme_op_createkey_start (gpgme_ctx_t ctx, | |
1719 | const char *userid, | |
1720 | const char *algo, | |
1721 | unsigned long reserved, | |
1722 | unsigned long expires, | |
1723 | gpgme_key_t certkey, | |
1724 | unsigned int flags); | |
1725 | gpgme_error_t gpgme_op_createkey (gpgme_ctx_t ctx, | |
1726 | const char *userid, | |
1727 | const char *algo, | |
1728 | unsigned long reserved, | |
1729 | unsigned long expires, | |
1730 | gpgme_key_t certkey, | |
1731 | unsigned int flags); | |
1732 | /* Add a new subkey to KEY. */ | |
1733 | gpgme_error_t gpgme_op_createsubkey_start (gpgme_ctx_t ctx, | |
1734 | gpgme_key_t key, | |
1735 | const char *algo, | |
1736 | unsigned long reserved, | |
1737 | unsigned long expires, | |
1738 | unsigned int flags); | |
1739 | gpgme_error_t gpgme_op_createsubkey (gpgme_ctx_t ctx, | |
1740 | gpgme_key_t key, | |
1741 | const char *algo, | |
1742 | unsigned long reserved, | |
1743 | unsigned long expires, | |
1744 | unsigned int flags); | |
1745 | ||
1746 | /* Add USERID to an existing KEY. */ | |
1747 | gpgme_error_t gpgme_op_adduid_start (gpgme_ctx_t ctx, | |
1748 | gpgme_key_t key, const char *userid, | |
1749 | unsigned int reserved); | |
1750 | gpgme_error_t gpgme_op_adduid (gpgme_ctx_t ctx, | |
1751 | gpgme_key_t key, const char *userid, | |
1752 | unsigned int reserved); | |
1753 | ||
1754 | /* Revoke a USERID from a KEY. */ | |
1755 | gpgme_error_t gpgme_op_revuid_start (gpgme_ctx_t ctx, | |
1756 | gpgme_key_t key, const char *userid, | |
1757 | unsigned int reserved); | |
1758 | gpgme_error_t gpgme_op_revuid (gpgme_ctx_t ctx, | |
1759 | gpgme_key_t key, const char *userid, | |
1760 | unsigned int reserved); | |
1761 | ||
1762 | /* Set a flag on the USERID of KEY. See the manual for supported flags. */ | |
1763 | gpgme_error_t gpgme_op_set_uid_flag_start (gpgme_ctx_t ctx, | |
1764 | gpgme_key_t key, const char *userid, | |
1765 | const char *name, const char *value); | |
1766 | gpgme_error_t gpgme_op_set_uid_flag (gpgme_ctx_t ctx, | |
1767 | gpgme_key_t key, const char *userid, | |
1768 | const char *name, const char *value); | |
1769 | ||
1770 | ||
1771 | /* Retrieve a pointer to the result of a genkey, createkey, or | |
1772 | * createsubkey operation. */ | |
1773 | gpgme_genkey_result_t gpgme_op_genkey_result (gpgme_ctx_t ctx); | |
1774 | ||
1775 | ||
1776 | /* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret | |
1777 | keys are also deleted. */ | |
1778 | gpgme_error_t gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key, | |
1779 | int allow_secret); | |
1780 | gpgme_error_t gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key, | |
1781 | int allow_secret); | |
1782 | ||
1783 | ||
1784 | /* | |
1785 | * Key signing interface | |
1786 | */ | |
1787 | ||
1788 | /* Flags for the key signing functions. */ | |
1789 | #define GPGME_KEYSIGN_LOCAL (1 << 7) /* Create a local signature. */ | |
1790 | #define GPGME_KEYSIGN_LFSEP (1 << 8) /* Indicate LF separated user ids. */ | |
1791 | #define GPGME_KEYSIGN_NOEXPIRE (1 << 9) /* Force no expiration. */ | |
1792 | ||
1793 | ||
1794 | /* Sign the USERID of KEY using the current set of signers. */ | |
1795 | gpgme_error_t gpgme_op_keysign_start (gpgme_ctx_t ctx, | |
1796 | gpgme_key_t key, const char *userid, | |
1797 | unsigned long expires, | |
1798 | unsigned int flags); | |
1799 | gpgme_error_t gpgme_op_keysign (gpgme_ctx_t ctx, | |
1800 | gpgme_key_t key, const char *userid, | |
1801 | unsigned long expires, | |
1802 | unsigned int flags); | |
1803 | ||
1804 | ||
1805 | ||
1806 | ||
1807 | /* | |
1808 | * Key edit interface | |
1809 | */ | |
1810 | ||
1811 | /* Flags to select the mode of the interact. */ | |
1812 | #define GPGME_INTERACT_CARD (1 << 0) /* Use --card-edit mode. */ | |
1813 | ||
1814 | ||
1815 | /* Edit the KEY. Send status and command requests to FNC and | |
1816 | output of edit commands to OUT. */ | |
1817 | gpgme_error_t gpgme_op_interact_start (gpgme_ctx_t ctx, | |
1818 | gpgme_key_t key, | |
1819 | unsigned int flags, | |
1820 | gpgme_interact_cb_t fnc, | |
1821 | void *fnc_value, | |
1822 | gpgme_data_t out); | |
1823 | gpgme_error_t gpgme_op_interact (gpgme_ctx_t ctx, gpgme_key_t key, | |
1824 | unsigned int flags, | |
1825 | gpgme_interact_cb_t fnc, | |
1826 | void *fnc_value, | |
1827 | gpgme_data_t out); | |
1828 | ||
1829 | ||
1830 | /* Set the Tofu policy of KEY to POLCIY. */ | |
1831 | gpgme_error_t gpgme_op_tofu_policy_start (gpgme_ctx_t ctx, | |
1832 | gpgme_key_t key, | |
1833 | gpgme_tofu_policy_t policy); | |
1834 | gpgme_error_t gpgme_op_tofu_policy (gpgme_ctx_t ctx, | |
1835 | gpgme_key_t key, | |
1836 | gpgme_tofu_policy_t policy); | |
1837 | ||
1838 | ||
1839 | ||
1840 | ||
1841 | /* | |
1842 | * Key listing | |
1843 | */ | |
1844 | ||
1845 | /* An object to return results from a key listing operation. | |
1846 | * This structure shall be considered read-only and an application | |
1847 | * must not allocate such a structure on its own. */ | |
1848 | struct _gpgme_op_keylist_result | |
1849 | { | |
1850 | unsigned int truncated : 1; | |
1851 | ||
1852 | /* Internal to GPGME, do not use. */ | |
1853 | unsigned int _unused : 31; | |
1854 | }; | |
1855 | typedef struct _gpgme_op_keylist_result *gpgme_keylist_result_t; | |
1856 | ||
1857 | /* Retrieve a pointer to the result of the key listing operation. */ | |
1858 | gpgme_keylist_result_t gpgme_op_keylist_result (gpgme_ctx_t ctx); | |
1859 | ||
1860 | /* Start a keylist operation within CTX, searching for keys which | |
1861 | * match PATTERN. If SECRET_ONLY is true, only secret keys are | |
1862 | * returned. */ | |
1863 | gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern, | |
1864 | int secret_only); | |
1865 | gpgme_error_t gpgme_op_keylist_ext_start (gpgme_ctx_t ctx, | |
1866 | const char *pattern[], | |
1867 | int secret_only, int reserved); | |
1868 | ||
1869 | /* List the keys contained in DATA. */ | |
1870 | gpgme_error_t gpgme_op_keylist_from_data_start (gpgme_ctx_t ctx, | |
1871 | gpgme_data_t data, | |
1872 | int reserved); | |
1873 | ||
1874 | /* Return the next key from the keylist in R_KEY. */ | |
1875 | gpgme_error_t gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key); | |
1876 | ||
1877 | /* Terminate a pending keylist operation within CTX. */ | |
1878 | gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx); | |
1879 | ||
1880 | ||
1881 | ||
1882 | /* | |
1883 | * Protecting keys | |
1884 | */ | |
1885 | ||
1886 | /* Change the passphrase for KEY. FLAGS is reserved for future use | |
1887 | and must be passed as 0. */ | |
1888 | gpgme_error_t gpgme_op_passwd_start (gpgme_ctx_t ctx, gpgme_key_t key, | |
1889 | unsigned int flags); | |
1890 | gpgme_error_t gpgme_op_passwd (gpgme_ctx_t ctx, gpgme_key_t key, | |
1891 | unsigned int flags); | |
1892 | ||
1893 | ||
1894 | ||
1895 | /* | |
1896 | * Trust items and operations. | |
1897 | */ | |
1898 | ||
1899 | /* An object to hold data of a trust item. | |
1900 | * This structure shall be considered read-only and an application | |
1901 | * must not allocate such a structure on its own. */ | |
1902 | struct _gpgme_trust_item | |
1903 | { | |
1904 | /* Internal to GPGME, do not use. */ | |
1905 | unsigned int _refs; | |
1906 | ||
1907 | /* The key ID to which the trust item belongs. */ | |
1908 | char *keyid; | |
1909 | ||
1910 | /* Internal to GPGME, do not use. */ | |
1911 | char _keyid[16 + 1]; | |
1912 | ||
1913 | /* The type of the trust item, 1 refers to a key, 2 to a user ID. */ | |
1914 | int type; | |
1915 | ||
1916 | /* The trust level. */ | |
1917 | int level; | |
1918 | ||
1919 | /* The owner trust if TYPE is 1. */ | |
1920 | char *owner_trust; | |
1921 | ||
1922 | /* Internal to GPGME, do not use. */ | |
1923 | char _owner_trust[2]; | |
1924 | ||
1925 | /* The calculated validity. */ | |
1926 | char *validity; | |
1927 | ||
1928 | /* Internal to GPGME, do not use. */ | |
1929 | char _validity[2]; | |
1930 | ||
1931 | /* The user name if TYPE is 2. */ | |
1932 | char *name; | |
1933 | }; | |
1934 | typedef struct _gpgme_trust_item *gpgme_trust_item_t; | |
1935 | ||
1936 | /* Start a trustlist operation within CTX, searching for trust items | |
1937 | which match PATTERN. */ | |
1938 | gpgme_error_t gpgme_op_trustlist_start (gpgme_ctx_t ctx, | |
1939 | const char *pattern, int max_level); | |
1940 | ||
1941 | /* Return the next trust item from the trustlist in R_ITEM. */ | |
1942 | gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx, | |
1943 | gpgme_trust_item_t *r_item); | |
1944 | ||
1945 | /* Terminate a pending trustlist operation within CTX. */ | |
1946 | gpgme_error_t gpgme_op_trustlist_end (gpgme_ctx_t ctx); | |
1947 | ||
1948 | /* Acquire a reference to ITEM. */ | |
1949 | void gpgme_trust_item_ref (gpgme_trust_item_t item); | |
1950 | ||
1951 | /* Release a reference to ITEM. If this was the last one the trust | |
1952 | item is destroyed. */ | |
1953 | void gpgme_trust_item_unref (gpgme_trust_item_t item); | |
1954 | ||
1955 | ||
1956 | ||
1957 | /* | |
1958 | * Audit log | |
1959 | */ | |
1960 | ||
1961 | /* Return the auditlog for the current session. This may be called | |
1962 | after a successful or failed operation. If no audit log is | |
1963 | available GPG_ERR_NO_DATA is returned. */ | |
1964 | gpgme_error_t gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output, | |
1965 | unsigned int flags); | |
1966 | gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, | |
1967 | unsigned int flags); | |
1968 | ||
1969 | ||
1970 | ||
1971 | /* | |
1972 | * Spawn interface | |
1973 | */ | |
1974 | ||
1975 | /* Flags for the spawn operations. */ | |
1976 | #define GPGME_SPAWN_DETACHED 1 | |
1977 | #define GPGME_SPAWN_ALLOW_SET_FG 2 | |
1978 | ||
1979 | ||
1980 | /* Run the command FILE with the arguments in ARGV. Connect stdin to | |
1981 | DATAIN, stdout to DATAOUT, and STDERR to DATAERR. If one the data | |
1982 | streams is NULL, connect to /dev/null instead. */ | |
1983 | gpgme_error_t gpgme_op_spawn_start (gpgme_ctx_t ctx, | |
1984 | const char *file, const char *argv[], | |
1985 | gpgme_data_t datain, | |
1986 | gpgme_data_t dataout, gpgme_data_t dataerr, | |
1987 | unsigned int flags); | |
1988 | gpgme_error_t gpgme_op_spawn (gpgme_ctx_t ctx, | |
1989 | const char *file, const char *argv[], | |
1990 | gpgme_data_t datain, | |
1991 | gpgme_data_t dataout, gpgme_data_t dataerr, | |
1992 | unsigned int flags); | |
1993 | ||
1994 | ||
1995 | /* | |
1996 | * Low-level Assuan protocol access. | |
1997 | */ | |
1998 | typedef gpgme_error_t (*gpgme_assuan_data_cb_t) | |
1999 | (void *opaque, const void *data, size_t datalen); | |
2000 | ||
2001 | typedef gpgme_error_t (*gpgme_assuan_inquire_cb_t) | |
2002 | (void *opaque, const char *name, const char *args, | |
2003 | gpgme_data_t *r_data); | |
2004 | ||
2005 | typedef gpgme_error_t (*gpgme_assuan_status_cb_t) | |
2006 | (void *opaque, const char *status, const char *args); | |
2007 | ||
2008 | /* Send the Assuan COMMAND and return results via the callbacks. | |
2009 | Asynchronous variant. */ | |
2010 | gpgme_error_t gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, | |
2011 | const char *command, | |
2012 | gpgme_assuan_data_cb_t data_cb, | |
2013 | void *data_cb_value, | |
2014 | gpgme_assuan_inquire_cb_t inq_cb, | |
2015 | void *inq_cb_value, | |
2016 | gpgme_assuan_status_cb_t stat_cb, | |
2017 | void *stat_cb_value); | |
2018 | ||
2019 | /* Send the Assuan COMMAND and return results via the callbacks. | |
2020 | Synchronous variant. */ | |
2021 | gpgme_error_t gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, | |
2022 | const char *command, | |
2023 | gpgme_assuan_data_cb_t data_cb, | |
2024 | void *data_cb_value, | |
2025 | gpgme_assuan_inquire_cb_t inq_cb, | |
2026 | void *inq_cb_value, | |
2027 | gpgme_assuan_status_cb_t stat_cb, | |
2028 | void *stat_cb_value, | |
2029 | gpgme_error_t *op_err); | |
2030 | ||
2031 | ||
2032 | /* | |
2033 | * Crypto container support. | |
2034 | */ | |
2035 | ||
2036 | /* An object to return results from a VFS mount operation. | |
2037 | * This structure shall be considered read-only and an application | |
2038 | * must not allocate such a structure on its own. */ | |
2039 | struct _gpgme_op_vfs_mount_result | |
2040 | { | |
2041 | char *mount_dir; | |
2042 | }; | |
2043 | typedef struct _gpgme_op_vfs_mount_result *gpgme_vfs_mount_result_t; | |
2044 | ||
2045 | gpgme_vfs_mount_result_t gpgme_op_vfs_mount_result (gpgme_ctx_t ctx); | |
2046 | ||
2047 | /* The container is automatically unmounted when the context is reset | |
2048 | or destroyed. Transmission errors are returned directly, | |
2049 | operational errors are returned in OP_ERR. */ | |
2050 | gpgme_error_t gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file, | |
2051 | const char *mount_dir, unsigned int flags, | |
2052 | gpgme_error_t *op_err); | |
2053 | ||
2054 | gpgme_error_t gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[], | |
2055 | const char *container_file, | |
2056 | unsigned int flags, gpgme_error_t *op_err); | |
2057 | ||
2058 | ||
2059 | /* | |
2060 | * Interface to gpgconf(1). | |
2061 | */ | |
2062 | ||
2063 | /* The expert level at which a configuration option or group of | |
2064 | options should be displayed. See the gpgconf(1) documentation for | |
2065 | more details. */ | |
2066 | typedef enum | |
2067 | { | |
2068 | GPGME_CONF_BASIC = 0, | |
2069 | GPGME_CONF_ADVANCED = 1, | |
2070 | GPGME_CONF_EXPERT = 2, | |
2071 | GPGME_CONF_INVISIBLE = 3, | |
2072 | GPGME_CONF_INTERNAL = 4 | |
2073 | } | |
2074 | gpgme_conf_level_t; | |
2075 | ||
2076 | ||
2077 | /* The data type of a configuration option argument. See the gpgconf(1) | |
2078 | documentation for more details. */ | |
2079 | typedef enum | |
2080 | { | |
2081 | /* Basic types. */ | |
2082 | GPGME_CONF_NONE = 0, | |
2083 | GPGME_CONF_STRING = 1, | |
2084 | GPGME_CONF_INT32 = 2, | |
2085 | GPGME_CONF_UINT32 = 3, | |
2086 | ||
2087 | /* Complex types. */ | |
2088 | GPGME_CONF_FILENAME = 32, | |
2089 | GPGME_CONF_LDAP_SERVER = 33, | |
2090 | GPGME_CONF_KEY_FPR = 34, | |
2091 | GPGME_CONF_PUB_KEY = 35, | |
2092 | GPGME_CONF_SEC_KEY = 36, | |
2093 | GPGME_CONF_ALIAS_LIST = 37 | |
2094 | } | |
2095 | gpgme_conf_type_t; | |
2096 | ||
2097 | /* For now, compatibility. */ | |
2098 | #define GPGME_CONF_PATHNAME GPGME_CONF_FILENAME | |
2099 | ||
2100 | ||
2101 | /* This represents a single argument for a configuration option. | |
2102 | Which of the members of value is used depends on the ALT_TYPE. */ | |
2103 | typedef struct gpgme_conf_arg | |
2104 | { | |
2105 | struct gpgme_conf_arg *next; | |
2106 | /* True if the option appears without an (optional) argument. */ | |
2107 | unsigned int no_arg; | |
2108 | union | |
2109 | { | |
2110 | unsigned int count; | |
2111 | unsigned int uint32; | |
2112 | int int32; | |
2113 | char *string; | |
2114 | } value; | |
2115 | } *gpgme_conf_arg_t; | |
2116 | ||
2117 | ||
2118 | /* The flags of a configuration option. See the gpgconf | |
2119 | documentation for details. */ | |
2120 | #define GPGME_CONF_GROUP (1 << 0) | |
2121 | #define GPGME_CONF_OPTIONAL (1 << 1) | |
2122 | #define GPGME_CONF_LIST (1 << 2) | |
2123 | #define GPGME_CONF_RUNTIME (1 << 3) | |
2124 | #define GPGME_CONF_DEFAULT (1 << 4) | |
2125 | #define GPGME_CONF_DEFAULT_DESC (1 << 5) | |
2126 | #define GPGME_CONF_NO_ARG_DESC (1 << 6) | |
2127 | #define GPGME_CONF_NO_CHANGE (1 << 7) | |
2128 | ||
2129 | ||
2130 | /* The representation of a single configuration option. See the | |
2131 | gpg-conf documentation for details. */ | |
2132 | typedef struct gpgme_conf_opt | |
2133 | { | |
2134 | struct gpgme_conf_opt *next; | |
2135 | ||
2136 | /* The option name. */ | |
2137 | char *name; | |
2138 | ||
2139 | /* The flags for this option. */ | |
2140 | unsigned int flags; | |
2141 | ||
2142 | /* The level of this option. */ | |
2143 | gpgme_conf_level_t level; | |
2144 | ||
2145 | /* The localized description of this option. */ | |
2146 | char *description; | |
2147 | ||
2148 | /* The type and alternate type of this option. */ | |
2149 | gpgme_conf_type_t type; | |
2150 | gpgme_conf_type_t alt_type; | |
2151 | ||
2152 | /* The localized (short) name of the argument, if any. */ | |
2153 | char *argname; | |
2154 | ||
2155 | /* The default value. */ | |
2156 | gpgme_conf_arg_t default_value; | |
2157 | char *default_description; | |
2158 | ||
2159 | /* The default value if the option is not set. */ | |
2160 | gpgme_conf_arg_t no_arg_value; | |
2161 | char *no_arg_description; | |
2162 | ||
2163 | /* The current value if the option is set. */ | |
2164 | gpgme_conf_arg_t value; | |
2165 | ||
2166 | /* The new value, if any. NULL means reset to default. */ | |
2167 | int change_value; | |
2168 | gpgme_conf_arg_t new_value; | |
2169 | ||
2170 | /* Free for application use. */ | |
2171 | void *user_data; | |
2172 | } *gpgme_conf_opt_t; | |
2173 | ||
2174 | ||
2175 | /* The representation of a component that can be configured. See the | |
2176 | gpg-conf documentation for details. */ | |
2177 | typedef struct gpgme_conf_comp | |
2178 | { | |
2179 | struct gpgme_conf_comp *next; | |
2180 | ||
2181 | /* Internal to GPGME, do not use! */ | |
2182 | gpgme_conf_opt_t *_last_opt_p; | |
2183 | ||
2184 | /* The component name. */ | |
2185 | char *name; | |
2186 | ||
2187 | /* A human-readable description for the component. */ | |
2188 | char *description; | |
2189 | ||
2190 | /* The program name (an absolute path to the program). */ | |
2191 | char *program_name; | |
2192 | ||
2193 | /* A linked list of options for this component. */ | |
2194 | struct gpgme_conf_opt *options; | |
2195 | } *gpgme_conf_comp_t; | |
2196 | ||
2197 | ||
2198 | /* Allocate a new gpgme_conf_arg_t. If VALUE is NULL, a "no arg | |
2199 | default" is prepared. If type is a string type, VALUE should point | |
2200 | to the string. Else, it should point to an unsigned or signed | |
2201 | integer respectively. */ | |
2202 | gpgme_error_t gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p, | |
2203 | gpgme_conf_type_t type, const void *value); | |
2204 | ||
2205 | /* This also releases all chained argument structures! */ | |
2206 | void gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type); | |
2207 | ||
2208 | /* Register a change for the value of OPT to ARG. If RESET is 1 (do | |
2209 | not use any values but 0 or 1), ARG is ignored and the option is | |
2210 | not changed (reverting a previous change). Otherwise, if ARG is | |
2211 | NULL, the option is cleared or reset to its default. The change | |
2212 | is done with gpgconf's --runtime option to immediately take effect. */ | |
2213 | gpgme_error_t gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, | |
2214 | gpgme_conf_arg_t arg); | |
2215 | ||
2216 | /* Release a set of configurations. */ | |
2217 | void gpgme_conf_release (gpgme_conf_comp_t conf); | |
2218 | ||
2219 | /* Retrieve the current configurations. */ | |
2220 | gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p); | |
2221 | ||
2222 | /* Save the configuration of component comp. This function does not | |
2223 | follow chained components! */ | |
2224 | gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp); | |
2225 | ||
2226 | ||
2227 | /* Information about software versions. | |
2228 | * This structure shall be considered read-only and an application | |
2229 | * must not allocate such a structure on its own. */ | |
2230 | typedef struct _gpgme_op_query_swdb_result | |
2231 | { | |
2232 | /* RFU */ | |
2233 | struct _gpgme_op_query_swdb_result *next; | |
2234 | ||
2235 | /* The name of the package (e.g. "gpgme", "gnupg") */ | |
2236 | char *name; | |
2237 | ||
2238 | /* The version number of the installed version. */ | |
2239 | char *iversion; | |
2240 | ||
2241 | /* The time the online info was created. */ | |
2242 | unsigned long created; | |
2243 | ||
2244 | /* The time the online info was retrieved. */ | |
2245 | unsigned long retrieved; | |
2246 | ||
2247 | /* This bit is set if an error occured or some of the information | |
2248 | * in this structure may not be set. */ | |
2249 | unsigned int warning : 1; | |
2250 | ||
2251 | /* An update is available. */ | |
2252 | unsigned int update : 1; | |
2253 | ||
2254 | /* The update is important. */ | |
2255 | unsigned int urgent : 1; | |
2256 | ||
2257 | /* No information at all available. */ | |
2258 | unsigned int noinfo : 1; | |
2259 | ||
2260 | /* The package name is not known. */ | |
2261 | unsigned int unknown : 1; | |
2262 | ||
2263 | /* The information here is too old. */ | |
2264 | unsigned int tooold : 1; | |
2265 | ||
2266 | /* Other error. */ | |
2267 | unsigned int error : 1; | |
2268 | ||
2269 | unsigned int _reserved : 25; | |
2270 | ||
2271 | /* The version number of the latest released version. */ | |
2272 | char *version; | |
2273 | ||
2274 | /* The release date of that version. */ | |
2275 | unsigned long reldate; | |
2276 | ||
2277 | } *gpgme_query_swdb_result_t; | |
2278 | ||
2279 | ||
2280 | /* Run the gpgconf --query-swdb command. */ | |
2281 | gpgme_error_t gpgme_op_query_swdb (gpgme_ctx_t ctx, | |
2282 | const char *name, const char *iversion, | |
2283 | unsigned int reserved); | |
2284 | ||
2285 | /* Return the result from the last query_swdb operation. */ | |
2286 | gpgme_query_swdb_result_t gpgme_op_query_swdb_result (gpgme_ctx_t ctx); | |
2287 | ||
2288 | ||
2289 | ||
2290 | ||
2291 | /* | |
2292 | * Various functions. | |
2293 | */ | |
2294 | ||
2295 | /* Set special global flags; consult the manual before use. */ | |
2296 | int gpgme_set_global_flag (const char *name, const char *value); | |
2297 | ||
2298 | /* Check that the library fulfills the version requirement. Note: | |
2299 | This is here only for the case where a user takes a pointer from | |
2300 | the old version of this function. The new version and macro for | |
2301 | run-time checks are below. */ | |
2302 | const char *gpgme_check_version (const char *req_version); | |
2303 | ||
2304 | /* Check that the library fulfills the version requirement and check | |
2305 | for struct layout mismatch involving bitfields. */ | |
2306 | const char *gpgme_check_version_internal (const char *req_version, | |
2307 | size_t offset_sig_validity); | |
2308 | ||
2309 | #define gpgme_check_version(req_version) \ | |
2310 | gpgme_check_version_internal (req_version, \ | |
2311 | offsetof (struct _gpgme_signature, validity)) | |
2312 | ||
2313 | /* Return the default values for various directories. */ | |
2314 | const char *gpgme_get_dirinfo (const char *what); | |
2315 | ||
2316 | /* Get the information about the configured and installed engines. A | |
2317 | pointer to the first engine in the statically allocated linked list | |
2318 | is returned in *INFO. If an error occurs, it is returned. The | |
2319 | returned data is valid until the next gpgme_set_engine_info. */ | |
2320 | gpgme_error_t gpgme_get_engine_info (gpgme_engine_info_t *engine_info); | |
2321 | ||
2322 | /* Set the default engine info for the protocol PROTO to the file name | |
2323 | FILE_NAME and the home directory HOME_DIR. */ | |
2324 | gpgme_error_t gpgme_set_engine_info (gpgme_protocol_t proto, | |
2325 | const char *file_name, | |
2326 | const char *home_dir); | |
2327 | ||
2328 | /* Verify that the engine implementing PROTO is installed and | |
2329 | available. */ | |
2330 | gpgme_error_t gpgme_engine_check_version (gpgme_protocol_t proto); | |
2331 | ||
2332 | ||
2333 | /* Reference counting for result objects. */ | |
2334 | void gpgme_result_ref (void *result); | |
2335 | void gpgme_result_unref (void *result); | |
2336 | ||
2337 | /* Return a public key algorithm string (e.g. "rsa2048"). Caller must | |
2338 | free using gpgme_free. */ | |
2339 | char *gpgme_pubkey_algo_string (gpgme_subkey_t subkey); | |
2340 | ||
2341 | /* Return a statically allocated string with the name of the public | |
2342 | key algorithm ALGO, or NULL if that name is not known. */ | |
2343 | const char *gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo); | |
2344 | ||
2345 | /* Return a statically allocated string with the name of the hash | |
2346 | algorithm ALGO, or NULL if that name is not known. */ | |
2347 | const char *gpgme_hash_algo_name (gpgme_hash_algo_t algo); | |
2348 | ||
2349 | /* Return the addr-spec from a user id. Caller must free the result | |
2350 | * with gpgme_free. */ | |
2351 | char *gpgme_addrspec_from_uid (const char *uid); | |
2352 | ||
2353 | ||
2354 | ||
2355 | /* | |
2356 | * Deprecated types, constants and functions. | |
2357 | */ | |
448 | 2358 | |
449 | 2359 | /* The possible stati for gpgme_op_edit. The use of that function and |
450 | 2360 | * these status codes are deprecated in favor of gpgme_op_interact. */ |
561 | 2471 | } |
562 | 2472 | gpgme_status_code_t; |
563 | 2473 | |
564 | ||
565 | /* The available signature notation flags. */ | |
566 | #define GPGME_SIG_NOTATION_HUMAN_READABLE 1 | |
567 | #define GPGME_SIG_NOTATION_CRITICAL 2 | |
568 | ||
569 | typedef unsigned int gpgme_sig_notation_flags_t; | |
570 | ||
571 | struct _gpgme_sig_notation | |
572 | { | |
573 | struct _gpgme_sig_notation *next; | |
574 | ||
575 | /* If NAME is a null pointer, then VALUE contains a policy URL | |
576 | rather than a notation. */ | |
577 | char *name; | |
578 | ||
579 | /* The value of the notation data. */ | |
580 | char *value; | |
581 | ||
582 | /* The length of the name of the notation data. */ | |
583 | int name_len; | |
584 | ||
585 | /* The length of the value of the notation data. */ | |
586 | int value_len; | |
587 | ||
588 | /* The accumulated flags. */ | |
589 | gpgme_sig_notation_flags_t flags; | |
590 | ||
591 | /* Notation data is human-readable. */ | |
592 | unsigned int human_readable : 1; | |
593 | ||
594 | /* Notation data is critical. */ | |
595 | unsigned int critical : 1; | |
596 | ||
597 | /* Internal to GPGME, do not use. */ | |
598 | int _unused : 30; | |
599 | }; | |
600 | typedef struct _gpgme_sig_notation *gpgme_sig_notation_t; | |
601 | ||
602 | ||
603 | ||
604 | /* | |
605 | * Public structures. | |
606 | */ | |
607 | ||
608 | /* The engine information structure. */ | |
609 | struct _gpgme_engine_info | |
610 | { | |
611 | struct _gpgme_engine_info *next; | |
612 | ||
613 | /* The protocol ID. */ | |
614 | gpgme_protocol_t protocol; | |
615 | ||
616 | /* The file name of the engine binary. */ | |
617 | char *file_name; | |
618 | ||
619 | /* The version string of the installed engine. */ | |
620 | char *version; | |
621 | ||
622 | /* The minimum version required for GPGME. */ | |
623 | const char *req_version; | |
624 | ||
625 | /* The home directory used, or NULL if default. */ | |
626 | char *home_dir; | |
627 | }; | |
628 | typedef struct _gpgme_engine_info *gpgme_engine_info_t; | |
629 | ||
630 | ||
631 | /* An object with TOFU information. */ | |
632 | struct _gpgme_tofu_info | |
633 | { | |
634 | struct _gpgme_tofu_info *next; | |
635 | ||
636 | /* The TOFU validity: | |
637 | * 0 := conflict | |
638 | * 1 := key without history | |
639 | * 2 := key with too little history | |
640 | * 3 := key with enough history for basic trust | |
641 | * 4 := key with a lot of history | |
642 | */ | |
643 | unsigned int validity : 3; | |
644 | ||
645 | /* The TOFU policy (gpgme_tofu_policy_t). */ | |
646 | unsigned int policy : 4; | |
647 | ||
648 | unsigned int _rfu : 25; | |
649 | ||
650 | /* Number of signatures seen for this binding. Capped at USHRT_MAX. */ | |
651 | unsigned short signcount; | |
652 | /* Number of encryptions done with this binding. Capped at USHRT_MAX. */ | |
653 | unsigned short encrcount; | |
654 | ||
655 | /* Number of seconds since Epoch when the first and the most | |
656 | * recently seen message were verified/decrypted. 0 means unknown. */ | |
657 | unsigned long signfirst; | |
658 | unsigned long signlast; | |
659 | unsigned long encrfirst; | |
660 | unsigned long encrlast; | |
661 | ||
662 | /* If non-NULL a human readable string summarizing the TOFU data. */ | |
663 | char *description; | |
664 | }; | |
665 | typedef struct _gpgme_tofu_info *gpgme_tofu_info_t; | |
666 | ||
667 | ||
668 | /* A subkey from a key. */ | |
669 | struct _gpgme_subkey | |
670 | { | |
671 | struct _gpgme_subkey *next; | |
672 | ||
673 | /* True if subkey is revoked. */ | |
674 | unsigned int revoked : 1; | |
675 | ||
676 | /* True if subkey is expired. */ | |
677 | unsigned int expired : 1; | |
678 | ||
679 | /* True if subkey is disabled. */ | |
680 | unsigned int disabled : 1; | |
681 | ||
682 | /* True if subkey is invalid. */ | |
683 | unsigned int invalid : 1; | |
684 | ||
685 | /* True if subkey can be used for encryption. */ | |
686 | unsigned int can_encrypt : 1; | |
687 | ||
688 | /* True if subkey can be used for signing. */ | |
689 | unsigned int can_sign : 1; | |
690 | ||
691 | /* True if subkey can be used for certification. */ | |
692 | unsigned int can_certify : 1; | |
693 | ||
694 | /* True if subkey is secret. */ | |
695 | unsigned int secret : 1; | |
696 | ||
697 | /* True if subkey can be used for authentication. */ | |
698 | unsigned int can_authenticate : 1; | |
699 | ||
700 | /* True if subkey is qualified for signatures according to German law. */ | |
701 | unsigned int is_qualified : 1; | |
702 | ||
703 | /* True if the secret key is stored on a smart card. */ | |
704 | unsigned int is_cardkey : 1; | |
705 | ||
706 | /* Internal to GPGME, do not use. */ | |
707 | unsigned int _unused : 21; | |
708 | ||
709 | /* Public key algorithm supported by this subkey. */ | |
710 | gpgme_pubkey_algo_t pubkey_algo; | |
711 | ||
712 | /* Length of the subkey. */ | |
713 | unsigned int length; | |
714 | ||
715 | /* The key ID of the subkey. */ | |
716 | char *keyid; | |
717 | ||
718 | /* Internal to GPGME, do not use. */ | |
719 | char _keyid[16 + 1]; | |
720 | ||
721 | /* The fingerprint of the subkey in hex digit form. */ | |
722 | char *fpr; | |
723 | ||
724 | /* The creation timestamp, -1 if invalid, 0 if not available. */ | |
725 | long int timestamp; | |
726 | ||
727 | /* The expiration timestamp, 0 if the subkey does not expire. */ | |
728 | long int expires; | |
729 | ||
730 | /* The serial number of a smart card holding this key or NULL. */ | |
731 | char *card_number; | |
732 | ||
733 | /* The name of the curve for ECC algorithms or NULL. */ | |
734 | char *curve; | |
735 | ||
736 | /* The keygrip of the subkey in hex digit form or NULL if not availabale. */ | |
737 | char *keygrip; | |
738 | }; | |
739 | typedef struct _gpgme_subkey *gpgme_subkey_t; | |
740 | ||
741 | ||
742 | /* A signature on a user ID. */ | |
743 | struct _gpgme_key_sig | |
744 | { | |
745 | struct _gpgme_key_sig *next; | |
746 | ||
747 | /* True if the signature is a revocation signature. */ | |
748 | unsigned int revoked : 1; | |
749 | ||
750 | /* True if the signature is expired. */ | |
751 | unsigned int expired : 1; | |
752 | ||
753 | /* True if the signature is invalid. */ | |
754 | unsigned int invalid : 1; | |
755 | ||
756 | /* True if the signature should be exported. */ | |
757 | unsigned int exportable : 1; | |
758 | ||
759 | /* Internal to GPGME, do not use. */ | |
760 | unsigned int _unused : 28; | |
761 | ||
762 | /* The public key algorithm used to create the signature. */ | |
763 | gpgme_pubkey_algo_t pubkey_algo; | |
764 | ||
765 | /* The key ID of key used to create the signature. */ | |
766 | char *keyid; | |
767 | ||
768 | /* Internal to GPGME, do not use. */ | |
769 | char _keyid[16 + 1]; | |
770 | ||
771 | /* The creation timestamp, -1 if invalid, 0 if not available. */ | |
772 | long int timestamp; | |
773 | ||
774 | /* The expiration timestamp, 0 if the subkey does not expire. */ | |
775 | long int expires; | |
776 | ||
777 | /* Same as in gpgme_signature_t. */ | |
778 | gpgme_error_t status; | |
779 | ||
780 | #ifdef __cplusplus | |
781 | unsigned int _obsolete_class _GPGME_DEPRECATED(0,4); | |
782 | #else | |
783 | /* Must be set to SIG_CLASS below. */ | |
784 | unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME(0,4); | |
785 | #endif | |
786 | ||
787 | /* The user ID string. */ | |
788 | char *uid; | |
789 | ||
790 | /* The name part of the user ID. */ | |
791 | char *name; | |
792 | ||
793 | /* The email part of the user ID. */ | |
794 | char *email; | |
795 | ||
796 | /* The comment part of the user ID. */ | |
797 | char *comment; | |
798 | ||
799 | /* Crypto backend specific signature class. */ | |
800 | unsigned int sig_class; | |
801 | ||
802 | /* Notation data and policy URLs. */ | |
803 | gpgme_sig_notation_t notations; | |
804 | ||
805 | /* Internal to GPGME, do not use. */ | |
806 | gpgme_sig_notation_t _last_notation; | |
807 | }; | |
808 | typedef struct _gpgme_key_sig *gpgme_key_sig_t; | |
809 | ||
810 | ||
811 | /* An user ID from a key. */ | |
812 | struct _gpgme_user_id | |
813 | { | |
814 | struct _gpgme_user_id *next; | |
815 | ||
816 | /* True if the user ID is revoked. */ | |
817 | unsigned int revoked : 1; | |
818 | ||
819 | /* True if the user ID is invalid. */ | |
820 | unsigned int invalid : 1; | |
821 | ||
822 | /* Internal to GPGME, do not use. */ | |
823 | unsigned int _unused : 30; | |
824 | ||
825 | /* The validity of the user ID. */ | |
826 | gpgme_validity_t validity; | |
827 | ||
828 | /* The user ID string. */ | |
829 | char *uid; | |
830 | ||
831 | /* The name part of the user ID. */ | |
832 | char *name; | |
833 | ||
834 | /* The email part of the user ID. */ | |
835 | char *email; | |
836 | ||
837 | /* The comment part of the user ID. */ | |
838 | char *comment; | |
839 | ||
840 | /* The signatures of the user ID. */ | |
841 | gpgme_key_sig_t signatures; | |
842 | ||
843 | /* Internal to GPGME, do not use. */ | |
844 | gpgme_key_sig_t _last_keysig; | |
845 | ||
846 | /* The mail address (addr-spec from RFC5322) of the UID string. | |
847 | * This is general the same as the EMAIL part of this struct but | |
848 | * might be slightly different. If no mail address is available | |
849 | * NULL is stored. */ | |
850 | char *address; | |
851 | ||
852 | /* The malloced TOFU information or NULL. */ | |
853 | gpgme_tofu_info_t tofu; | |
854 | }; | |
855 | typedef struct _gpgme_user_id *gpgme_user_id_t; | |
856 | ||
857 | ||
858 | /* A key from the keyring. */ | |
859 | struct _gpgme_key | |
860 | { | |
861 | /* Internal to GPGME, do not use. */ | |
862 | unsigned int _refs; | |
863 | ||
864 | /* True if key is revoked. */ | |
865 | unsigned int revoked : 1; | |
866 | ||
867 | /* True if key is expired. */ | |
868 | unsigned int expired : 1; | |
869 | ||
870 | /* True if key is disabled. */ | |
871 | unsigned int disabled : 1; | |
872 | ||
873 | /* True if key is invalid. */ | |
874 | unsigned int invalid : 1; | |
875 | ||
876 | /* True if key can be used for encryption. */ | |
877 | unsigned int can_encrypt : 1; | |
878 | ||
879 | /* True if key can be used for signing. */ | |
880 | unsigned int can_sign : 1; | |
881 | ||
882 | /* True if key can be used for certification. */ | |
883 | unsigned int can_certify : 1; | |
884 | ||
885 | /* True if key is secret. */ | |
886 | unsigned int secret : 1; | |
887 | ||
888 | /* True if key can be used for authentication. */ | |
889 | unsigned int can_authenticate : 1; | |
890 | ||
891 | /* True if subkey is qualified for signatures according to German law. */ | |
892 | unsigned int is_qualified : 1; | |
893 | ||
894 | /* Internal to GPGME, do not use. */ | |
895 | unsigned int _unused : 22; | |
896 | ||
897 | /* This is the protocol supported by this key. */ | |
898 | gpgme_protocol_t protocol; | |
899 | ||
900 | /* If protocol is GPGME_PROTOCOL_CMS, this string contains the | |
901 | issuer serial. */ | |
902 | char *issuer_serial; | |
903 | ||
904 | /* If protocol is GPGME_PROTOCOL_CMS, this string contains the | |
905 | issuer name. */ | |
906 | char *issuer_name; | |
907 | ||
908 | /* If protocol is GPGME_PROTOCOL_CMS, this string contains the chain | |
909 | ID. */ | |
910 | char *chain_id; | |
911 | ||
912 | /* If protocol is GPGME_PROTOCOL_OpenPGP, this field contains the | |
913 | owner trust. */ | |
914 | gpgme_validity_t owner_trust; | |
915 | ||
916 | /* The subkeys of the key. */ | |
917 | gpgme_subkey_t subkeys; | |
918 | ||
919 | /* The user IDs of the key. */ | |
920 | gpgme_user_id_t uids; | |
921 | ||
922 | /* Internal to GPGME, do not use. */ | |
923 | gpgme_subkey_t _last_subkey; | |
924 | ||
925 | /* Internal to GPGME, do not use. */ | |
926 | gpgme_user_id_t _last_uid; | |
927 | ||
928 | /* The keylist mode that was active when listing the key. */ | |
929 | gpgme_keylist_mode_t keylist_mode; | |
930 | ||
931 | /* This field gives the fingerprint of the primary key. Note that | |
932 | * this is a copy of the FPR of the first subkey. We need it here | |
933 | * to allow for an incomplete key object. */ | |
934 | char *fpr; | |
935 | }; | |
936 | typedef struct _gpgme_key *gpgme_key_t; | |
937 | ||
938 | ||
939 | /* An invalid key object. */ | |
940 | struct _gpgme_invalid_key | |
941 | { | |
942 | struct _gpgme_invalid_key *next; | |
943 | ||
944 | /* The string used to request the key. Despite the name this may | |
945 | * not be a fingerprint. */ | |
946 | char *fpr; | |
947 | ||
948 | /* The error code. */ | |
949 | gpgme_error_t reason; | |
950 | }; | |
951 | typedef struct _gpgme_invalid_key *gpgme_invalid_key_t; | |
952 | ||
953 | ||
954 | ||
955 | /* | |
956 | * Types for callback functions. | |
957 | */ | |
958 | ||
959 | /* Request a passphrase from the user. */ | |
960 | typedef gpgme_error_t (*gpgme_passphrase_cb_t) (void *hook, | |
961 | const char *uid_hint, | |
962 | const char *passphrase_info, | |
963 | int prev_was_bad, int fd); | |
964 | ||
965 | /* Inform the user about progress made. */ | |
966 | typedef void (*gpgme_progress_cb_t) (void *opaque, const char *what, | |
967 | int type, int current, int total); | |
968 | ||
969 | /* Status messages from gpg. */ | |
970 | typedef gpgme_error_t (*gpgme_status_cb_t) (void *opaque, const char *keyword, | |
971 | const char *args); | |
972 | ||
973 | /* Interact with the user about an edit operation. */ | |
974 | typedef gpgme_error_t (*gpgme_interact_cb_t) (void *opaque, | |
975 | const char *keyword, | |
976 | const char *args, int fd); | |
977 | ||
978 | 2474 | /* The callback type used by the deprecated functions gpgme_op_edit |
979 | 2475 | * and gpgme_op_card_edit. */ |
980 | 2476 | typedef gpgme_error_t (*gpgme_edit_cb_t) (void *opaque, |
981 | 2477 | gpgme_status_code_t status, |
982 | 2478 | const char *args, int fd); |
983 | ||
984 | ||
985 | ||
986 | ||
987 | /* | |
988 | * Context management functions. | |
989 | */ | |
990 | ||
991 | /* Create a new context and return it in CTX. */ | |
992 | gpgme_error_t gpgme_new (gpgme_ctx_t *ctx); | |
993 | ||
994 | /* Release the context CTX. */ | |
995 | void gpgme_release (gpgme_ctx_t ctx); | |
996 | ||
997 | /* Set the flag NAME for CTX to VALUE. */ | |
998 | gpgme_error_t gpgme_set_ctx_flag (gpgme_ctx_t ctx, | |
999 | const char *name, const char *value); | |
1000 | ||
1001 | /* Get the value of the flag NAME from CTX. */ | |
1002 | const char *gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name); | |
1003 | ||
1004 | /* Set the protocol to be used by CTX to PROTO. */ | |
1005 | gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto); | |
1006 | ||
1007 | /* Get the protocol used with CTX */ | |
1008 | gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx); | |
1009 | ||
1010 | /* Set the crypto protocol to be used by CTX to PROTO. | |
1011 | gpgme_set_protocol actually sets the backend engine. This sets the | |
1012 | crypto protocol used in engines that support more than one crypto | |
1013 | prococol (for example, an UISERVER can support OpenPGP and CMS). | |
1014 | This is reset to the default with gpgme_set_protocol. */ | |
1015 | gpgme_error_t gpgme_set_sub_protocol (gpgme_ctx_t ctx, | |
1016 | gpgme_protocol_t proto); | |
1017 | ||
1018 | /* Get the sub protocol. */ | |
1019 | gpgme_protocol_t gpgme_get_sub_protocol (gpgme_ctx_t ctx); | |
1020 | ||
1021 | /* Get the string describing protocol PROTO, or NULL if invalid. */ | |
1022 | const char *gpgme_get_protocol_name (gpgme_protocol_t proto); | |
1023 | ||
1024 | /* If YES is non-zero, enable armor mode in CTX, disable it otherwise. */ | |
1025 | void gpgme_set_armor (gpgme_ctx_t ctx, int yes); | |
1026 | ||
1027 | /* Return non-zero if armor mode is set in CTX. */ | |
1028 | int gpgme_get_armor (gpgme_ctx_t ctx); | |
1029 | ||
1030 | /* If YES is non-zero, enable text mode in CTX, disable it otherwise. */ | |
1031 | void gpgme_set_textmode (gpgme_ctx_t ctx, int yes); | |
1032 | ||
1033 | /* Return non-zero if text mode is set in CTX. */ | |
1034 | int gpgme_get_textmode (gpgme_ctx_t ctx); | |
1035 | ||
1036 | /* If YES is non-zero, enable offline mode in CTX, disable it otherwise. */ | |
1037 | void gpgme_set_offline (gpgme_ctx_t ctx, int yes); | |
1038 | ||
1039 | /* Return non-zero if offline mode is set in CTX. */ | |
1040 | int gpgme_get_offline (gpgme_ctx_t ctx); | |
1041 | ||
1042 | /* Use whatever the default of the backend crypto engine is. */ | |
1043 | #define GPGME_INCLUDE_CERTS_DEFAULT -256 | |
1044 | ||
1045 | /* Include up to NR_OF_CERTS certificates in an S/MIME message. */ | |
1046 | void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs); | |
1047 | ||
1048 | /* Return the number of certs to include in an S/MIME message. */ | |
1049 | int gpgme_get_include_certs (gpgme_ctx_t ctx); | |
1050 | ||
1051 | /* Set keylist mode in CTX to MODE. */ | |
1052 | gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t ctx, | |
1053 | gpgme_keylist_mode_t mode); | |
1054 | ||
1055 | /* Get keylist mode in CTX. */ | |
1056 | gpgme_keylist_mode_t gpgme_get_keylist_mode (gpgme_ctx_t ctx); | |
1057 | ||
1058 | /* Set the pinentry mode for CTX to MODE. */ | |
1059 | gpgme_error_t gpgme_set_pinentry_mode (gpgme_ctx_t ctx, | |
1060 | gpgme_pinentry_mode_t mode); | |
1061 | ||
1062 | /* Get the pinentry mode of CTX. */ | |
1063 | gpgme_pinentry_mode_t gpgme_get_pinentry_mode (gpgme_ctx_t ctx); | |
1064 | ||
1065 | /* Set the passphrase callback function in CTX to CB. HOOK_VALUE is | |
1066 | passed as first argument to the passphrase callback function. */ | |
1067 | void gpgme_set_passphrase_cb (gpgme_ctx_t ctx, | |
1068 | gpgme_passphrase_cb_t cb, void *hook_value); | |
1069 | ||
1070 | /* Get the current passphrase callback function in *CB and the current | |
1071 | hook value in *HOOK_VALUE. */ | |
1072 | void gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *cb, | |
1073 | void **hook_value); | |
1074 | ||
1075 | /* Set the progress callback function in CTX to CB. HOOK_VALUE is | |
1076 | passed as first argument to the progress callback function. */ | |
1077 | void gpgme_set_progress_cb (gpgme_ctx_t c, gpgme_progress_cb_t cb, | |
1078 | void *hook_value); | |
1079 | ||
1080 | /* Get the current progress callback function in *CB and the current | |
1081 | hook value in *HOOK_VALUE. */ | |
1082 | void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *cb, | |
1083 | void **hook_value); | |
1084 | ||
1085 | /* Set the status callback function in CTX to CB. HOOK_VALUE is | |
1086 | passed as first argument to the status callback function. */ | |
1087 | void gpgme_set_status_cb (gpgme_ctx_t c, gpgme_status_cb_t cb, | |
1088 | void *hook_value); | |
1089 | ||
1090 | /* Get the current status callback function in *CB and the current | |
1091 | hook value in *HOOK_VALUE. */ | |
1092 | void gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *cb, | |
1093 | void **hook_value); | |
1094 | ||
1095 | /* This function sets the locale for the context CTX, or the default | |
1096 | locale if CTX is a null pointer. */ | |
1097 | gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category, | |
1098 | const char *value); | |
1099 | ||
1100 | /* Get the information about the configured engines. A pointer to the | |
1101 | first engine in the statically allocated linked list is returned. | |
1102 | The returned data is valid until the next gpgme_ctx_set_engine_info. */ | |
1103 | gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx); | |
1104 | ||
1105 | /* Set the engine info for the context CTX, protocol PROTO, to the | |
1106 | file name FILE_NAME and the home directory HOME_DIR. */ | |
1107 | gpgme_error_t gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, | |
1108 | gpgme_protocol_t proto, | |
1109 | const char *file_name, | |
1110 | const char *home_dir); | |
1111 | ||
1112 | /* Delete all signers from CTX. */ | |
1113 | void gpgme_signers_clear (gpgme_ctx_t ctx); | |
1114 | ||
1115 | /* Add KEY to list of signers in CTX. */ | |
1116 | gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key); | |
1117 | ||
1118 | /* Return the number of signers in CTX. */ | |
1119 | unsigned int gpgme_signers_count (const gpgme_ctx_t ctx); | |
1120 | ||
1121 | /* Return the SEQth signer's key in CTX. */ | |
1122 | gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq); | |
1123 | ||
1124 | /* Retrieve the signature status of signature IDX in CTX after a | |
1125 | successful verify operation in R_STAT (if non-null). The creation | |
1126 | time stamp of the signature is returned in R_CREATED (if non-null). | |
1127 | The function returns a string containing the fingerprint. | |
1128 | Deprecated, use verify result directly. */ | |
1129 | const char *gpgme_get_sig_status (gpgme_ctx_t ctx, int idx, | |
1130 | _gpgme_sig_stat_t *r_stat, | |
1131 | time_t *r_created) _GPGME_DEPRECATED(0,4); | |
1132 | ||
1133 | /* Retrieve certain attributes of a signature. IDX is the index | |
1134 | number of the signature after a successful verify operation. WHAT | |
1135 | is an attribute where GPGME_ATTR_EXPIRE is probably the most useful | |
1136 | one. WHATIDX is to be passed as 0 for most attributes . */ | |
1137 | unsigned long gpgme_get_sig_ulong_attr (gpgme_ctx_t c, int idx, | |
1138 | _gpgme_attr_t what, int whatidx) | |
1139 | _GPGME_DEPRECATED(0,4); | |
1140 | const char *gpgme_get_sig_string_attr (gpgme_ctx_t c, int idx, | |
1141 | _gpgme_attr_t what, int whatidx) | |
1142 | _GPGME_DEPRECATED(0,4); | |
1143 | ||
1144 | ||
1145 | /* Get the key used to create signature IDX in CTX and return it in | |
1146 | R_KEY. */ | |
1147 | gpgme_error_t gpgme_get_sig_key (gpgme_ctx_t ctx, int idx, gpgme_key_t *r_key) | |
1148 | _GPGME_DEPRECATED(0,4); | |
1149 | ||
1150 | ||
1151 | /* Clear all notation data from the context. */ | |
1152 | void gpgme_sig_notation_clear (gpgme_ctx_t ctx); | |
1153 | ||
1154 | /* Add the human-readable notation data with name NAME and value VALUE | |
1155 | to the context CTX, using the flags FLAGS. If NAME is NULL, then | |
1156 | VALUE should be a policy URL. The flag | |
1157 | GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation | |
1158 | data, and false for policy URLs. */ | |
1159 | gpgme_error_t gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name, | |
1160 | const char *value, | |
1161 | gpgme_sig_notation_flags_t flags); | |
1162 | ||
1163 | /* Get the sig notations for this context. */ | |
1164 | gpgme_sig_notation_t gpgme_sig_notation_get (gpgme_ctx_t ctx); | |
1165 | ||
1166 | /* Store a sender address in the context. */ | |
1167 | gpgme_error_t gpgme_set_sender (gpgme_ctx_t ctx, const char *address); | |
1168 | ||
1169 | /* Get the sender address from the context. */ | |
1170 | const char *gpgme_get_sender (gpgme_ctx_t ctx); | |
1171 | ||
1172 | ||
1173 | ||
1174 | /* | |
1175 | * Run control. | |
1176 | */ | |
1177 | ||
1178 | /* The type of an I/O callback function. */ | |
1179 | typedef gpgme_error_t (*gpgme_io_cb_t) (void *data, int fd); | |
1180 | ||
1181 | /* The type of a function that can register FNC as the I/O callback | |
1182 | function for the file descriptor FD with direction dir (0: for writing, | |
1183 | 1: for reading). FNC_DATA should be passed as DATA to FNC. The | |
1184 | function should return a TAG suitable for the corresponding | |
1185 | gpgme_remove_io_cb_t, and an error value. */ | |
1186 | typedef gpgme_error_t (*gpgme_register_io_cb_t) (void *data, int fd, int dir, | |
1187 | gpgme_io_cb_t fnc, | |
1188 | void *fnc_data, void **tag); | |
1189 | ||
1190 | /* The type of a function that can remove a previously registered I/O | |
1191 | callback function given TAG as returned by the register | |
1192 | function. */ | |
1193 | typedef void (*gpgme_remove_io_cb_t) (void *tag); | |
1194 | ||
1195 | typedef enum | |
1196 | { | |
1197 | GPGME_EVENT_START, | |
1198 | GPGME_EVENT_DONE, | |
1199 | GPGME_EVENT_NEXT_KEY, | |
1200 | GPGME_EVENT_NEXT_TRUSTITEM | |
1201 | } | |
1202 | gpgme_event_io_t; | |
1203 | ||
1204 | struct gpgme_io_event_done_data | |
1205 | { | |
1206 | /* A fatal IPC error or an operational error in state-less | |
1207 | protocols. */ | |
1208 | gpgme_error_t err; | |
1209 | ||
1210 | /* An operational errors in session-based protocols. */ | |
1211 | gpgme_error_t op_err; | |
1212 | }; | |
1213 | typedef struct gpgme_io_event_done_data *gpgme_io_event_done_data_t; | |
1214 | ||
1215 | /* The type of a function that is called when a context finished an | |
1216 | operation. */ | |
1217 | typedef void (*gpgme_event_io_cb_t) (void *data, gpgme_event_io_t type, | |
1218 | void *type_data); | |
1219 | ||
1220 | struct gpgme_io_cbs | |
1221 | { | |
1222 | gpgme_register_io_cb_t add; | |
1223 | void *add_priv; | |
1224 | gpgme_remove_io_cb_t remove; | |
1225 | gpgme_event_io_cb_t event; | |
1226 | void *event_priv; | |
1227 | }; | |
1228 | typedef struct gpgme_io_cbs *gpgme_io_cbs_t; | |
1229 | ||
1230 | /* Set the I/O callback functions in CTX to IO_CBS. */ | |
1231 | void gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs); | |
1232 | ||
1233 | /* Get the current I/O callback functions. */ | |
1234 | void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs); | |
1235 | ||
1236 | /* Wrappers around the internal I/O functions for use with | |
1237 | gpgme_passphrase_cb_t and gpgme_interact_cb_t. */ | |
1238 | @API__SSIZE_T@ gpgme_io_read (int fd, void *buffer, size_t count); | |
1239 | @API__SSIZE_T@ gpgme_io_write (int fd, const void *buffer, size_t count); | |
1240 | int gpgme_io_writen (int fd, const void *buffer, size_t count); | |
1241 | ||
1242 | /* Process the pending operation and, if HANG is non-zero, wait for | |
1243 | the pending operation to finish. */ | |
1244 | gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang); | |
1245 | ||
1246 | gpgme_ctx_t gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status, | |
1247 | gpgme_error_t *op_err, int hang); | |
1248 | ||
1249 | /* Cancel a pending asynchronous operation. */ | |
1250 | gpgme_error_t gpgme_cancel (gpgme_ctx_t ctx); | |
1251 | ||
1252 | /* Cancel a pending operation asynchronously. */ | |
1253 | gpgme_error_t gpgme_cancel_async (gpgme_ctx_t ctx); | |
1254 | ||
1255 | ||
1256 | ||
1257 | /* | |
1258 | * Functions to handle data objects. | |
1259 | */ | |
1260 | ||
1261 | /* Read up to SIZE bytes into buffer BUFFER from the data object with | |
1262 | the handle HANDLE. Return the number of characters read, 0 on EOF | |
1263 | and -1 on error. If an error occurs, errno is set. */ | |
1264 | typedef @API__SSIZE_T@ (*gpgme_data_read_cb_t) (void *handle, void *buffer, | |
1265 | size_t size); | |
1266 | ||
1267 | /* Write up to SIZE bytes from buffer BUFFER to the data object with | |
1268 | the handle HANDLE. Return the number of characters written, or -1 | |
1269 | on error. If an error occurs, errno is set. */ | |
1270 | typedef @API__SSIZE_T@ (*gpgme_data_write_cb_t) (void *handle, const void *buffer, | |
1271 | size_t size); | |
1272 | ||
1273 | /* Set the current position from where the next read or write starts | |
1274 | in the data object with the handle HANDLE to OFFSET, relativ to | |
1275 | WHENCE. Returns the new offset in bytes from the beginning of the | |
1276 | data object. */ | |
1277 | typedef @API__OFF_T@ (*gpgme_data_seek_cb_t) (void *handle, | |
1278 | @API__OFF_T@ offset, int whence); | |
1279 | ||
1280 | /* Close the data object with the handle HANDLE. */ | |
1281 | typedef void (*gpgme_data_release_cb_t) (void *handle); | |
1282 | ||
1283 | struct gpgme_data_cbs | |
1284 | { | |
1285 | gpgme_data_read_cb_t read; | |
1286 | gpgme_data_write_cb_t write; | |
1287 | gpgme_data_seek_cb_t seek; | |
1288 | gpgme_data_release_cb_t release; | |
1289 | }; | |
1290 | typedef struct gpgme_data_cbs *gpgme_data_cbs_t; | |
1291 | ||
1292 | /* Read up to SIZE bytes into buffer BUFFER from the data object with | |
1293 | the handle DH. Return the number of characters read, 0 on EOF and | |
1294 | -1 on error. If an error occurs, errno is set. */ | |
1295 | @API__SSIZE_T@ gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size); | |
1296 | ||
1297 | /* Write up to SIZE bytes from buffer BUFFER to the data object with | |
1298 | the handle DH. Return the number of characters written, or -1 on | |
1299 | error. If an error occurs, errno is set. */ | |
1300 | @API__SSIZE_T@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size); | |
1301 | ||
1302 | /* Set the current position from where the next read or write starts | |
1303 | in the data object with the handle DH to OFFSET, relativ to WHENCE. | |
1304 | Returns the new offset in bytes from the beginning of the data | |
1305 | object. */ | |
1306 | @API__OFF_T@ gpgme_data_seek (gpgme_data_t dh, @API__OFF_T@ offset, int whence); | |
1307 | ||
1308 | /* Create a new data buffer and return it in R_DH. */ | |
1309 | gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh); | |
1310 | ||
1311 | /* Destroy the data buffer DH. */ | |
1312 | void gpgme_data_release (gpgme_data_t dh); | |
1313 | ||
1314 | /* Create a new data buffer filled with SIZE bytes starting from | |
1315 | BUFFER. If COPY is zero, copying is delayed until necessary, and | |
1316 | the data is taken from the original location when needed. */ | |
1317 | gpgme_error_t gpgme_data_new_from_mem (gpgme_data_t *r_dh, | |
1318 | const char *buffer, size_t size, | |
1319 | int copy); | |
1320 | ||
1321 | /* Destroy the data buffer DH and return a pointer to its content. | |
1322 | The memory has be to released with gpgme_free() by the user. It's | |
1323 | size is returned in R_LEN. */ | |
1324 | char *gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len); | |
1325 | ||
1326 | /* Release the memory returned by gpgme_data_release_and_get_mem() and | |
1327 | some other functions. */ | |
1328 | void gpgme_free (void *buffer); | |
1329 | ||
1330 | gpgme_error_t gpgme_data_new_from_cbs (gpgme_data_t *dh, | |
1331 | gpgme_data_cbs_t cbs, | |
1332 | void *handle); | |
1333 | ||
1334 | gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *dh, int fd); | |
1335 | ||
1336 | gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *dh, FILE *stream); | |
1337 | ||
1338 | /* Return the encoding attribute of the data buffer DH */ | |
1339 | gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh); | |
1340 | ||
1341 | /* Set the encoding attribute of data buffer DH to ENC */ | |
1342 | gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh, | |
1343 | gpgme_data_encoding_t enc); | |
1344 | ||
1345 | /* Get the file name associated with the data object with handle DH, or | |
1346 | NULL if there is none. */ | |
1347 | char *gpgme_data_get_file_name (gpgme_data_t dh); | |
1348 | ||
1349 | /* Set the file name associated with the data object with handle DH to | |
1350 | FILE_NAME. */ | |
1351 | gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh, | |
1352 | const char *file_name); | |
1353 | ||
1354 | /* Set a flag for the data object DH. See the manual for details. */ | |
1355 | gpg_error_t gpgme_data_set_flag (gpgme_data_t dh, | |
1356 | const char *name, const char *value); | |
1357 | ||
1358 | /* Try to identify the type of the data in DH. */ | |
1359 | gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved); | |
1360 | ||
1361 | ||
1362 | /* Create a new data buffer which retrieves the data from the callback | |
1363 | function READ_CB. Deprecated, please use gpgme_data_new_from_cbs | |
1364 | instead. */ | |
1365 | gpgme_error_t gpgme_data_new_with_read_cb (gpgme_data_t *r_dh, | |
1366 | int (*read_cb) (void*,char *, | |
1367 | size_t,size_t*), | |
1368 | void *read_cb_value) | |
1369 | _GPGME_DEPRECATED(0,4); | |
1370 | ||
1371 | /* Create a new data buffer filled with the content of file FNAME. | |
1372 | COPY must be non-zero. For delayed read, please use | |
1373 | gpgme_data_new_from_fd or gpgme_data_new_from_stream instead. */ | |
1374 | gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh, | |
1375 | const char *fname, | |
1376 | int copy); | |
1377 | ||
1378 | /* Create a new data buffer filled with LENGTH bytes starting from | |
1379 | OFFSET within the file FNAME or stream FP (exactly one must be | |
1380 | non-zero). */ | |
1381 | gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh, | |
1382 | const char *fname, FILE *fp, | |
1383 | @API__OFF_T@ offset, size_t length); | |
1384 | ||
1385 | /* Reset the read pointer in DH. Deprecated, please use | |
1386 | gpgme_data_seek instead. */ | |
1387 | gpgme_error_t gpgme_data_rewind (gpgme_data_t dh) _GPGME_DEPRECATED(0,4); | |
1388 | ||
1389 | ||
1390 | ||
1391 | /* | |
1392 | * Key and trust functions. | |
1393 | */ | |
1394 | ||
1395 | /* Get the key with the fingerprint FPR from the crypto backend. If | |
1396 | SECRET is true, get the secret key. */ | |
1397 | gpgme_error_t gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, | |
1398 | gpgme_key_t *r_key, int secret); | |
1399 | ||
1400 | /* Create a dummy key to specify an email address. */ | |
1401 | gpgme_error_t gpgme_key_from_uid (gpgme_key_t *key, const char *name); | |
1402 | ||
1403 | /* Acquire a reference to KEY. */ | |
1404 | void gpgme_key_ref (gpgme_key_t key); | |
1405 | ||
1406 | /* Release a reference to KEY. If this was the last one the key is | |
1407 | destroyed. */ | |
1408 | void gpgme_key_unref (gpgme_key_t key); | |
1409 | void gpgme_key_release (gpgme_key_t key); | |
1410 | ||
1411 | /* Return the value of the attribute WHAT of KEY, which has to be | |
1412 | representable by a string. IDX specifies the sub key or user ID | |
1413 | for attributes related to sub keys or user IDs. Deprecated, use | |
1414 | key structure directly instead. */ | |
1415 | const char *gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what, | |
1416 | const void *reserved, int idx) | |
1417 | _GPGME_DEPRECATED(0,4); | |
1418 | ||
1419 | /* Return the value of the attribute WHAT of KEY, which has to be | |
1420 | representable by an unsigned integer. IDX specifies the sub key or | |
1421 | user ID for attributes related to sub keys or user IDs. | |
1422 | Deprecated, use key structure directly instead. */ | |
1423 | unsigned long gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what, | |
1424 | const void *reserved, int idx) | |
1425 | _GPGME_DEPRECATED(0,4); | |
1426 | ||
1427 | /* Return the value of the attribute WHAT of a signature on user ID | |
1428 | UID_IDX in KEY, which has to be representable by a string. IDX | |
1429 | specifies the signature. Deprecated, use key structure directly | |
1430 | instead. */ | |
1431 | const char *gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx, | |
1432 | _gpgme_attr_t what, | |
1433 | const void *reserved, int idx) | |
1434 | _GPGME_DEPRECATED(0,4); | |
1435 | ||
1436 | /* Return the value of the attribute WHAT of a signature on user ID | |
1437 | UID_IDX in KEY, which has to be representable by an unsigned | |
1438 | integer string. IDX specifies the signature. Deprecated, use key | |
1439 | structure directly instead. */ | |
1440 | unsigned long gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx, | |
1441 | _gpgme_attr_t what, | |
1442 | const void *reserved, int idx) | |
1443 | _GPGME_DEPRECATED(0,4); | |
1444 | ||
1445 | ||
1446 | ||
1447 | /* | |
1448 | * Encryption. | |
1449 | */ | |
1450 | ||
1451 | struct _gpgme_op_encrypt_result | |
1452 | { | |
1453 | /* The list of invalid recipients. */ | |
1454 | gpgme_invalid_key_t invalid_recipients; | |
1455 | }; | |
1456 | typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t; | |
1457 | ||
1458 | /* Retrieve a pointer to the result of the encrypt operation. */ | |
1459 | gpgme_encrypt_result_t gpgme_op_encrypt_result (gpgme_ctx_t ctx); | |
1460 | ||
1461 | /* The valid encryption flags. */ | |
1462 | typedef enum | |
1463 | { | |
1464 | GPGME_ENCRYPT_ALWAYS_TRUST = 1, | |
1465 | GPGME_ENCRYPT_NO_ENCRYPT_TO = 2, | |
1466 | GPGME_ENCRYPT_PREPARE = 4, | |
1467 | GPGME_ENCRYPT_EXPECT_SIGN = 8, | |
1468 | GPGME_ENCRYPT_NO_COMPRESS = 16, | |
1469 | GPGME_ENCRYPT_SYMMETRIC = 32 | |
1470 | } | |
1471 | gpgme_encrypt_flags_t; | |
1472 | ||
1473 | /* Encrypt plaintext PLAIN within CTX for the recipients RECP and | |
1474 | store the resulting ciphertext in CIPHER. */ | |
1475 | gpgme_error_t gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[], | |
1476 | gpgme_encrypt_flags_t flags, | |
1477 | gpgme_data_t plain, gpgme_data_t cipher); | |
1478 | gpgme_error_t gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[], | |
1479 | gpgme_encrypt_flags_t flags, | |
1480 | gpgme_data_t plain, gpgme_data_t cipher); | |
1481 | ||
1482 | /* Encrypt plaintext PLAIN within CTX for the recipients RECP and | |
1483 | store the resulting ciphertext in CIPHER. Also sign the ciphertext | |
1484 | with the signers in CTX. */ | |
1485 | gpgme_error_t gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx, | |
1486 | gpgme_key_t recp[], | |
1487 | gpgme_encrypt_flags_t flags, | |
1488 | gpgme_data_t plain, | |
1489 | gpgme_data_t cipher); | |
1490 | gpgme_error_t gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[], | |
1491 | gpgme_encrypt_flags_t flags, | |
1492 | gpgme_data_t plain, gpgme_data_t cipher); | |
1493 | ||
1494 | ||
1495 | /* | |
1496 | * Decryption. | |
1497 | */ | |
1498 | ||
1499 | struct _gpgme_recipient | |
1500 | { | |
1501 | struct _gpgme_recipient *next; | |
1502 | ||
1503 | /* The key ID of key for which the text was encrypted. */ | |
1504 | char *keyid; | |
1505 | ||
1506 | /* Internal to GPGME, do not use. */ | |
1507 | char _keyid[16 + 1]; | |
1508 | ||
1509 | /* The public key algorithm of the recipient key. */ | |
1510 | gpgme_pubkey_algo_t pubkey_algo; | |
1511 | ||
1512 | /* The status of the recipient. */ | |
1513 | gpgme_error_t status; | |
1514 | }; | |
1515 | typedef struct _gpgme_recipient *gpgme_recipient_t; | |
1516 | ||
1517 | struct _gpgme_op_decrypt_result | |
1518 | { | |
1519 | char *unsupported_algorithm; | |
1520 | ||
1521 | /* Key should not have been used for encryption. */ | |
1522 | unsigned int wrong_key_usage : 1; | |
1523 | ||
1524 | /* Internal to GPGME, do not use. */ | |
1525 | int _unused : 31; | |
1526 | ||
1527 | gpgme_recipient_t recipients; | |
1528 | ||
1529 | /* The original file name of the plaintext message, if | |
1530 | available. */ | |
1531 | char *file_name; | |
1532 | ||
1533 | /* A textual representation of the session key used to decrypt the | |
1534 | * message, if available */ | |
1535 | char *session_key; | |
1536 | }; | |
1537 | typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t; | |
1538 | ||
1539 | /* Retrieve a pointer to the result of the decrypt operation. */ | |
1540 | gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t ctx); | |
1541 | ||
1542 | /* Decrypt ciphertext CIPHER within CTX and store the resulting | |
1543 | plaintext in PLAIN. */ | |
1544 | gpgme_error_t gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher, | |
1545 | gpgme_data_t plain); | |
1546 | gpgme_error_t gpgme_op_decrypt (gpgme_ctx_t ctx, | |
1547 | gpgme_data_t cipher, gpgme_data_t plain); | |
1548 | ||
1549 | /* Decrypt ciphertext CIPHER and make a signature verification within | |
1550 | CTX and store the resulting plaintext in PLAIN. */ | |
1551 | gpgme_error_t gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, | |
1552 | gpgme_data_t cipher, | |
1553 | gpgme_data_t plain); | |
1554 | gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher, | |
1555 | gpgme_data_t plain); | |
1556 | ||
1557 | ||
1558 | /* | |
1559 | * Signing. | |
1560 | */ | |
1561 | ||
1562 | struct _gpgme_new_signature | |
1563 | { | |
1564 | struct _gpgme_new_signature *next; | |
1565 | ||
1566 | /* The type of the signature. */ | |
1567 | gpgme_sig_mode_t type; | |
1568 | ||
1569 | /* The public key algorithm used to create the signature. */ | |
1570 | gpgme_pubkey_algo_t pubkey_algo; | |
1571 | ||
1572 | /* The hash algorithm used to create the signature. */ | |
1573 | gpgme_hash_algo_t hash_algo; | |
1574 | ||
1575 | /* Internal to GPGME, do not use. Must be set to the same value as | |
1576 | CLASS below. */ | |
1577 | unsigned long _obsolete_class; | |
1578 | ||
1579 | /* Signature creation time. */ | |
1580 | long int timestamp; | |
1581 | ||
1582 | /* The fingerprint of the signature. */ | |
1583 | char *fpr; | |
1584 | ||
1585 | #ifdef __cplusplus | |
1586 | unsigned int _obsolete_class_2; | |
1587 | #else | |
1588 | /* Must be set to SIG_CLASS below. */ | |
1589 | unsigned int class _GPGME_DEPRECATED_OUTSIDE_GPGME(0,4); | |
1590 | #endif | |
1591 | ||
1592 | /* Crypto backend specific signature class. */ | |
1593 | unsigned int sig_class; | |
1594 | }; | |
1595 | typedef struct _gpgme_new_signature *gpgme_new_signature_t; | |
1596 | ||
1597 | struct _gpgme_op_sign_result | |
1598 | { | |
1599 | /* The list of invalid signers. */ | |
1600 | gpgme_invalid_key_t invalid_signers; | |
1601 | gpgme_new_signature_t signatures; | |
1602 | }; | |
1603 | typedef struct _gpgme_op_sign_result *gpgme_sign_result_t; | |
1604 | ||
1605 | /* Retrieve a pointer to the result of the signing operation. */ | |
1606 | gpgme_sign_result_t gpgme_op_sign_result (gpgme_ctx_t ctx); | |
1607 | ||
1608 | /* Sign the plaintext PLAIN and store the signature in SIG. */ | |
1609 | gpgme_error_t gpgme_op_sign_start (gpgme_ctx_t ctx, | |
1610 | gpgme_data_t plain, gpgme_data_t sig, | |
1611 | gpgme_sig_mode_t mode); | |
1612 | gpgme_error_t gpgme_op_sign (gpgme_ctx_t ctx, | |
1613 | gpgme_data_t plain, gpgme_data_t sig, | |
1614 | gpgme_sig_mode_t mode); | |
1615 | ||
1616 | ||
1617 | /* | |
1618 | * Verify. | |
1619 | */ | |
1620 | ||
1621 | /* Flags used for the SUMMARY field in a gpgme_signature_t. */ | |
1622 | typedef enum | |
1623 | { | |
1624 | GPGME_SIGSUM_VALID = 0x0001, /* The signature is fully valid. */ | |
1625 | GPGME_SIGSUM_GREEN = 0x0002, /* The signature is good. */ | |
1626 | GPGME_SIGSUM_RED = 0x0004, /* The signature is bad. */ | |
1627 | GPGME_SIGSUM_KEY_REVOKED = 0x0010, /* One key has been revoked. */ | |
1628 | GPGME_SIGSUM_KEY_EXPIRED = 0x0020, /* One key has expired. */ | |
1629 | GPGME_SIGSUM_SIG_EXPIRED = 0x0040, /* The signature has expired. */ | |
1630 | GPGME_SIGSUM_KEY_MISSING = 0x0080, /* Can't verify: key missing. */ | |
1631 | GPGME_SIGSUM_CRL_MISSING = 0x0100, /* CRL not available. */ | |
1632 | GPGME_SIGSUM_CRL_TOO_OLD = 0x0200, /* Available CRL is too old. */ | |
1633 | GPGME_SIGSUM_BAD_POLICY = 0x0400, /* A policy was not met. */ | |
1634 | GPGME_SIGSUM_SYS_ERROR = 0x0800, /* A system error occurred. */ | |
1635 | GPGME_SIGSUM_TOFU_CONFLICT=0x1000 /* Tofu conflict detected. */ | |
1636 | } | |
1637 | gpgme_sigsum_t; | |
1638 | ||
1639 | ||
1640 | struct _gpgme_signature | |
1641 | { | |
1642 | struct _gpgme_signature *next; | |
1643 | ||
1644 | /* A summary of the signature status. */ | |
1645 | gpgme_sigsum_t summary; | |
1646 | ||
1647 | /* The fingerprint of the signature. This can be a subkey. */ | |
1648 | char *fpr; | |
1649 | ||
1650 | /* The status of the signature. */ | |
1651 | gpgme_error_t status; | |
1652 | ||
1653 | /* Notation data and policy URLs. */ | |
1654 | gpgme_sig_notation_t notations; | |
1655 | ||
1656 | /* Signature creation time. */ | |
1657 | unsigned long timestamp; | |
1658 | ||
1659 | /* Signature expiration time or 0. */ | |
1660 | unsigned long exp_timestamp; | |
1661 | ||
1662 | /* Key should not have been used for signing. */ | |
1663 | unsigned int wrong_key_usage : 1; | |
1664 | ||
1665 | /* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */ | |
1666 | unsigned int pka_trust : 2; | |
1667 | ||
1668 | /* Validity has been verified using the chain model. */ | |
1669 | unsigned int chain_model : 1; | |
1670 | ||
1671 | /* Internal to GPGME, do not use. */ | |
1672 | int _unused : 28; | |
1673 | ||
1674 | gpgme_validity_t validity; | |
1675 | gpgme_error_t validity_reason; | |
1676 | ||
1677 | /* The public key algorithm used to create the signature. */ | |
1678 | gpgme_pubkey_algo_t pubkey_algo; | |
1679 | ||
1680 | /* The hash algorithm used to create the signature. */ | |
1681 | gpgme_hash_algo_t hash_algo; | |
1682 | ||
1683 | /* The mailbox from the PKA information or NULL. */ | |
1684 | char *pka_address; | |
1685 | ||
1686 | /* If non-NULL, a possible incomplete key object with the data | |
1687 | * available for the signature. */ | |
1688 | gpgme_key_t key; | |
1689 | }; | |
1690 | typedef struct _gpgme_signature *gpgme_signature_t; | |
1691 | ||
1692 | struct _gpgme_op_verify_result | |
1693 | { | |
1694 | gpgme_signature_t signatures; | |
1695 | ||
1696 | /* The original file name of the plaintext message, if | |
1697 | available. */ | |
1698 | char *file_name; | |
1699 | }; | |
1700 | typedef struct _gpgme_op_verify_result *gpgme_verify_result_t; | |
1701 | ||
1702 | /* Retrieve a pointer to the result of the verify operation. */ | |
1703 | gpgme_verify_result_t gpgme_op_verify_result (gpgme_ctx_t ctx); | |
1704 | ||
1705 | /* Verify within CTX that SIG is a valid signature for TEXT. */ | |
1706 | gpgme_error_t gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig, | |
1707 | gpgme_data_t signed_text, | |
1708 | gpgme_data_t plaintext); | |
1709 | gpgme_error_t gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig, | |
1710 | gpgme_data_t signed_text, | |
1711 | gpgme_data_t plaintext); | |
1712 | ||
1713 | ||
1714 | /* | |
1715 | * Import/Export | |
1716 | */ | |
1717 | ||
1718 | #define GPGME_IMPORT_NEW 1 /* The key was new. */ | |
1719 | #define GPGME_IMPORT_UID 2 /* The key contained new user IDs. */ | |
1720 | #define GPGME_IMPORT_SIG 4 /* The key contained new signatures. */ | |
1721 | #define GPGME_IMPORT_SUBKEY 8 /* The key contained new sub keys. */ | |
1722 | #define GPGME_IMPORT_SECRET 16 /* The key contained a secret key. */ | |
1723 | ||
1724 | ||
1725 | struct _gpgme_import_status | |
1726 | { | |
1727 | struct _gpgme_import_status *next; | |
1728 | ||
1729 | /* Fingerprint. */ | |
1730 | char *fpr; | |
1731 | ||
1732 | /* If a problem occurred, the reason why the key could not be | |
1733 | imported. Otherwise GPGME_No_Error. */ | |
1734 | gpgme_error_t result; | |
1735 | ||
1736 | /* The result of the import, the GPGME_IMPORT_* values bit-wise | |
1737 | ORed. 0 means the key was already known and no new components | |
1738 | have been added. */ | |
1739 | unsigned int status; | |
1740 | }; | |
1741 | typedef struct _gpgme_import_status *gpgme_import_status_t; | |
1742 | ||
1743 | /* Import result object. */ | |
1744 | struct _gpgme_op_import_result | |
1745 | { | |
1746 | /* Number of considered keys. */ | |
1747 | int considered; | |
1748 | ||
1749 | /* Keys without user ID. */ | |
1750 | int no_user_id; | |
1751 | ||
1752 | /* Imported keys. */ | |
1753 | int imported; | |
1754 | ||
1755 | /* Imported RSA keys. */ | |
1756 | int imported_rsa; | |
1757 | ||
1758 | /* Unchanged keys. */ | |
1759 | int unchanged; | |
1760 | ||
1761 | /* Number of new user ids. */ | |
1762 | int new_user_ids; | |
1763 | ||
1764 | /* Number of new sub keys. */ | |
1765 | int new_sub_keys; | |
1766 | ||
1767 | /* Number of new signatures. */ | |
1768 | int new_signatures; | |
1769 | ||
1770 | /* Number of new revocations. */ | |
1771 | int new_revocations; | |
1772 | ||
1773 | /* Number of secret keys read. */ | |
1774 | int secret_read; | |
1775 | ||
1776 | /* Number of secret keys imported. */ | |
1777 | int secret_imported; | |
1778 | ||
1779 | /* Number of secret keys unchanged. */ | |
1780 | int secret_unchanged; | |
1781 | ||
1782 | /* Number of new keys skipped. */ | |
1783 | int skipped_new_keys; | |
1784 | ||
1785 | /* Number of keys not imported. */ | |
1786 | int not_imported; | |
1787 | ||
1788 | /* List of keys for which an import was attempted. */ | |
1789 | gpgme_import_status_t imports; | |
1790 | }; | |
1791 | typedef struct _gpgme_op_import_result *gpgme_import_result_t; | |
1792 | ||
1793 | /* Retrieve a pointer to the result of the import operation. */ | |
1794 | gpgme_import_result_t gpgme_op_import_result (gpgme_ctx_t ctx); | |
1795 | ||
1796 | /* Import the key in KEYDATA into the keyring. */ | |
1797 | gpgme_error_t gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata); | |
1798 | gpgme_error_t gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata); | |
1799 | gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata, | |
1800 | int *nr) _GPGME_DEPRECATED(0,4); | |
1801 | ||
1802 | /* Import the keys from the array KEYS into the keyring. */ | |
1803 | gpgme_error_t gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t keys[]); | |
1804 | gpgme_error_t gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t keys[]); | |
1805 | ||
1806 | ||
1807 | /* Export the keys found by PATTERN into KEYDATA. */ | |
1808 | gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern, | |
1809 | gpgme_export_mode_t mode, | |
1810 | gpgme_data_t keydata); | |
1811 | gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, | |
1812 | gpgme_export_mode_t mode, | |
1813 | gpgme_data_t keydata); | |
1814 | ||
1815 | gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx, | |
1816 | const char *pattern[], | |
1817 | gpgme_export_mode_t mode, | |
1818 | gpgme_data_t keydata); | |
1819 | gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], | |
1820 | gpgme_export_mode_t mode, | |
1821 | gpgme_data_t keydata); | |
1822 | ||
1823 | /* Export the keys from the array KEYS into KEYDATA. */ | |
1824 | gpgme_error_t gpgme_op_export_keys_start (gpgme_ctx_t ctx, | |
1825 | gpgme_key_t keys[], | |
1826 | gpgme_export_mode_t mode, | |
1827 | gpgme_data_t keydata); | |
1828 | gpgme_error_t gpgme_op_export_keys (gpgme_ctx_t ctx, | |
1829 | gpgme_key_t keys[], | |
1830 | gpgme_export_mode_t mode, | |
1831 | gpgme_data_t keydata); | |
1832 | ||
1833 | ||
1834 | ||
1835 | /* | |
1836 | * Key generation. | |
1837 | */ | |
1838 | ||
1839 | /* Flags for the key creation functions. */ | |
1840 | #define GPGME_CREATE_SIGN (1 << 0) /* Allow usage: signing. */ | |
1841 | #define GPGME_CREATE_ENCR (1 << 1) /* Allow usage: encryption. */ | |
1842 | #define GPGME_CREATE_CERT (1 << 2) /* Allow usage: certification. */ | |
1843 | #define GPGME_CREATE_AUTH (1 << 3) /* Allow usage: authentication. */ | |
1844 | #define GPGME_CREATE_NOPASSWD (1 << 7) /* Create w/o passphrase. */ | |
1845 | #define GPGME_CREATE_SELFSIGNED (1 << 8) /* Create self-signed cert. */ | |
1846 | #define GPGME_CREATE_NOSTORE (1 << 9) /* Do not store the key. */ | |
1847 | #define GPGME_CREATE_WANTPUB (1 << 10) /* Return the public key. */ | |
1848 | #define GPGME_CREATE_WANTSEC (1 << 11) /* Return the secret key. */ | |
1849 | #define GPGME_CREATE_FORCE (1 << 12) /* Force creation. */ | |
1850 | ||
1851 | struct _gpgme_op_genkey_result | |
1852 | { | |
1853 | /* A primary key was generated. */ | |
1854 | unsigned int primary : 1; | |
1855 | ||
1856 | /* A sub key was generated. */ | |
1857 | unsigned int sub : 1; | |
1858 | ||
1859 | /* A user id was generated. */ | |
1860 | unsigned int uid : 1; | |
1861 | ||
1862 | /* Internal to GPGME, do not use. */ | |
1863 | unsigned int _unused : 29; | |
1864 | ||
1865 | /* The fingerprint of the generated key. */ | |
1866 | char *fpr; | |
1867 | ||
1868 | /* A memory data object with the created public key. Only set when | |
1869 | * GPGME_CREATE_WANTPUB has been used. */ | |
1870 | gpgme_data_t pubkey; | |
1871 | ||
1872 | /* A memory data object with the created secret key. Only set when | |
1873 | * GPGME_CREATE_WANTSEC has been used. */ | |
1874 | gpgme_data_t seckey; | |
1875 | }; | |
1876 | typedef struct _gpgme_op_genkey_result *gpgme_genkey_result_t; | |
1877 | ||
1878 | /* Generate a new keypair and add it to the keyring. PUBKEY and | |
1879 | SECKEY should be null for now. PARMS specifies what keys should be | |
1880 | generated. */ | |
1881 | gpgme_error_t gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms, | |
1882 | gpgme_data_t pubkey, gpgme_data_t seckey); | |
1883 | gpgme_error_t gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms, | |
1884 | gpgme_data_t pubkey, gpgme_data_t seckey); | |
1885 | ||
1886 | /* Generate a key pair using the modern interface. */ | |
1887 | gpgme_error_t gpgme_op_createkey_start (gpgme_ctx_t ctx, | |
1888 | const char *userid, | |
1889 | const char *algo, | |
1890 | unsigned long reserved, | |
1891 | unsigned long expires, | |
1892 | gpgme_key_t certkey, | |
1893 | unsigned int flags); | |
1894 | gpgme_error_t gpgme_op_createkey (gpgme_ctx_t ctx, | |
1895 | const char *userid, | |
1896 | const char *algo, | |
1897 | unsigned long reserved, | |
1898 | unsigned long expires, | |
1899 | gpgme_key_t certkey, | |
1900 | unsigned int flags); | |
1901 | /* Add a new subkey to KEY. */ | |
1902 | gpgme_error_t gpgme_op_createsubkey_start (gpgme_ctx_t ctx, | |
1903 | gpgme_key_t key, | |
1904 | const char *algo, | |
1905 | unsigned long reserved, | |
1906 | unsigned long expires, | |
1907 | unsigned int flags); | |
1908 | gpgme_error_t gpgme_op_createsubkey (gpgme_ctx_t ctx, | |
1909 | gpgme_key_t key, | |
1910 | const char *algo, | |
1911 | unsigned long reserved, | |
1912 | unsigned long expires, | |
1913 | unsigned int flags); | |
1914 | ||
1915 | /* Add USERID to an existing KEY. */ | |
1916 | gpgme_error_t gpgme_op_adduid_start (gpgme_ctx_t ctx, | |
1917 | gpgme_key_t key, const char *userid, | |
1918 | unsigned int reserved); | |
1919 | gpgme_error_t gpgme_op_adduid (gpgme_ctx_t ctx, | |
1920 | gpgme_key_t key, const char *userid, | |
1921 | unsigned int reserved); | |
1922 | ||
1923 | /* Revoke a USERID from a KEY. */ | |
1924 | gpgme_error_t gpgme_op_revuid_start (gpgme_ctx_t ctx, | |
1925 | gpgme_key_t key, const char *userid, | |
1926 | unsigned int reserved); | |
1927 | gpgme_error_t gpgme_op_revuid (gpgme_ctx_t ctx, | |
1928 | gpgme_key_t key, const char *userid, | |
1929 | unsigned int reserved); | |
1930 | ||
1931 | ||
1932 | ||
1933 | /* Retrieve a pointer to the result of a genkey, createkey, or | |
1934 | * createsubkey operation. */ | |
1935 | gpgme_genkey_result_t gpgme_op_genkey_result (gpgme_ctx_t ctx); | |
1936 | ||
1937 | ||
1938 | /* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret | |
1939 | keys are also deleted. */ | |
1940 | gpgme_error_t gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key, | |
1941 | int allow_secret); | |
1942 | gpgme_error_t gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key, | |
1943 | int allow_secret); | |
1944 | ||
1945 | ||
1946 | /* | |
1947 | * Key signing interface | |
1948 | */ | |
1949 | ||
1950 | /* Flags for the key signing functions. */ | |
1951 | #define GPGME_KEYSIGN_LOCAL (1 << 7) /* Create a local signature. */ | |
1952 | #define GPGME_KEYSIGN_LFSEP (1 << 8) /* Indicate LF separated user ids. */ | |
1953 | #define GPGME_KEYSIGN_NOEXPIRE (1 << 9) /* Force no expiration. */ | |
1954 | ||
1955 | ||
1956 | /* Sign the USERID of KEY using the current set of signers. */ | |
1957 | gpgme_error_t gpgme_op_keysign_start (gpgme_ctx_t ctx, | |
1958 | gpgme_key_t key, const char *userid, | |
1959 | unsigned long expires, | |
1960 | unsigned int flags); | |
1961 | gpgme_error_t gpgme_op_keysign (gpgme_ctx_t ctx, | |
1962 | gpgme_key_t key, const char *userid, | |
1963 | unsigned long expires, | |
1964 | unsigned int flags); | |
1965 | ||
1966 | ||
1967 | ||
1968 | ||
1969 | /* | |
1970 | * Key edit interface | |
1971 | */ | |
1972 | ||
1973 | /* Flags to select the mode of the interact. */ | |
1974 | #define GPGME_INTERACT_CARD (1 << 0) /* Use --card-edit mode. */ | |
1975 | ||
1976 | ||
1977 | /* Edit the KEY. Send status and command requests to FNC and | |
1978 | output of edit commands to OUT. */ | |
1979 | gpgme_error_t gpgme_op_interact_start (gpgme_ctx_t ctx, | |
1980 | gpgme_key_t key, | |
1981 | unsigned int flags, | |
1982 | gpgme_interact_cb_t fnc, | |
1983 | void *fnc_value, | |
1984 | gpgme_data_t out); | |
1985 | gpgme_error_t gpgme_op_interact (gpgme_ctx_t ctx, gpgme_key_t key, | |
1986 | unsigned int flags, | |
1987 | gpgme_interact_cb_t fnc, | |
1988 | void *fnc_value, | |
1989 | gpgme_data_t out); | |
1990 | 2479 | |
1991 | 2480 | gpgme_error_t gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, |
1992 | 2481 | gpgme_edit_cb_t fnc, void *fnc_value, |
2003 | 2492 | gpgme_data_t out) |
2004 | 2493 | _GPGME_DEPRECATED(1,7); |
2005 | 2494 | |
2006 | ||
2007 | /* Set the Tofu policy of KEY to POLCIY. */ | |
2008 | gpgme_error_t gpgme_op_tofu_policy_start (gpgme_ctx_t ctx, | |
2009 | gpgme_key_t key, | |
2010 | gpgme_tofu_policy_t policy); | |
2011 | gpgme_error_t gpgme_op_tofu_policy (gpgme_ctx_t ctx, | |
2012 | gpgme_key_t key, | |
2013 | gpgme_tofu_policy_t policy); | |
2014 | ||
2015 | ||
2016 | ||
2017 | ||
2018 | /* | |
2019 | * Key listing | |
2020 | */ | |
2021 | ||
2022 | struct _gpgme_op_keylist_result | |
2023 | { | |
2024 | unsigned int truncated : 1; | |
2025 | ||
2026 | /* Internal to GPGME, do not use. */ | |
2027 | unsigned int _unused : 31; | |
2028 | }; | |
2029 | typedef struct _gpgme_op_keylist_result *gpgme_keylist_result_t; | |
2030 | ||
2031 | /* Retrieve a pointer to the result of the key listing operation. */ | |
2032 | gpgme_keylist_result_t gpgme_op_keylist_result (gpgme_ctx_t ctx); | |
2033 | ||
2034 | /* Start a keylist operation within CTX, searching for keys which | |
2035 | match PATTERN. If SECRET_ONLY is true, only secret keys are | |
2036 | returned. */ | |
2037 | gpgme_error_t gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern, | |
2038 | int secret_only); | |
2039 | gpgme_error_t gpgme_op_keylist_ext_start (gpgme_ctx_t ctx, | |
2040 | const char *pattern[], | |
2041 | int secret_only, int reserved); | |
2042 | ||
2043 | /* Return the next key from the keylist in R_KEY. */ | |
2044 | gpgme_error_t gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key); | |
2045 | ||
2046 | /* Terminate a pending keylist operation within CTX. */ | |
2047 | gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx); | |
2048 | ||
2049 | /* Change the passphrase for KEY. FLAGS is reserved for future use | |
2050 | and must be passed as 0. */ | |
2051 | gpgme_error_t gpgme_op_passwd_start (gpgme_ctx_t ctx, gpgme_key_t key, | |
2052 | unsigned int flags); | |
2053 | gpgme_error_t gpgme_op_passwd (gpgme_ctx_t ctx, gpgme_key_t key, | |
2054 | unsigned int flags); | |
2055 | ||
2056 | ||
2057 | ||
2058 | /* | |
2059 | * Trust items and operations. | |
2060 | */ | |
2061 | ||
2062 | struct _gpgme_trust_item | |
2063 | { | |
2064 | /* Internal to GPGME, do not use. */ | |
2065 | unsigned int _refs; | |
2066 | ||
2067 | /* The key ID to which the trust item belongs. */ | |
2068 | char *keyid; | |
2069 | ||
2070 | /* Internal to GPGME, do not use. */ | |
2071 | char _keyid[16 + 1]; | |
2072 | ||
2073 | /* The type of the trust item, 1 refers to a key, 2 to a user ID. */ | |
2074 | int type; | |
2075 | ||
2076 | /* The trust level. */ | |
2077 | int level; | |
2078 | ||
2079 | /* The owner trust if TYPE is 1. */ | |
2080 | char *owner_trust; | |
2081 | ||
2082 | /* Internal to GPGME, do not use. */ | |
2083 | char _owner_trust[2]; | |
2084 | ||
2085 | /* The calculated validity. */ | |
2086 | char *validity; | |
2087 | ||
2088 | /* Internal to GPGME, do not use. */ | |
2089 | char _validity[2]; | |
2090 | ||
2091 | /* The user name if TYPE is 2. */ | |
2092 | char *name; | |
2093 | }; | |
2094 | typedef struct _gpgme_trust_item *gpgme_trust_item_t; | |
2095 | ||
2096 | /* Start a trustlist operation within CTX, searching for trust items | |
2097 | which match PATTERN. */ | |
2098 | gpgme_error_t gpgme_op_trustlist_start (gpgme_ctx_t ctx, | |
2099 | const char *pattern, int max_level); | |
2100 | ||
2101 | /* Return the next trust item from the trustlist in R_ITEM. */ | |
2102 | gpgme_error_t gpgme_op_trustlist_next (gpgme_ctx_t ctx, | |
2103 | gpgme_trust_item_t *r_item); | |
2104 | ||
2105 | /* Terminate a pending trustlist operation within CTX. */ | |
2106 | gpgme_error_t gpgme_op_trustlist_end (gpgme_ctx_t ctx); | |
2107 | ||
2108 | /* Acquire a reference to ITEM. */ | |
2109 | void gpgme_trust_item_ref (gpgme_trust_item_t item); | |
2110 | ||
2111 | /* Release a reference to ITEM. If this was the last one the trust | |
2112 | item is destroyed. */ | |
2113 | void gpgme_trust_item_unref (gpgme_trust_item_t item); | |
2495 | /* The possible signature stati. Deprecated, use error value in sig | |
2496 | status. */ | |
2497 | typedef enum | |
2498 | { | |
2499 | GPGME_SIG_STAT_NONE = 0, | |
2500 | GPGME_SIG_STAT_GOOD = 1, | |
2501 | GPGME_SIG_STAT_BAD = 2, | |
2502 | GPGME_SIG_STAT_NOKEY = 3, | |
2503 | GPGME_SIG_STAT_NOSIG = 4, | |
2504 | GPGME_SIG_STAT_ERROR = 5, | |
2505 | GPGME_SIG_STAT_DIFF = 6, | |
2506 | GPGME_SIG_STAT_GOOD_EXP = 7, | |
2507 | GPGME_SIG_STAT_GOOD_EXPKEY = 8 | |
2508 | } | |
2509 | _gpgme_sig_stat_t; | |
2510 | typedef _gpgme_sig_stat_t gpgme_sig_stat_t _GPGME_DEPRECATED(0,4); | |
2511 | ||
2512 | /* The available key and signature attributes. Deprecated, use the | |
2513 | individual result structures instead. */ | |
2514 | typedef enum | |
2515 | { | |
2516 | GPGME_ATTR_KEYID = 1, | |
2517 | GPGME_ATTR_FPR = 2, | |
2518 | GPGME_ATTR_ALGO = 3, | |
2519 | GPGME_ATTR_LEN = 4, | |
2520 | GPGME_ATTR_CREATED = 5, | |
2521 | GPGME_ATTR_EXPIRE = 6, | |
2522 | GPGME_ATTR_OTRUST = 7, | |
2523 | GPGME_ATTR_USERID = 8, | |
2524 | GPGME_ATTR_NAME = 9, | |
2525 | GPGME_ATTR_EMAIL = 10, | |
2526 | GPGME_ATTR_COMMENT = 11, | |
2527 | GPGME_ATTR_VALIDITY = 12, | |
2528 | GPGME_ATTR_LEVEL = 13, | |
2529 | GPGME_ATTR_TYPE = 14, | |
2530 | GPGME_ATTR_IS_SECRET = 15, | |
2531 | GPGME_ATTR_KEY_REVOKED = 16, | |
2532 | GPGME_ATTR_KEY_INVALID = 17, | |
2533 | GPGME_ATTR_UID_REVOKED = 18, | |
2534 | GPGME_ATTR_UID_INVALID = 19, | |
2535 | GPGME_ATTR_KEY_CAPS = 20, | |
2536 | GPGME_ATTR_CAN_ENCRYPT = 21, | |
2537 | GPGME_ATTR_CAN_SIGN = 22, | |
2538 | GPGME_ATTR_CAN_CERTIFY = 23, | |
2539 | GPGME_ATTR_KEY_EXPIRED = 24, | |
2540 | GPGME_ATTR_KEY_DISABLED = 25, | |
2541 | GPGME_ATTR_SERIAL = 26, | |
2542 | GPGME_ATTR_ISSUER = 27, | |
2543 | GPGME_ATTR_CHAINID = 28, | |
2544 | GPGME_ATTR_SIG_STATUS = 29, | |
2545 | GPGME_ATTR_ERRTOK = 30, | |
2546 | GPGME_ATTR_SIG_SUMMARY = 31, | |
2547 | GPGME_ATTR_SIG_CLASS = 32 | |
2548 | } | |
2549 | _gpgme_attr_t; | |
2550 | typedef _gpgme_attr_t gpgme_attr_t _GPGME_DEPRECATED(0,4); | |
2551 | ||
2552 | /* Retrieve the signature status of signature IDX in CTX after a | |
2553 | successful verify operation in R_STAT (if non-null). The creation | |
2554 | time stamp of the signature is returned in R_CREATED (if non-null). | |
2555 | The function returns a string containing the fingerprint. | |
2556 | Deprecated, use verify result directly. */ | |
2557 | const char *gpgme_get_sig_status (gpgme_ctx_t ctx, int idx, | |
2558 | _gpgme_sig_stat_t *r_stat, | |
2559 | time_t *r_created) _GPGME_DEPRECATED(0,4); | |
2560 | ||
2561 | /* Retrieve certain attributes of a signature. IDX is the index | |
2562 | number of the signature after a successful verify operation. WHAT | |
2563 | is an attribute where GPGME_ATTR_EXPIRE is probably the most useful | |
2564 | one. WHATIDX is to be passed as 0 for most attributes . */ | |
2565 | unsigned long gpgme_get_sig_ulong_attr (gpgme_ctx_t c, int idx, | |
2566 | _gpgme_attr_t what, int whatidx) | |
2567 | _GPGME_DEPRECATED(0,4); | |
2568 | const char *gpgme_get_sig_string_attr (gpgme_ctx_t c, int idx, | |
2569 | _gpgme_attr_t what, int whatidx) | |
2570 | _GPGME_DEPRECATED(0,4); | |
2571 | ||
2572 | ||
2573 | /* Get the key used to create signature IDX in CTX and return it in | |
2574 | R_KEY. */ | |
2575 | gpgme_error_t gpgme_get_sig_key (gpgme_ctx_t ctx, int idx, gpgme_key_t *r_key) | |
2576 | _GPGME_DEPRECATED(0,4); | |
2577 | ||
2578 | /* Create a new data buffer which retrieves the data from the callback | |
2579 | function READ_CB. Deprecated, please use gpgme_data_new_from_cbs | |
2580 | instead. */ | |
2581 | gpgme_error_t gpgme_data_new_with_read_cb (gpgme_data_t *r_dh, | |
2582 | int (*read_cb) (void*,char *, | |
2583 | size_t,size_t*), | |
2584 | void *read_cb_value) | |
2585 | _GPGME_DEPRECATED(0,4); | |
2586 | ||
2587 | /* Return the value of the attribute WHAT of KEY, which has to be | |
2588 | representable by a string. IDX specifies the sub key or user ID | |
2589 | for attributes related to sub keys or user IDs. Deprecated, use | |
2590 | key structure directly instead. */ | |
2591 | const char *gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what, | |
2592 | const void *reserved, int idx) | |
2593 | _GPGME_DEPRECATED(0,4); | |
2594 | ||
2595 | /* Return the value of the attribute WHAT of KEY, which has to be | |
2596 | representable by an unsigned integer. IDX specifies the sub key or | |
2597 | user ID for attributes related to sub keys or user IDs. | |
2598 | Deprecated, use key structure directly instead. */ | |
2599 | unsigned long gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what, | |
2600 | const void *reserved, int idx) | |
2601 | _GPGME_DEPRECATED(0,4); | |
2602 | ||
2603 | /* Return the value of the attribute WHAT of a signature on user ID | |
2604 | UID_IDX in KEY, which has to be representable by a string. IDX | |
2605 | specifies the signature. Deprecated, use key structure directly | |
2606 | instead. */ | |
2607 | const char *gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx, | |
2608 | _gpgme_attr_t what, | |
2609 | const void *reserved, int idx) | |
2610 | _GPGME_DEPRECATED(0,4); | |
2611 | ||
2612 | /* Return the value of the attribute WHAT of a signature on user ID | |
2613 | UID_IDX in KEY, which has to be representable by an unsigned | |
2614 | integer string. IDX specifies the signature. Deprecated, use key | |
2615 | structure directly instead. */ | |
2616 | unsigned long gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx, | |
2617 | _gpgme_attr_t what, | |
2618 | const void *reserved, int idx) | |
2619 | _GPGME_DEPRECATED(0,4); | |
2620 | ||
2621 | ||
2622 | gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata, | |
2623 | int *nr) _GPGME_DEPRECATED(0,4); | |
2114 | 2624 | |
2115 | 2625 | /* Release the trust item ITEM. Deprecated, use |
2116 | 2626 | gpgme_trust_item_unref. */ |
2132 | 2642 | const void *reserved, int idx) |
2133 | 2643 | _GPGME_DEPRECATED(0,4); |
2134 | 2644 | |
2135 | ||
2136 | ||
2137 | /* | |
2138 | * Audit log | |
2139 | */ | |
2140 | ||
2141 | /* Return the auditlog for the current session. This may be called | |
2142 | after a successful or failed operation. If no audit log is | |
2143 | available GPG_ERR_NO_DATA is returned. */ | |
2144 | gpgme_error_t gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output, | |
2145 | unsigned int flags); | |
2146 | gpgme_error_t gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, | |
2147 | unsigned int flags); | |
2148 | ||
2149 | ||
2150 | ||
2151 | /* | |
2152 | * Spawn interface | |
2153 | */ | |
2154 | ||
2155 | /* Flags for the spawn operations. */ | |
2156 | #define GPGME_SPAWN_DETACHED 1 | |
2157 | #define GPGME_SPAWN_ALLOW_SET_FG 2 | |
2158 | ||
2159 | ||
2160 | /* Run the command FILE with the arguments in ARGV. Connect stdin to | |
2161 | DATAIN, stdout to DATAOUT, and STDERR to DATAERR. If one the data | |
2162 | streams is NULL, connect to /dev/null instead. */ | |
2163 | gpgme_error_t gpgme_op_spawn_start (gpgme_ctx_t ctx, | |
2164 | const char *file, const char *argv[], | |
2165 | gpgme_data_t datain, | |
2166 | gpgme_data_t dataout, gpgme_data_t dataerr, | |
2167 | unsigned int flags); | |
2168 | gpgme_error_t gpgme_op_spawn (gpgme_ctx_t ctx, | |
2169 | const char *file, const char *argv[], | |
2170 | gpgme_data_t datain, | |
2171 | gpgme_data_t dataout, gpgme_data_t dataerr, | |
2172 | unsigned int flags); | |
2173 | ||
2174 | ||
2175 | /* | |
2176 | * Low-level Assuan protocol access. | |
2177 | */ | |
2178 | typedef gpgme_error_t (*gpgme_assuan_data_cb_t) | |
2179 | (void *opaque, const void *data, size_t datalen); | |
2180 | ||
2181 | typedef gpgme_error_t (*gpgme_assuan_inquire_cb_t) | |
2182 | (void *opaque, const char *name, const char *args, | |
2183 | gpgme_data_t *r_data); | |
2184 | ||
2185 | typedef gpgme_error_t (*gpgme_assuan_status_cb_t) | |
2186 | (void *opaque, const char *status, const char *args); | |
2187 | ||
2188 | /* Send the Assuan COMMAND and return results via the callbacks. | |
2189 | Asynchronous variant. */ | |
2190 | gpgme_error_t gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, | |
2191 | const char *command, | |
2192 | gpgme_assuan_data_cb_t data_cb, | |
2193 | void *data_cb_value, | |
2194 | gpgme_assuan_inquire_cb_t inq_cb, | |
2195 | void *inq_cb_value, | |
2196 | gpgme_assuan_status_cb_t stat_cb, | |
2197 | void *stat_cb_value); | |
2198 | ||
2199 | /* Send the Assuan COMMAND and return results via the callbacks. | |
2200 | Synchronous variant. */ | |
2201 | gpgme_error_t gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, | |
2202 | const char *command, | |
2203 | gpgme_assuan_data_cb_t data_cb, | |
2204 | void *data_cb_value, | |
2205 | gpgme_assuan_inquire_cb_t inq_cb, | |
2206 | void *inq_cb_value, | |
2207 | gpgme_assuan_status_cb_t stat_cb, | |
2208 | void *stat_cb_value, | |
2209 | gpgme_error_t *op_err); | |
2210 | ||
2211 | /* Compat. */ | |
2645 | /* Compat. | |
2646 | * This structure shall be considered read-only and an application | |
2647 | * must not allocate such a structure on its own. */ | |
2212 | 2648 | struct _gpgme_op_assuan_result |
2213 | 2649 | { |
2214 | 2650 | /* Deprecated. Use the second value in a DONE event or the |
2232 | 2668 | gpgme_assuan_status_cb_t status_cb, |
2233 | 2669 | void *status_cb_value) _GPGME_DEPRECATED(1,2); |
2234 | 2670 | |
2235 | ||
2236 | /* | |
2237 | * Crypto container support. | |
2238 | */ | |
2239 | ||
2240 | struct _gpgme_op_vfs_mount_result | |
2241 | { | |
2242 | char *mount_dir; | |
2243 | }; | |
2244 | typedef struct _gpgme_op_vfs_mount_result *gpgme_vfs_mount_result_t; | |
2245 | ||
2246 | gpgme_vfs_mount_result_t gpgme_op_vfs_mount_result (gpgme_ctx_t ctx); | |
2247 | ||
2248 | /* The container is automatically unmounted when the context is reset | |
2249 | or destroyed. Transmission errors are returned directly, | |
2250 | operational errors are returned in OP_ERR. */ | |
2251 | gpgme_error_t gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file, | |
2252 | const char *mount_dir, unsigned int flags, | |
2253 | gpgme_error_t *op_err); | |
2254 | ||
2255 | gpgme_error_t gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[], | |
2256 | const char *container_file, | |
2257 | unsigned int flags, gpgme_error_t *op_err); | |
2258 | ||
2259 | ||
2260 | /* | |
2261 | * Interface to gpgconf(1). | |
2262 | */ | |
2263 | ||
2264 | /* The expert level at which a configuration option or group of | |
2265 | options should be displayed. See the gpgconf(1) documentation for | |
2266 | more details. */ | |
2267 | typedef enum | |
2268 | { | |
2269 | GPGME_CONF_BASIC = 0, | |
2270 | GPGME_CONF_ADVANCED = 1, | |
2271 | GPGME_CONF_EXPERT = 2, | |
2272 | GPGME_CONF_INVISIBLE = 3, | |
2273 | GPGME_CONF_INTERNAL = 4 | |
2274 | } | |
2275 | gpgme_conf_level_t; | |
2276 | ||
2277 | ||
2278 | /* The data type of a configuration option argument. See the gpgconf(1) | |
2279 | documentation for more details. */ | |
2280 | typedef enum | |
2281 | { | |
2282 | /* Basic types. */ | |
2283 | GPGME_CONF_NONE = 0, | |
2284 | GPGME_CONF_STRING = 1, | |
2285 | GPGME_CONF_INT32 = 2, | |
2286 | GPGME_CONF_UINT32 = 3, | |
2287 | ||
2288 | /* Complex types. */ | |
2289 | GPGME_CONF_FILENAME = 32, | |
2290 | GPGME_CONF_LDAP_SERVER = 33, | |
2291 | GPGME_CONF_KEY_FPR = 34, | |
2292 | GPGME_CONF_PUB_KEY = 35, | |
2293 | GPGME_CONF_SEC_KEY = 36, | |
2294 | GPGME_CONF_ALIAS_LIST = 37 | |
2295 | } | |
2296 | gpgme_conf_type_t; | |
2297 | ||
2298 | /* For now, compatibility. */ | |
2299 | #define GPGME_CONF_PATHNAME GPGME_CONF_FILENAME | |
2300 | ||
2301 | ||
2302 | /* This represents a single argument for a configuration option. | |
2303 | Which of the members of value is used depends on the ALT_TYPE. */ | |
2304 | typedef struct gpgme_conf_arg | |
2305 | { | |
2306 | struct gpgme_conf_arg *next; | |
2307 | /* True if the option appears without an (optional) argument. */ | |
2308 | unsigned int no_arg; | |
2309 | union | |
2310 | { | |
2311 | unsigned int count; | |
2312 | unsigned int uint32; | |
2313 | int int32; | |
2314 | char *string; | |
2315 | } value; | |
2316 | } *gpgme_conf_arg_t; | |
2317 | ||
2318 | ||
2319 | /* The flags of a configuration option. See the gpgconf | |
2320 | documentation for details. */ | |
2321 | #define GPGME_CONF_GROUP (1 << 0) | |
2322 | #define GPGME_CONF_OPTIONAL (1 << 1) | |
2323 | #define GPGME_CONF_LIST (1 << 2) | |
2324 | #define GPGME_CONF_RUNTIME (1 << 3) | |
2325 | #define GPGME_CONF_DEFAULT (1 << 4) | |
2326 | #define GPGME_CONF_DEFAULT_DESC (1 << 5) | |
2327 | #define GPGME_CONF_NO_ARG_DESC (1 << 6) | |
2328 | #define GPGME_CONF_NO_CHANGE (1 << 7) | |
2329 | ||
2330 | ||
2331 | /* The representation of a single configuration option. See the | |
2332 | gpg-conf documentation for details. */ | |
2333 | typedef struct gpgme_conf_opt | |
2334 | { | |
2335 | struct gpgme_conf_opt *next; | |
2336 | ||
2337 | /* The option name. */ | |
2338 | char *name; | |
2339 | ||
2340 | /* The flags for this option. */ | |
2341 | unsigned int flags; | |
2342 | ||
2343 | /* The level of this option. */ | |
2344 | gpgme_conf_level_t level; | |
2345 | ||
2346 | /* The localized description of this option. */ | |
2347 | char *description; | |
2348 | ||
2349 | /* The type and alternate type of this option. */ | |
2350 | gpgme_conf_type_t type; | |
2351 | gpgme_conf_type_t alt_type; | |
2352 | ||
2353 | /* The localized (short) name of the argument, if any. */ | |
2354 | char *argname; | |
2355 | ||
2356 | /* The default value. */ | |
2357 | gpgme_conf_arg_t default_value; | |
2358 | char *default_description; | |
2359 | ||
2360 | /* The default value if the option is not set. */ | |
2361 | gpgme_conf_arg_t no_arg_value; | |
2362 | char *no_arg_description; | |
2363 | ||
2364 | /* The current value if the option is set. */ | |
2365 | gpgme_conf_arg_t value; | |
2366 | ||
2367 | /* The new value, if any. NULL means reset to default. */ | |
2368 | int change_value; | |
2369 | gpgme_conf_arg_t new_value; | |
2370 | ||
2371 | /* Free for application use. */ | |
2372 | void *user_data; | |
2373 | } *gpgme_conf_opt_t; | |
2374 | ||
2375 | ||
2376 | /* The representation of a component that can be configured. See the | |
2377 | gpg-conf documentation for details. */ | |
2378 | typedef struct gpgme_conf_comp | |
2379 | { | |
2380 | struct gpgme_conf_comp *next; | |
2381 | ||
2382 | /* Internal to GPGME, do not use! */ | |
2383 | gpgme_conf_opt_t *_last_opt_p; | |
2384 | ||
2385 | /* The component name. */ | |
2386 | char *name; | |
2387 | ||
2388 | /* A human-readable description for the component. */ | |
2389 | char *description; | |
2390 | ||
2391 | /* The program name (an absolute path to the program). */ | |
2392 | char *program_name; | |
2393 | ||
2394 | /* A linked list of options for this component. */ | |
2395 | struct gpgme_conf_opt *options; | |
2396 | } *gpgme_conf_comp_t; | |
2397 | ||
2398 | ||
2399 | /* Allocate a new gpgme_conf_arg_t. If VALUE is NULL, a "no arg | |
2400 | default" is prepared. If type is a string type, VALUE should point | |
2401 | to the string. Else, it should point to an unsigned or signed | |
2402 | integer respectively. */ | |
2403 | gpgme_error_t gpgme_conf_arg_new (gpgme_conf_arg_t *arg_p, | |
2404 | gpgme_conf_type_t type, const void *value); | |
2405 | ||
2406 | /* This also releases all chained argument structures! */ | |
2407 | void gpgme_conf_arg_release (gpgme_conf_arg_t arg, gpgme_conf_type_t type); | |
2408 | ||
2409 | /* Register a change for the value of OPT to ARG. If RESET is 1 (do | |
2410 | not use any values but 0 or 1), ARG is ignored and the option is | |
2411 | not changed (reverting a previous change). Otherwise, if ARG is | |
2412 | NULL, the option is cleared or reset to its default. */ | |
2413 | gpgme_error_t gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, | |
2414 | gpgme_conf_arg_t arg); | |
2415 | ||
2416 | /* Release a set of configurations. */ | |
2417 | void gpgme_conf_release (gpgme_conf_comp_t conf); | |
2418 | ||
2419 | /* Retrieve the current configurations. */ | |
2420 | gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p); | |
2421 | ||
2422 | /* Save the configuration of component comp. This function does not | |
2423 | follow chained components! */ | |
2424 | gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp); | |
2425 | ||
2426 | ||
2427 | /* Information about software versions. */ | |
2428 | typedef struct _gpgme_op_query_swdb_result | |
2429 | { | |
2430 | /* RFU */ | |
2431 | struct _gpgme_op_query_swdb_result *next; | |
2432 | ||
2433 | /* The name of the package (e.g. "gpgme", "gnupg") */ | |
2434 | char *name; | |
2435 | ||
2436 | /* The version number of the installed version. */ | |
2437 | char *iversion; | |
2438 | ||
2439 | /* The time the online info was created. */ | |
2440 | unsigned long created; | |
2441 | ||
2442 | /* The time the online info was retrieved. */ | |
2443 | unsigned long retrieved; | |
2444 | ||
2445 | /* This bit is set if an error occured or some of the information | |
2446 | * in this structure may not be set. */ | |
2447 | unsigned int warning : 1; | |
2448 | ||
2449 | /* An update is available. */ | |
2450 | unsigned int update : 1; | |
2451 | ||
2452 | /* The update is important. */ | |
2453 | unsigned int urgent : 1; | |
2454 | ||
2455 | /* No information at all available. */ | |
2456 | unsigned int noinfo : 1; | |
2457 | ||
2458 | /* The package name is not known. */ | |
2459 | unsigned int unknown : 1; | |
2460 | ||
2461 | /* The information here is too old. */ | |
2462 | unsigned int tooold : 1; | |
2463 | ||
2464 | /* Other error. */ | |
2465 | unsigned int error : 1; | |
2466 | ||
2467 | unsigned int _reserved : 25; | |
2468 | ||
2469 | /* The version number of the latest released version. */ | |
2470 | char *version; | |
2471 | ||
2472 | /* The release date of that version. */ | |
2473 | unsigned long reldate; | |
2474 | ||
2475 | } *gpgme_query_swdb_result_t; | |
2476 | ||
2477 | ||
2478 | /* Run the gpgconf --query-swdb command. */ | |
2479 | gpgme_error_t gpgme_op_query_swdb (gpgme_ctx_t ctx, | |
2480 | const char *name, const char *iversion, | |
2481 | unsigned int reserved); | |
2482 | ||
2483 | /* Return the result from the last query_swdb operation. */ | |
2484 | gpgme_query_swdb_result_t gpgme_op_query_swdb_result (gpgme_ctx_t ctx); | |
2485 | ||
2486 | ||
2487 | ||
2488 | ||
2489 | /* | |
2490 | * Various functions. | |
2491 | */ | |
2492 | ||
2493 | /* Set special global flags; consult the manual before use. */ | |
2494 | int gpgme_set_global_flag (const char *name, const char *value); | |
2495 | ||
2496 | /* Check that the library fulfills the version requirement. Note: | |
2497 | This is here only for the case where a user takes a pointer from | |
2498 | the old version of this function. The new version and macro for | |
2499 | run-time checks are below. */ | |
2500 | const char *gpgme_check_version (const char *req_version); | |
2501 | ||
2502 | /* Check that the library fulfills the version requirement and check | |
2503 | for struct layout mismatch involving bitfields. */ | |
2504 | const char *gpgme_check_version_internal (const char *req_version, | |
2505 | size_t offset_sig_validity); | |
2506 | ||
2507 | #define gpgme_check_version(req_version) \ | |
2508 | gpgme_check_version_internal (req_version, \ | |
2509 | offsetof (struct _gpgme_signature, validity)) | |
2510 | ||
2511 | /* Return the default values for various directories. */ | |
2512 | const char *gpgme_get_dirinfo (const char *what); | |
2513 | ||
2514 | /* Get the information about the configured and installed engines. A | |
2515 | pointer to the first engine in the statically allocated linked list | |
2516 | is returned in *INFO. If an error occurs, it is returned. The | |
2517 | returned data is valid until the next gpgme_set_engine_info. */ | |
2518 | gpgme_error_t gpgme_get_engine_info (gpgme_engine_info_t *engine_info); | |
2519 | ||
2520 | /* Set the default engine info for the protocol PROTO to the file name | |
2521 | FILE_NAME and the home directory HOME_DIR. */ | |
2522 | gpgme_error_t gpgme_set_engine_info (gpgme_protocol_t proto, | |
2523 | const char *file_name, | |
2524 | const char *home_dir); | |
2525 | ||
2526 | /* Verify that the engine implementing PROTO is installed and | |
2527 | available. */ | |
2528 | gpgme_error_t gpgme_engine_check_version (gpgme_protocol_t proto); | |
2529 | ||
2530 | ||
2531 | /* Reference counting for result objects. */ | |
2532 | void gpgme_result_ref (void *result); | |
2533 | void gpgme_result_unref (void *result); | |
2534 | ||
2535 | /* Return a public key algorithm string (e.g. "rsa2048"). Caller must | |
2536 | free using gpgme_free. */ | |
2537 | char *gpgme_pubkey_algo_string (gpgme_subkey_t subkey); | |
2538 | ||
2539 | /* Return a statically allocated string with the name of the public | |
2540 | key algorithm ALGO, or NULL if that name is not known. */ | |
2541 | const char *gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo); | |
2542 | ||
2543 | /* Return a statically allocated string with the name of the hash | |
2544 | algorithm ALGO, or NULL if that name is not known. */ | |
2545 | const char *gpgme_hash_algo_name (gpgme_hash_algo_t algo); | |
2546 | ||
2547 | /* Return the addr-spec from a user id. Caller must free the result | |
2548 | * with gpgme_free. */ | |
2549 | char *gpgme_addrspec_from_uid (const char *uid); | |
2550 | ||
2551 | ||
2552 | ||
2553 | /* | |
2554 | * Deprecated types. | |
2555 | */ | |
2671 | ||
2672 | ||
2556 | 2673 | typedef gpgme_ctx_t GpgmeCtx _GPGME_DEPRECATED(0,4); |
2557 | 2674 | typedef gpgme_data_t GpgmeData _GPGME_DEPRECATED(0,4); |
2558 | 2675 | typedef gpgme_error_t GpgmeError _GPGME_DEPRECATED(0,4); |
192 | 192 | |
193 | 193 | #define PARSE_NEXT(x) \ |
194 | 194 | (x) = strtol (args, &tail, 0); \ |
195 | if (errno || args == tail || *tail != ' ') \ | |
195 | if (errno || args == tail || !(*tail == ' ' || !*tail)) \ | |
196 | 196 | /* The crypto backend does not behave. */ \ |
197 | 197 | return trace_gpg_error (GPG_ERR_INV_ENGINE); \ |
198 | 198 | args = tail; |
248 | 248 | default: |
249 | 249 | break; |
250 | 250 | } |
251 | return 0; | |
251 | return err; | |
252 | 252 | } |
253 | 253 | |
254 | 254 |
235 | 235 | &uid->comment, dst); |
236 | 236 | |
237 | 237 | uid->address = _gpgme_mailbox_from_userid (uid->uid); |
238 | if (uid->address && uid->email && !strcmp (uid->address, uid->email)) | |
239 | { | |
240 | /* The ADDRESS is the same as EMAIL: Save some space. */ | |
241 | free (uid->address); | |
242 | uid->address = uid->email; | |
238 | if ((!uid->email || !*uid->email) && uid->address && uid->name | |
239 | && !strcmp (uid->name, uid->address)) | |
240 | { | |
241 | /* Name and address are the same. This is a mailbox only key. | |
242 | Use address as email and remove name. */ | |
243 | *uid->name = '\0'; | |
244 | uid->email = uid->address; | |
243 | 245 | } |
244 | 246 | |
245 | 247 | if (!key->uids) |
338 | 340 | while (subkey) |
339 | 341 | { |
340 | 342 | gpgme_subkey_t next = subkey->next; |
341 | if (subkey->fpr) | |
342 | free (subkey->fpr); | |
343 | if (subkey->curve) | |
344 | free (subkey->curve); | |
345 | if (subkey->keygrip) | |
346 | free (subkey->keygrip); | |
347 | if (subkey->card_number) | |
348 | free (subkey->card_number); | |
343 | free (subkey->fpr); | |
344 | free (subkey->curve); | |
345 | free (subkey->keygrip); | |
346 | free (subkey->card_number); | |
349 | 347 | free (subkey); |
350 | 348 | subkey = next; |
351 | 349 | } |
385 | 383 | tofu = tofu_next; |
386 | 384 | } |
387 | 385 | |
388 | if (uid->address && uid->address != uid->email) | |
389 | free (uid->address); | |
390 | ||
386 | free (uid->address); | |
391 | 387 | free (uid); |
392 | 388 | uid = next_uid; |
393 | 389 | } |
394 | 390 | |
395 | if (key->issuer_serial) | |
396 | free (key->issuer_serial); | |
397 | if (key->issuer_name) | |
398 | free (key->issuer_name); | |
399 | ||
400 | if (key->chain_id) | |
401 | free (key->chain_id); | |
402 | if (key->fpr) | |
403 | free (key->fpr); | |
391 | free (key->issuer_serial); | |
392 | free (key->issuer_name); | |
393 | free (key->chain_id); | |
394 | free (key->fpr); | |
404 | 395 | |
405 | 396 | free (key); |
406 | 397 | } |
415 | 415 | } |
416 | 416 | |
417 | 417 | |
418 | /* Parse the compliance field. */ | |
419 | static void | |
420 | parse_pub_field18 (gpgme_subkey_t subkey, char *field) | |
421 | { | |
422 | char *p, *endp; | |
423 | unsigned long ul; | |
424 | ||
425 | for (p = field; p && (ul = strtoul (p, &endp, 10)) && p != endp; p = endp) | |
426 | { | |
427 | switch (ul) | |
428 | { | |
429 | case 23: subkey->is_de_vs = 1; break; | |
430 | } | |
431 | } | |
432 | } | |
433 | ||
434 | ||
418 | 435 | /* Parse a tfs record. */ |
419 | 436 | static gpg_error_t |
420 | 437 | parse_tfs_record (gpgme_user_id_t uid, char **field, int nfield) |
534 | 551 | RT_SSB, RT_SEC, RT_CRT, RT_CRS, RT_REV, RT_SPK |
535 | 552 | } |
536 | 553 | rectype = RT_NONE; |
537 | #define NR_FIELDS 17 | |
554 | #define NR_FIELDS 20 | |
538 | 555 | char *field[NR_FIELDS]; |
539 | 556 | int fields = 0; |
540 | 557 | void *hook; |
711 | 728 | return gpg_error_from_syserror (); |
712 | 729 | } |
713 | 730 | |
731 | /* Field 18 has the compliance flags. */ | |
732 | if (fields >= 17 && *field[17]) | |
733 | parse_pub_field18 (subkey, field[17]); | |
734 | ||
735 | if (fields >= 20) | |
736 | { | |
737 | key->last_update = _gpgme_parse_timestamp_ul (field[18]); | |
738 | key->origin = 0; /* Fixme: Not yet defined in gpg. */ | |
739 | } | |
740 | ||
714 | 741 | break; |
715 | 742 | |
716 | 743 | case RT_SUB: |
784 | 811 | return gpg_error_from_syserror (); |
785 | 812 | } |
786 | 813 | |
814 | /* Field 18 has the compliance flags. */ | |
815 | if (fields >= 17 && *field[17]) | |
816 | parse_pub_field18 (subkey, field[17]); | |
817 | ||
787 | 818 | break; |
788 | 819 | |
789 | 820 | case RT_UID: |
792 | 823 | { |
793 | 824 | if (_gpgme_key_append_name (key, field[9], 1)) |
794 | 825 | return gpg_error (GPG_ERR_ENOMEM); /* FIXME */ |
795 | else | |
796 | { | |
797 | if (field[1]) | |
798 | set_userid_flags (key, field[1]); | |
799 | opd->tmp_uid = key->_last_uid; | |
800 | } | |
826 | ||
827 | if (field[1]) | |
828 | set_userid_flags (key, field[1]); | |
829 | opd->tmp_uid = key->_last_uid; | |
830 | if (fields >= 20) | |
831 | { | |
832 | opd->tmp_uid->last_update = _gpgme_parse_timestamp_ul (field[18]); | |
833 | opd->tmp_uid->origin = 0; /* Fixme: Not yet defined in gpg. */ | |
834 | } | |
801 | 835 | } |
802 | 836 | break; |
803 | 837 | |
1116 | 1150 | } |
1117 | 1151 | |
1118 | 1152 | |
1153 | /* Start a keylist operation within CTX to show keys contained | |
1154 | * in DATA. */ | |
1155 | gpgme_error_t | |
1156 | gpgme_op_keylist_from_data_start (gpgme_ctx_t ctx, gpgme_data_t data, | |
1157 | int reserved) | |
1158 | { | |
1159 | gpgme_error_t err; | |
1160 | void *hook; | |
1161 | op_data_t opd; | |
1162 | ||
1163 | TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_from_data_start", ctx); | |
1164 | ||
1165 | if (!ctx || !data || reserved) | |
1166 | return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); | |
1167 | ||
1168 | err = _gpgme_op_reset (ctx, 2); | |
1169 | if (err) | |
1170 | return TRACE_ERR (err); | |
1171 | ||
1172 | err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, | |
1173 | sizeof (*opd), release_op_data); | |
1174 | opd = hook; | |
1175 | if (err) | |
1176 | return TRACE_ERR (err); | |
1177 | ||
1178 | _gpgme_engine_set_status_handler (ctx->engine, keylist_status_handler, ctx); | |
1179 | err = _gpgme_engine_set_colon_line_handler (ctx->engine, | |
1180 | keylist_colon_handler, ctx); | |
1181 | if (err) | |
1182 | return TRACE_ERR (err); | |
1183 | ||
1184 | err = _gpgme_engine_op_keylist_data (ctx->engine, data); | |
1185 | return TRACE_ERR (err); | |
1186 | } | |
1187 | ||
1188 | ||
1119 | 1189 | /* Return the next key from the keylist in R_KEY. */ |
1120 | 1190 | gpgme_error_t |
1121 | 1191 | gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key) |
125 | 125 | |
126 | 126 | gpgme_op_query_swdb; |
127 | 127 | gpgme_op_query_swdb_result; |
128 | ||
129 | gpgme_op_set_uid_flag_start; | |
130 | gpgme_op_set_uid_flag; | |
131 | ||
132 | gpgme_op_decrypt_ext; | |
133 | gpgme_op_decrypt_ext_start; | |
128 | 134 | }; |
129 | 135 | |
130 | 136 | |
222 | 228 | gpgme_op_import_start; |
223 | 229 | gpgme_op_keylist_end; |
224 | 230 | gpgme_op_keylist_ext_start; |
231 | gpgme_op_keylist_from_data_start; | |
225 | 232 | gpgme_op_keylist_next; |
226 | 233 | gpgme_op_keylist_result; |
227 | 234 | gpgme_op_keylist_start; |
93 | 93 | _gpgme_release_result (ctx); |
94 | 94 | LOCK (ctx->lock); |
95 | 95 | ctx->canceled = 0; |
96 | ctx->redraw_suggested = 0; | |
96 | 97 | UNLOCK (ctx->lock); |
97 | 98 | |
98 | 99 | if (ctx->engine && no_reset) |
88 | 88 | gpgme_error_t _gpgme_decrypt_status_handler (void *priv, |
89 | 89 | gpgme_status_code_t code, |
90 | 90 | char *args); |
91 | gpgme_error_t _gpgme_decrypt_start (gpgme_ctx_t ctx, int synchronous, | |
92 | gpgme_decrypt_flags_t flags, | |
93 | gpgme_data_t cipher, gpgme_data_t plain); | |
91 | 94 | |
92 | 95 | |
93 | 96 | /* From signers.c. */ |
286 | 286 | int rc; |
287 | 287 | |
288 | 288 | /* Under Linux we can figure out the highest used file descriptor by |
289 | * reading /proc/self/fd. This is in the common cases much fast than | |
290 | * for example doing 4096 close calls where almost all of them will | |
291 | * fail. */ | |
292 | #ifdef __linux__ | |
293 | { | |
294 | DIR *dir = NULL; | |
295 | struct dirent *dir_entry; | |
296 | const char *s; | |
297 | int x; | |
298 | ||
299 | dir = opendir ("/proc/self/fd"); | |
300 | if (dir) | |
301 | { | |
302 | while ((dir_entry = readdir (dir))) | |
303 | { | |
304 | s = dir_entry->d_name; | |
305 | if ( *s < '0' || *s > '9') | |
306 | continue; | |
307 | x = atoi (s); | |
308 | if (x > fds) | |
309 | fds = x; | |
310 | } | |
311 | closedir (dir); | |
312 | } | |
313 | if (fds != -1) | |
314 | { | |
315 | fds++; | |
316 | source = "/proc"; | |
317 | } | |
318 | } | |
319 | #endif /* __linux__ */ | |
289 | * reading /proc/self/fd. This is in the common cases much faster | |
290 | * than for example doing 4096 close calls where almost all of them | |
291 | * will fail. | |
292 | * | |
293 | * Unfortunately we can't call opendir between fork and exec in a | |
294 | * multi-threaded process because opendir uses malloc and thus a | |
295 | * mutex which may deadlock with a malloc in another thread. Thus | |
296 | * the code is not used until we can have a opendir variant which | |
297 | * does not use malloc. */ | |
298 | /* #ifdef __linux__ */ | |
299 | /* { */ | |
300 | /* DIR *dir = NULL; */ | |
301 | /* struct dirent *dir_entry; */ | |
302 | /* const char *s; */ | |
303 | /* int x; */ | |
304 | ||
305 | /* dir = opendir ("/proc/self/fd"); */ | |
306 | /* if (dir) */ | |
307 | /* { */ | |
308 | /* while ((dir_entry = readdir (dir))) */ | |
309 | /* { */ | |
310 | /* s = dir_entry->d_name; */ | |
311 | /* if ( *s < '0' || *s > '9') */ | |
312 | /* continue; */ | |
313 | /* x = atoi (s); */ | |
314 | /* if (x > fds) */ | |
315 | /* fds = x; */ | |
316 | /* } */ | |
317 | /* closedir (dir); */ | |
318 | /* } */ | |
319 | /* if (fds != -1) */ | |
320 | /* { */ | |
321 | /* fds++; */ | |
322 | /* source = "/proc"; */ | |
323 | /* } */ | |
324 | /* } */ | |
325 | /* #endif /\* __linux__ *\/ */ | |
320 | 326 | |
321 | 327 | #ifdef RLIMIT_NOFILE |
322 | 328 | if (fds == -1) |
452 | 458 | /* Intermediate child to prevent zombie processes. */ |
453 | 459 | if ((pid = fork ()) == 0) |
454 | 460 | { |
455 | int max_fds = get_max_fds (); | |
456 | int fd; | |
457 | ||
458 | 461 | /* Child. */ |
462 | int max_fds = -1; | |
463 | int fd; | |
459 | 464 | int seen_stdin = 0; |
460 | 465 | int seen_stdout = 0; |
461 | 466 | int seen_stderr = 0; |
463 | 468 | if (atfork) |
464 | 469 | atfork (atforkvalue, 0); |
465 | 470 | |
466 | /* First close all fds which will not be inherited. */ | |
467 | for (fd = 0; fd < max_fds; fd++) | |
468 | { | |
469 | for (i = 0; fd_list[i].fd != -1; i++) | |
470 | if (fd_list[i].fd == fd) | |
471 | break; | |
472 | if (fd_list[i].fd == -1) | |
473 | close (fd); | |
474 | } | |
471 | /* First close all fds which will not be inherited. If we | |
472 | * have closefrom(2) we first figure out the highest fd we | |
473 | * do not want to close, then call closefrom, and on success | |
474 | * use the regular code to close all fds up to the start | |
475 | * point of closefrom. Note that Solaris' closefrom does | |
476 | * not return errors. */ | |
477 | #ifdef HAVE_CLOSEFROM | |
478 | { | |
479 | fd = -1; | |
480 | for (i = 0; fd_list[i].fd != -1; i++) | |
481 | if (fd_list[i].fd > fd) | |
482 | fd = fd_list[i].fd; | |
483 | fd++; | |
484 | #ifdef __sun | |
485 | closefrom (fd); | |
486 | max_fds = fd; | |
487 | #else /*!__sun */ | |
488 | while ((i = closefrom (fd)) && errno == EINTR) | |
489 | ; | |
490 | if (!i || errno == EBADF) | |
491 | max_fds = fd; | |
492 | #endif /*!__sun*/ | |
493 | } | |
494 | #endif /*HAVE_CLOSEFROM*/ | |
495 | if (max_fds == -1) | |
496 | max_fds = get_max_fds (); | |
497 | for (fd = 0; fd < max_fds; fd++) | |
498 | { | |
499 | for (i = 0; fd_list[i].fd != -1; i++) | |
500 | if (fd_list[i].fd == fd) | |
501 | break; | |
502 | if (fd_list[i].fd == -1) | |
503 | close (fd); | |
504 | } | |
475 | 505 | |
476 | 506 | /* And now dup and close those to be duplicated. */ |
477 | 507 | for (i = 0; fd_list[i].fd != -1; i++) |
30 | 30 | #include "debug.h" |
31 | 31 | |
32 | 32 | |
33 | /* The status handler for progress status lines which also monitors | |
34 | * the PINENTRY_LAUNCHED status. */ | |
33 | 35 | gpgme_error_t |
34 | 36 | _gpgme_progress_status_handler (void *priv, gpgme_status_code_t code, |
35 | 37 | char *args) |
40 | 42 | int type = 0; |
41 | 43 | int current = 0; |
42 | 44 | int total = 0; |
45 | ||
46 | if (code == GPGME_STATUS_PINENTRY_LAUNCHED) | |
47 | { | |
48 | ctx->redraw_suggested = 1; | |
49 | return 0; | |
50 | } | |
43 | 51 | |
44 | 52 | if (code != GPGME_STATUS_PROGRESS || !*args || !ctx->progress_cb) |
45 | 53 | return 0; |
94 | 94 | #define stpcpy(a,b) _gpgme_stpcpy ((a), (b)) |
95 | 95 | #endif /*!HAVE_STPCPY*/ |
96 | 96 | |
97 | #if !HAVE_VASPRINTF | |
98 | #include <stdarg.h> | |
99 | int vasprintf (char **result, const char *format, va_list args); | |
100 | int asprintf (char **result, const char *format, ...); | |
101 | #endif | |
97 | ||
98 | /* Due to a bug in mingw32's snprintf related to the 'l' modifier and | |
99 | for increased portability we use our snprintf on all systems. */ | |
100 | #undef snprintf | |
101 | #define snprintf gpgrt_snprintf | |
102 | ||
102 | 103 | |
103 | 104 | #if REPLACE_TTYNAME_R |
104 | 105 | int _gpgme_ttyname_r (int fd, char *buf, size_t buflen); |
163 | 164 | point to the next non-parsed character in TIMESTRING. */ |
164 | 165 | time_t _gpgme_parse_timestamp (const char *timestamp, char **endp); |
165 | 166 | |
167 | /* Variant of _gpgme_parse_timestamp to return an unsigned long or 0 | |
168 | * on error or missing timestamp. */ | |
169 | unsigned long _gpgme_parse_timestamp_ul (const char *timestamp); | |
166 | 170 | |
167 | 171 | gpgme_error_t _gpgme_map_gnupg_error (char *err); |
168 | 172 |
0 | /* Like vsprintf but provides a pointer to malloc'd storage, which must | |
1 | be freed by the caller. | |
2 | Copyright (C) 1994, 2002 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of the libiberty library. | |
5 | Libiberty is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Library General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2 of the License, or (at your option) any later version. | |
9 | ||
10 | Libiberty is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Library General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Library General Public | |
16 | License along with libiberty; see the file COPYING.LIB. If | |
17 | not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
18 | Boston, MA 02111-1307, USA. */ | |
19 | ||
20 | #ifdef HAVE_CONFIG_H | |
21 | #include <config.h> | |
22 | #endif | |
23 | #include <stdio.h> | |
24 | #include <string.h> | |
25 | #include <stdlib.h> | |
26 | #include <stdarg.h> | |
27 | ||
28 | ||
29 | #ifndef va_copy /* According to POSIX, va_copy is a macro. */ | |
30 | #if defined (__GNUC__) && defined (__PPC__) \ | |
31 | && (defined (_CALL_SYSV) || defined (_WIN32)) | |
32 | #define va_copy(d, s) (*(d) = *(s)) | |
33 | #elif defined (MUST_COPY_VA_BYVAL) | |
34 | #define va_copy(d, s) ((d) = (s)) | |
35 | #else | |
36 | #define va_copy(d, s) memcpy ((d), (s), sizeof (va_list)) | |
37 | #endif | |
38 | #endif | |
39 | ||
40 | ||
41 | #ifdef TEST | |
42 | int global_total_width; | |
43 | #endif | |
44 | ||
45 | static int int_vasprintf (char **, const char *, va_list *); | |
46 | ||
47 | static int | |
48 | int_vasprintf (result, format, args) | |
49 | char **result; | |
50 | const char *format; | |
51 | va_list *args; | |
52 | { | |
53 | #ifdef HAVE_W32CE_SYSTEM | |
54 | /* No va_copy and the replacement above doesn't work. */ | |
55 | #define MAX_STRLEN 256 | |
56 | *result = malloc (MAX_STRLEN); | |
57 | if (*result != NULL) | |
58 | { | |
59 | int res = _vsnprintf (*result, MAX_STRLEN, format, *args); | |
60 | (*result)[MAX_STRLEN - 1] = '\0'; | |
61 | return res; | |
62 | } | |
63 | else | |
64 | return 0; | |
65 | #else | |
66 | const char *p = format; | |
67 | /* Add one to make sure that it is never zero, which might cause malloc | |
68 | to return NULL. */ | |
69 | int total_width = strlen (format) + 1; | |
70 | va_list ap; | |
71 | ||
72 | va_copy (ap, *args); | |
73 | ||
74 | while (*p != '\0') | |
75 | { | |
76 | if (*p++ == '%') | |
77 | { | |
78 | while (strchr ("-+ #0", *p)) | |
79 | ++p; | |
80 | if (*p == '*') | |
81 | { | |
82 | ++p; | |
83 | total_width += abs (va_arg (ap, int)); | |
84 | } | |
85 | else | |
86 | total_width += strtoul (p, (char **) &p, 10); | |
87 | if (*p == '.') | |
88 | { | |
89 | ++p; | |
90 | if (*p == '*') | |
91 | { | |
92 | ++p; | |
93 | total_width += abs (va_arg (ap, int)); | |
94 | } | |
95 | else | |
96 | total_width += strtoul (p, (char **) &p, 10); | |
97 | } | |
98 | while (strchr ("hlL", *p)) | |
99 | ++p; | |
100 | /* Should be big enough for any format specifier except %s and floats. */ | |
101 | total_width += 30; | |
102 | switch (*p) | |
103 | { | |
104 | case 'd': | |
105 | case 'i': | |
106 | case 'o': | |
107 | case 'u': | |
108 | case 'x': | |
109 | case 'X': | |
110 | case 'c': | |
111 | (void) va_arg (ap, int); | |
112 | break; | |
113 | case 'f': | |
114 | case 'e': | |
115 | case 'E': | |
116 | case 'g': | |
117 | case 'G': | |
118 | (void) va_arg (ap, double); | |
119 | /* Since an ieee double can have an exponent of 307, we'll | |
120 | make the buffer wide enough to cover the gross case. */ | |
121 | total_width += 307; | |
122 | break; | |
123 | case 's': | |
124 | { | |
125 | char *tmp = va_arg (ap, char *); | |
126 | if (tmp) | |
127 | total_width += strlen (tmp); | |
128 | else /* in case the vsprintf does prints a text */ | |
129 | total_width += 25; /* e.g. "(null pointer reference)" */ | |
130 | } | |
131 | break; | |
132 | case 'p': | |
133 | case 'n': | |
134 | (void) va_arg (ap, char *); | |
135 | break; | |
136 | } | |
137 | p++; | |
138 | } | |
139 | } | |
140 | #ifdef TEST | |
141 | global_total_width = total_width; | |
142 | #endif | |
143 | *result = malloc (total_width); | |
144 | if (*result != NULL) | |
145 | return vsprintf (*result, format, *args); | |
146 | else | |
147 | return 0; | |
148 | #endif | |
149 | } | |
150 | ||
151 | int | |
152 | vasprintf (result, format, args) | |
153 | char **result; | |
154 | const char *format; | |
155 | #if defined (_BSD_VA_LIST_) && defined (__FreeBSD__) | |
156 | _BSD_VA_LIST_ args; | |
157 | #else | |
158 | va_list args; | |
159 | #endif | |
160 | { | |
161 | return int_vasprintf (result, format, &args); | |
162 | } | |
163 | ||
164 | ||
165 | int | |
166 | asprintf (char **buf, const char *fmt, ...) | |
167 | { | |
168 | int status; | |
169 | va_list ap; | |
170 | ||
171 | va_start (ap, fmt); | |
172 | status = vasprintf (buf, fmt, ap); | |
173 | va_end (ap); | |
174 | return status; | |
175 | } | |
176 | ||
177 | ||
178 | #ifdef TEST | |
179 | void | |
180 | checkit (const char* format, ...) | |
181 | { | |
182 | va_list args; | |
183 | char *result; | |
184 | ||
185 | va_start (args, format); | |
186 | vasprintf (&result, format, args); | |
187 | if (strlen (result) < global_total_width) | |
188 | printf ("PASS: "); | |
189 | else | |
190 | printf ("FAIL: "); | |
191 | printf ("%d %s\n", global_total_width, result); | |
192 | } | |
193 | ||
194 | int | |
195 | main (void) | |
196 | { | |
197 | checkit ("%d", 0x12345678); | |
198 | checkit ("%200d", 5); | |
199 | checkit ("%.300d", 6); | |
200 | checkit ("%100.150d", 7); | |
201 | checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\ | |
202 | 777777777777777777333333333333366666666666622222222222777777777777733333"); | |
203 | checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"); | |
204 | } | |
205 | #endif /* TEST */ |
45 | 45 | int did_prepare_new_sig; |
46 | 46 | int only_newsig_seen; |
47 | 47 | int plaintext_seen; |
48 | int conflict_user_seen; | |
48 | 49 | } *op_data_t; |
49 | 50 | |
50 | 51 | |
679 | 680 | goto leave; |
680 | 681 | } |
681 | 682 | |
683 | if (sig->key && sig->key->fpr && strcmp (sig->key->fpr, fpr)) | |
684 | { | |
685 | /* GnuPG since 2.1.17 emits multiple TOFU_USER lines with | |
686 | different fingerprints in case of conflicts for a signature. */ | |
687 | err = gpg_error (GPG_ERR_DUP_VALUE); | |
688 | goto leave; | |
689 | } | |
690 | ||
682 | 691 | args = tail; |
683 | 692 | tail = strchr (args, ' '); |
684 | 693 | if (tail == args) |
705 | 714 | else if (!sig->key->fpr) |
706 | 715 | { |
707 | 716 | err = trace_gpg_error (GPG_ERR_INTERNAL); |
708 | goto leave; | |
709 | } | |
710 | else if (strcmp (sig->key->fpr, fpr)) | |
711 | { | |
712 | /* The engine did not emit NEWSIG before a new key. */ | |
713 | err = trace_gpg_error (GPG_ERR_INV_ENGINE); | |
714 | 717 | goto leave; |
715 | 718 | } |
716 | 719 | |
929 | 932 | calc_sig_summary (sig); |
930 | 933 | err = prepare_new_sig (opd); |
931 | 934 | opd->only_newsig_seen = 1; |
935 | opd->conflict_user_seen = 0; | |
932 | 936 | return err; |
933 | 937 | |
934 | 938 | case GPGME_STATUS_GOODSIG: |
994 | 998 | |
995 | 999 | case GPGME_STATUS_TOFU_USER: |
996 | 1000 | opd->only_newsig_seen = 0; |
997 | return sig ? parse_tofu_user (sig, args, ctx->protocol) | |
998 | /* */ : trace_gpg_error (GPG_ERR_INV_ENGINE); | |
1001 | if (!sig) | |
1002 | return trace_gpg_error (GPG_ERR_INV_ENGINE); | |
1003 | err = parse_tofu_user (sig, args, ctx->protocol); | |
1004 | /* gpg emits TOFU User lines for each conflicting key. | |
1005 | * GPGME does not expose this to have a clean API and | |
1006 | * a GPGME user can do a keylisting with the address | |
1007 | * normalisation. | |
1008 | * So when a duplicated TOFU_USER line is encountered | |
1009 | * we ignore the conflicting tofu stats emited afterwards. | |
1010 | */ | |
1011 | if (gpg_err_code (err) == GPG_ERR_DUP_VALUE) | |
1012 | { | |
1013 | opd->conflict_user_seen = 1; | |
1014 | break; | |
1015 | } | |
1016 | opd->conflict_user_seen = 0; | |
1017 | return trace_gpg_error (err); | |
999 | 1018 | |
1000 | 1019 | case GPGME_STATUS_TOFU_STATS: |
1001 | 1020 | opd->only_newsig_seen = 0; |
1021 | if (opd->conflict_user_seen) | |
1022 | break; | |
1002 | 1023 | return sig ? parse_tofu_stats (sig, args) |
1003 | 1024 | /* */ : trace_gpg_error (GPG_ERR_INV_ENGINE); |
1004 | 1025 | |
1005 | 1026 | case GPGME_STATUS_TOFU_STATS_LONG: |
1006 | 1027 | opd->only_newsig_seen = 0; |
1028 | if (opd->conflict_user_seen) | |
1029 | break; | |
1007 | 1030 | return sig ? parse_tofu_stats_long (sig, args, ctx->raw_description) |
1008 | 1031 | /* */ : trace_gpg_error (GPG_ERR_INV_ENGINE); |
1009 | 1032 |
38 | 38 | VALUE "FileDescription", "GPGME - GnuPG Made Easy\0" |
39 | 39 | VALUE "FileVersion", "@LIBGPGME_LT_CURRENT@.@LIBGPGME_LT_AGE@.@LIBGPGME_LT_REVISION@.@BUILD_REVISION@\0" |
40 | 40 | VALUE "InternalName", "gpgme\0" |
41 | VALUE "LegalCopyright", "Copyright © 2001-2016 g10 Code GmbH\0" | |
41 | VALUE "LegalCopyright", "Copyright © 2001-2017 g10 Code GmbH\0" | |
42 | 42 | VALUE "LegalTrademarks", "\0" |
43 | 43 | VALUE "OriginalFilename", "gpgme.dll\0" |
44 | 44 | VALUE "PrivateBuild", "\0" |
137 | 137 | return gpg_error (GPG_ERR_UNUSABLE_PUBKEY); |
138 | 138 | } |
139 | 139 | |
140 | if (asprintf (&cmd, "RECIPIENT %s", recp[i]->subkeys->fpr) < 0) | |
140 | if (gpgrt_asprintf (&cmd, "RECIPIENT %s", recp[i]->subkeys->fpr) < 0) | |
141 | 141 | { |
142 | 142 | err = gpg_error_from_syserror (); |
143 | 143 | free (container_file_esc); |
146 | 146 | |
147 | 147 | err = gpgme_op_vfs_transact (ctx, cmd, NULL, NULL, NULL, NULL, |
148 | 148 | NULL, NULL, op_err); |
149 | free (cmd); | |
149 | gpgrt_free (cmd); | |
150 | 150 | if (err || *op_err) |
151 | 151 | { |
152 | 152 | free (container_file_esc); |
155 | 155 | recp++; |
156 | 156 | } |
157 | 157 | |
158 | if (asprintf (&cmd, "CREATE -- %s", container_file_esc) < 0) | |
158 | if (gpgrt_asprintf (&cmd, "CREATE -- %s", container_file_esc) < 0) | |
159 | 159 | { |
160 | 160 | err = gpg_error_from_syserror (); |
161 | 161 | free (container_file_esc); |
165 | 165 | |
166 | 166 | err = gpgme_op_vfs_transact (ctx, cmd, NULL, NULL, NULL, NULL, |
167 | 167 | NULL, NULL, op_err); |
168 | free (cmd); | |
168 | gpgrt_free (cmd); | |
169 | 169 | |
170 | 170 | return err; |
171 | 171 | } |
183 | 183 | if (err) |
184 | 184 | return err; |
185 | 185 | |
186 | if (asprintf (&cmd, "OPEN -- %s", container_file_esc) < 0) | |
186 | if (gpgrt_asprintf (&cmd, "OPEN -- %s", container_file_esc) < 0) | |
187 | 187 | { |
188 | 188 | err = gpg_error_from_syserror (); |
189 | 189 | free (container_file_esc); |
193 | 193 | |
194 | 194 | err = gpgme_op_vfs_transact (ctx, cmd, NULL, NULL, NULL, NULL, |
195 | 195 | NULL, NULL, op_err); |
196 | free (cmd); | |
196 | gpgrt_free (cmd); | |
197 | 197 | if (err || *op_err) |
198 | 198 | return err; |
199 | 199 | |
205 | 205 | if (err) |
206 | 206 | return err; |
207 | 207 | |
208 | if (asprintf (&cmd, "MOUNT -- %s", mount_dir_esc) < 0) | |
208 | if (gpgrt_asprintf (&cmd, "MOUNT -- %s", mount_dir_esc) < 0) | |
209 | 209 | { |
210 | 210 | err = gpg_error_from_syserror (); |
211 | 211 | free (mount_dir_esc); |
215 | 215 | } |
216 | 216 | else |
217 | 217 | { |
218 | if (asprintf (&cmd, "MOUNT") < 0) | |
218 | if (gpgrt_asprintf (&cmd, "MOUNT") < 0) | |
219 | 219 | return gpg_error_from_syserror (); |
220 | 220 | } |
221 | 221 | |
222 | 222 | err = gpgme_op_vfs_transact (ctx, cmd, NULL, NULL, NULL, NULL, |
223 | 223 | _gpgme_vfs_mount_status_handler, ctx, op_err); |
224 | free (cmd); | |
224 | gpgrt_free (cmd); | |
225 | 225 | |
226 | 226 | return err; |
227 | 227 | } |
699 | 699 | for (;;) |
700 | 700 | { |
701 | 701 | LOCK (ctx->mutex); |
702 | if (ctx->stop_me) | |
702 | if (ctx->stop_me && !ctx->nbytes) | |
703 | 703 | { |
704 | 704 | UNLOCK (ctx->mutex); |
705 | 705 | break; |
716 | 716 | TRACE_LOG ("got data to send"); |
717 | 717 | LOCK (ctx->mutex); |
718 | 718 | } |
719 | if (ctx->stop_me) | |
719 | if (ctx->stop_me && !ctx->nbytes) | |
720 | 720 | { |
721 | 721 | UNLOCK (ctx->mutex); |
722 | 722 | break; |
775 | 775 | TRACE_LOG ("waiting for close"); |
776 | 776 | WaitForSingleObject (ctx->close_ev, INFINITE); |
777 | 777 | |
778 | if (ctx->nbytes) | |
779 | TRACE_LOG1 ("still %d bytes in buffer at close time", ctx->nbytes); | |
780 | ||
778 | 781 | CloseHandle (ctx->close_ev); |
779 | 782 | CloseHandle (ctx->have_data); |
780 | 783 | CloseHandle (ctx->is_empty); |
890 | 893 | if (ctx->have_data) |
891 | 894 | SetEvent (ctx->have_data); |
892 | 895 | UNLOCK (ctx->mutex); |
896 | ||
897 | /* Give the writer a chance to flush the buffer. */ | |
898 | WaitForSingleObject (ctx->is_empty, INFINITE); | |
893 | 899 | |
894 | 900 | #ifdef HAVE_W32CE_SYSTEM |
895 | 901 | /* Scenario: We never create a full pipe, but already started |
1636 | 1642 | "with your installation.\n" |
1637 | 1643 | "Please report the problem to your " |
1638 | 1644 | "distributor of GpgME.\n\n" |
1639 | "Developers Note: The install dir can be " | |
1645 | "Developer's Note: The install dir can be " | |
1640 | 1646 | "manually set with: gpgme_set_global_flag", |
1641 | 1647 | _gpgme_get_inst_dir ()); |
1642 | 1648 | MessageBoxA (NULL, msg, "GpgME not installed correctly", MB_OK); |
1643 | free (msg); | |
1649 | gpgrt_free (msg); | |
1644 | 1650 | gpg_err_set_errno (EIO); |
1645 | 1651 | return TRACE_SYSRES (-1); |
1646 | 1652 | } |
576 | 576 | "Install Directory"); |
577 | 577 | if (tmp) |
578 | 578 | { |
579 | if (gpgrt_asprintf (&dir, "%s\\bin", tmp) == -1) | |
579 | dir = _gpgme_strconcat (tmp, "\\bin", NULL); | |
580 | free (tmp); | |
581 | if (!dir) | |
580 | 582 | return NULL; |
581 | free (tmp); | |
582 | 583 | } |
583 | 584 | } |
584 | 585 | if (dir) |
44 | 44 | |
45 | 45 | CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ |
46 | 46 | gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ |
47 | random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp | |
47 | random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp \ | |
48 | tofu.db *.conf.gpgconf.bak | |
48 | 49 | |
49 | 50 | private_keys = \ |
50 | 51 | 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \ |
33 | 33 | |
34 | 34 | #include <gpgme.h> |
35 | 35 | |
36 | ||
37 | #define fail_if_err(err) \ | |
38 | do \ | |
39 | { \ | |
40 | if (err) \ | |
41 | { \ | |
42 | fprintf (stderr, "%s:%d: %s: %s\n", \ | |
43 | __FILE__, __LINE__, gpgme_strsource (err), \ | |
44 | gpgme_strerror (err)); \ | |
45 | exit (1); \ | |
46 | } \ | |
47 | } \ | |
48 | while (0) | |
49 | ||
50 | ||
51 | void | |
52 | init_gpgme (gpgme_protocol_t proto) | |
53 | { | |
54 | gpgme_error_t err; | |
55 | ||
56 | gpgme_check_version (NULL); | |
57 | setlocale (LC_ALL, ""); | |
58 | gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); | |
59 | #ifndef HAVE_W32_SYSTEM | |
60 | gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); | |
61 | #endif | |
62 | ||
63 | err = gpgme_engine_check_version (proto); | |
64 | fail_if_err (err); | |
65 | } | |
66 | ||
36 | #include "t-support.h" | |
67 | 37 | |
68 | 38 | static char * |
69 | 39 | spaces (char *str, int extra) |
250 | 220 | |
251 | 221 | |
252 | 222 | int |
223 | lookup (gpgme_conf_comp_t conf, | |
224 | const char *component, | |
225 | const char *option, | |
226 | gpgme_conf_comp_t *comp, | |
227 | gpgme_conf_opt_t *opt) | |
228 | { | |
229 | *comp = conf; | |
230 | while (*comp && strcmp ((*comp)->name, component)) | |
231 | *comp = (*comp)->next; | |
232 | ||
233 | if (*comp) | |
234 | { | |
235 | *opt = (*comp)->options; | |
236 | while (*opt && strcmp ((*opt)->name, option)) | |
237 | *opt = (*opt)->next; | |
238 | ||
239 | /* Allow for the option not to be there. */ | |
240 | if (*opt) | |
241 | return 1; /* Found. */ | |
242 | } | |
243 | ||
244 | return 0; /* Not found. */ | |
245 | } | |
246 | ||
247 | #include <assert.h> | |
248 | ||
249 | ||
250 | int | |
253 | 251 | main (void) |
254 | 252 | { |
255 | 253 | gpgme_ctx_t ctx; |
257 | 255 | gpgme_conf_comp_t conf; |
258 | 256 | gpgme_conf_comp_t comp; |
259 | 257 | int first; |
260 | ||
261 | #ifndef ENABLE_GPGCONF | |
262 | return 0; | |
263 | #endif | |
258 | int i, N = 10; | |
264 | 259 | |
265 | 260 | init_gpgme (GPGME_PROTOCOL_GPGCONF); |
266 | 261 | |
282 | 277 | comp = comp->next; |
283 | 278 | } |
284 | 279 | |
285 | #if 1 | |
286 | 280 | /* Now change something. */ |
287 | { | |
288 | unsigned int count = 1; | |
281 | fprintf (stderr, " dirmngr.verbose "); | |
282 | for (i = 0; i < N; i++) { | |
283 | unsigned int count = i % 4 + 1; /* counts must not be zero */ | |
289 | 284 | gpgme_conf_arg_t arg; |
290 | 285 | gpgme_conf_opt_t opt; |
291 | 286 | |
292 | 287 | err = gpgme_conf_arg_new (&arg, GPGME_CONF_NONE, &count); |
293 | 288 | fail_if_err (err); |
294 | 289 | |
295 | comp = conf; | |
296 | while (comp && strcmp (comp->name, "dirmngr")) | |
297 | comp = comp->next; | |
298 | ||
299 | if (comp) | |
300 | { | |
301 | opt = comp->options; | |
302 | while (opt && strcmp (opt->name, "verbose")) | |
303 | opt = opt->next; | |
304 | ||
305 | /* Allow for the verbose option not to be there. */ | |
306 | if (opt) | |
307 | { | |
308 | err = gpgme_conf_opt_change (opt, 0, arg); | |
309 | fail_if_err (err); | |
310 | ||
311 | err = gpgme_op_conf_save (ctx, comp); | |
312 | fail_if_err (err); | |
313 | } | |
314 | } | |
290 | if (lookup (conf, "dirmngr", "verbose", &comp, &opt)) | |
291 | { | |
292 | /* Found. */ | |
293 | err = gpgme_conf_opt_change (opt, 0, arg); | |
294 | fail_if_err (err); | |
295 | ||
296 | err = gpgme_op_conf_save (ctx, comp); | |
297 | fail_if_err (err); | |
298 | } | |
299 | else | |
300 | { | |
301 | fprintf (stderr, "Skipping test, option dirmngr.verbose not found.\n"); | |
302 | break; | |
303 | } | |
304 | ||
305 | /* Reload config and verify that the value was updated. */ | |
306 | gpgme_conf_release (conf); | |
307 | err = gpgme_op_conf_load (ctx, &conf); | |
308 | fail_if_err (err); | |
309 | if (lookup (conf, "dirmngr", "verbose", &comp, &opt)) | |
310 | { | |
311 | /* Found. */ | |
312 | test (opt->alt_type == GPGME_CONF_NONE); | |
313 | test (opt->value); | |
314 | test ((unsigned long) opt->value->value.count == count); | |
315 | } | |
316 | ||
317 | fprintf (stderr, "."); | |
318 | fflush (stderr); | |
315 | 319 | } |
316 | #endif | |
320 | ||
321 | /* Now change something else. */ | |
322 | fprintf (stderr, " gpg.keyserver "); | |
323 | for (i = 0; i < N; i++) { | |
324 | const char *values[2] = { "hkp://foo.bar", "hkps://bar.foo" }; | |
325 | gpgme_conf_arg_t arg; | |
326 | gpgme_conf_opt_t opt; | |
327 | ||
328 | err = gpgme_conf_arg_new (&arg, GPGME_CONF_STRING, values[i%2]); | |
329 | fail_if_err (err); | |
330 | ||
331 | if (lookup (conf, "gpg", "keyserver", &comp, &opt)) | |
332 | { | |
333 | /* Found. */ | |
334 | test (opt->alt_type == GPGME_CONF_STRING); | |
335 | err = gpgme_conf_opt_change (opt, 0, arg); | |
336 | fail_if_err (err); | |
337 | ||
338 | err = gpgme_op_conf_save (ctx, comp); | |
339 | fail_if_err (err); | |
340 | } | |
341 | else | |
342 | { | |
343 | fprintf (stderr, "Skipping test, option gpg.keyserver not found.\n"); | |
344 | break; | |
345 | } | |
346 | ||
347 | /* Reload config and verify that the value was updated. */ | |
348 | gpgme_conf_release (conf); | |
349 | err = gpgme_op_conf_load (ctx, &conf); | |
350 | fail_if_err (err); | |
351 | if (lookup (conf, "gpg", "keyserver", &comp, &opt)) | |
352 | { | |
353 | /* Found. */ | |
354 | test (opt->alt_type == GPGME_CONF_STRING); | |
355 | test (opt->value); | |
356 | test (opt->value->value.string); | |
357 | test (strcmp (opt->value->value.string, values[i%2]) == 0); | |
358 | } | |
359 | ||
360 | fprintf (stderr, "."); | |
361 | fflush (stderr); | |
362 | } | |
363 | fprintf (stderr, "\n"); | |
317 | 364 | |
318 | 365 | gpgme_conf_release (conf); |
319 | ||
366 | gpgme_release (ctx); | |
320 | 367 | return 0; |
321 | 368 | } |
45 | 45 | } \ |
46 | 46 | } \ |
47 | 47 | while (0) |
48 | ||
49 | ||
50 | #ifdef GPGRT_HAVE_MACRO_FUNCTION | |
51 | void GPGRT_ATTR_NORETURN | |
52 | _test (const char *expr, const char *file, int line, | |
53 | const char *func) | |
54 | { | |
55 | fprintf (stderr, "Test \"%s\" in %s failed (%s:%d)\n", | |
56 | expr, func, file, line); | |
57 | exit (1); | |
58 | } | |
59 | # define test(expr) \ | |
60 | ((expr) \ | |
61 | ? (void) 0 \ | |
62 | : _test (#expr, __FILE__, __LINE__, __FUNCTION__)) | |
63 | #else /*!GPGRT_HAVE_MACRO_FUNCTION*/ | |
64 | void | |
65 | _test (const char *expr, const char *file, int line) | |
66 | { | |
67 | fprintf (stderr, "Test \"%s\" failed (%s:%d)\n", | |
68 | expr, file, line); | |
69 | exit (1); | |
70 | } | |
71 | # define test(expr) \ | |
72 | ((expr) \ | |
73 | ? (void) 0 \ | |
74 | : _test (#expr, __FILE__, __LINE__)) | |
75 | #endif /*!GPGRT_HAVE_MACRO_FUNCTION*/ | |
48 | 76 | |
49 | 77 | |
50 | 78 | static const char * |
31 | 31 | |
32 | 32 | #include "t-support.h" |
33 | 33 | |
34 | #define THREAD_COUNT 100 | |
34 | #define THREAD_COUNT 10 | |
35 | 35 | |
36 | 36 | static const char test_text1[] = "Just GNU it!\n"; |
37 | 37 | static const char test_sig1[] = |
31 | 31 | |
32 | 32 | #include "t-support.h" |
33 | 33 | |
34 | #define THREAD_COUNT 100 | |
34 | #define THREAD_COUNT 10 | |
35 | 35 | |
36 | 36 | void * |
37 | 37 | start_keylist (void *arg) |
79 | 79 | " --cms use the CMS protocol\n" |
80 | 80 | " --export-session-key show the session key\n" |
81 | 81 | " --override-session-key STRING use STRING as session key\n" |
82 | " --unwrap remove only the encryption layer\n" | |
82 | 83 | , stderr); |
83 | 84 | exit (ex); |
84 | 85 | } |
91 | 92 | gpgme_error_t err; |
92 | 93 | gpgme_ctx_t ctx; |
93 | 94 | gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP; |
95 | gpgme_decrypt_flags_t flags = 0; | |
94 | 96 | FILE *fp_in = NULL; |
95 | 97 | gpgme_data_t in = NULL; |
96 | 98 | gpgme_data_t out = NULL; |
98 | 100 | int print_status = 0; |
99 | 101 | int export_session_key = 0; |
100 | 102 | const char *override_session_key = NULL; |
103 | int raw_output = 0; | |
101 | 104 | |
102 | 105 | if (argc) |
103 | 106 | { argc--; argv++; } |
143 | 146 | if (!argc) |
144 | 147 | show_usage (1); |
145 | 148 | override_session_key = *argv; |
149 | argc--; argv++; | |
150 | } | |
151 | else if (!strcmp (*argv, "--unwrap")) | |
152 | { | |
153 | flags |= GPGME_DECRYPT_UNWRAP; | |
154 | raw_output = 1; | |
146 | 155 | argc--; argv++; |
147 | 156 | } |
148 | 157 | else if (!strncmp (*argv, "--", 2)) |
210 | 219 | exit (1); |
211 | 220 | } |
212 | 221 | |
213 | err = gpgme_op_decrypt (ctx, in, out); | |
222 | err = gpgme_op_decrypt_ext (ctx, flags, in, out); | |
214 | 223 | result = gpgme_op_decrypt_result (ctx); |
215 | 224 | if (err) |
216 | 225 | { |
219 | 228 | } |
220 | 229 | if (result) |
221 | 230 | { |
222 | print_result (result); | |
231 | if (!raw_output) | |
232 | print_result (result); | |
233 | if (!raw_output) | |
234 | fputs ("Begin Output:\n", stdout); | |
223 | 235 | print_data (out); |
236 | if (!raw_output) | |
237 | fputs ("End Output.\n", stdout); | |
224 | 238 | } |
225 | 239 | |
226 | 240 | gpgme_data_release (out); |
87 | 87 | " --uiserver use the UI server\n" |
88 | 88 | " --loopback use a loopback pinentry\n" |
89 | 89 | " --key NAME encrypt to key NAME\n" |
90 | " --throw-keyids use this option\n" | |
91 | " --wrap assume input is valid OpenPGP message\n" | |
90 | 92 | " --symmetric encrypt symmetric (OpenPGP only)\n" |
91 | 93 | , stderr); |
92 | 94 | exit (ex); |
169 | 171 | keyargs[keycount++] = *argv; |
170 | 172 | argc--; argv++; |
171 | 173 | } |
174 | else if (!strcmp (*argv, "--throw-keyids")) | |
175 | { | |
176 | flags |= GPGME_ENCRYPT_THROW_KEYIDS; | |
177 | argc--; argv++; | |
178 | } | |
179 | else if (!strcmp (*argv, "--wrap")) | |
180 | { | |
181 | flags |= GPGME_ENCRYPT_WRAP; | |
182 | argc--; argv++; | |
183 | } | |
172 | 184 | else if (!strcmp (*argv, "--loopback")) |
173 | 185 | { |
174 | 186 | use_loopback = 1; |
203 | 203 | " for addkey: FPR [ALGO [USAGE [EXPIRESECONDS]]]\n" |
204 | 204 | " for adduid: FPR USERID\n" |
205 | 205 | " for revuid: FPR USERID\n" |
206 | " for set-primary: FPR USERID\n" | |
206 | 207 | "Options:\n" |
207 | 208 | " --addkey add a subkey to the key with FPR\n" |
208 | 209 | " --adduid add a user id to the key with FPR\n" |
209 | " --revuid Revoke a user id from the key with FPR\n" | |
210 | " --revuid revoke a user id from the key with FPR\n" | |
211 | " --set-primary set the primary key flag on USERID\n" | |
210 | 212 | " --verbose run in verbose mode\n" |
211 | 213 | " --status print status lines from the backend\n" |
212 | 214 | " --progress print progress info\n" |
233 | 235 | int addkey = 0; |
234 | 236 | int adduid = 0; |
235 | 237 | int revuid = 0; |
238 | int setpri = 0; | |
236 | 239 | const char *userid; |
237 | 240 | const char *algo = NULL; |
238 | 241 | const char *newuserid = NULL; |
258 | 261 | addkey = 1; |
259 | 262 | adduid = 0; |
260 | 263 | revuid = 0; |
264 | setpri = 0; | |
261 | 265 | argc--; argv++; |
262 | 266 | } |
263 | 267 | else if (!strcmp (*argv, "--adduid")) |
265 | 269 | addkey = 0; |
266 | 270 | adduid = 1; |
267 | 271 | revuid = 0; |
272 | setpri = 0; | |
268 | 273 | argc--; argv++; |
269 | 274 | } |
270 | 275 | else if (!strcmp (*argv, "--revuid")) |
272 | 277 | addkey = 0; |
273 | 278 | adduid = 0; |
274 | 279 | revuid = 1; |
280 | setpri = 0; | |
281 | argc--; argv++; | |
282 | } | |
283 | else if (!strcmp (*argv, "--set-primary")) | |
284 | { | |
285 | addkey = 0; | |
286 | adduid = 0; | |
287 | revuid = 0; | |
288 | setpri = 1; | |
275 | 289 | argc--; argv++; |
276 | 290 | } |
277 | 291 | else if (!strcmp (*argv, "--verbose")) |
318 | 332 | show_usage (1); |
319 | 333 | } |
320 | 334 | |
321 | if (adduid || revuid) | |
335 | if (adduid || revuid || setpri) | |
322 | 336 | { |
323 | 337 | if (argc != 2) |
324 | 338 | show_usage (1); |
357 | 371 | gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); |
358 | 372 | } |
359 | 373 | |
360 | if (addkey || adduid || revuid) | |
374 | if (addkey || adduid || revuid || setpri) | |
361 | 375 | { |
362 | 376 | gpgme_key_t akey; |
363 | 377 | |
399 | 413 | exit (1); |
400 | 414 | } |
401 | 415 | } |
416 | else if (setpri) | |
417 | { | |
418 | err = gpgme_op_set_uid_flag (ctx, akey, newuserid, "primary", NULL); | |
419 | if (err) | |
420 | { | |
421 | fprintf (stderr, PGM ": gpgme_op_set_uid_flag failed: %s\n", | |
422 | gpg_strerror (err)); | |
423 | exit (1); | |
424 | } | |
425 | } | |
402 | 426 | gpgme_key_unref (akey); |
403 | 427 | } |
404 | 428 | else |
412 | 436 | } |
413 | 437 | } |
414 | 438 | |
415 | result = gpgme_op_genkey_result (ctx); | |
416 | if (!result) | |
417 | { | |
418 | fprintf (stderr, PGM": gpgme_op_genkey_result returned NULL\n"); | |
419 | exit (1); | |
420 | } | |
421 | ||
422 | printf ("Generated key: %s (%s)\n", | |
423 | result->fpr ? result->fpr : "none", | |
424 | result->primary ? (result->sub ? "primary, sub" : "primary") | |
425 | /**/ : (result->sub ? "sub" : "none")); | |
426 | ||
427 | if (result->fpr && strlen (result->fpr) < 40) | |
428 | fprintf (stderr, PGM": generated key has unexpected fingerprint\n"); | |
429 | if (!result->primary) | |
430 | fprintf (stderr, PGM": primary key was not generated\n"); | |
431 | if (!result->sub) | |
432 | fprintf (stderr, PGM": sub key was not generated\n"); | |
433 | if (!result->uid) | |
434 | fprintf (stderr, PGM": uid was not generated\n"); | |
439 | if (!setpri) | |
440 | { | |
441 | result = gpgme_op_genkey_result (ctx); | |
442 | if (!result) | |
443 | { | |
444 | fprintf (stderr, PGM": gpgme_op_genkey_result returned NULL\n"); | |
445 | exit (1); | |
446 | } | |
447 | ||
448 | printf ("Generated key: %s (%s)\n", | |
449 | result->fpr ? result->fpr : "none", | |
450 | result->primary ? (result->sub ? "primary, sub" : "primary") | |
451 | /**/ : (result->sub ? "sub" : "none")); | |
452 | ||
453 | if (result->fpr && strlen (result->fpr) < 40) | |
454 | fprintf (stderr, PGM": generated key has unexpected fingerprint\n"); | |
455 | if (!result->primary) | |
456 | fprintf (stderr, PGM": primary key was not generated\n"); | |
457 | if (!result->sub) | |
458 | fprintf (stderr, PGM": sub key was not generated\n"); | |
459 | if (!result->uid) | |
460 | fprintf (stderr, PGM": uid was not generated\n"); | |
461 | } | |
435 | 462 | |
436 | 463 | gpgme_release (ctx); |
437 | 464 | return 0; |
40 | 40 | static int |
41 | 41 | show_usage (int ex) |
42 | 42 | { |
43 | fputs ("usage: " PGM " [options] [USERID]\n\n" | |
43 | fputs ("usage: " PGM " [options] [USERID_or_FILE]\n\n" | |
44 | 44 | "Options:\n" |
45 | 45 | " --verbose run in verbose mode\n" |
46 | 46 | " --openpgp use the OpenPGP protocol (default)\n" |
55 | 55 | " --validate use GPGME_KEYLIST_MODE_VALIDATE\n" |
56 | 56 | " --import import all keys\n" |
57 | 57 | " --offline use offline mode\n" |
58 | " --from-file list all keys in the given file\n" | |
58 | 59 | " --require-gnupg required at least the given GnuPG version\n" |
59 | 60 | , stderr); |
60 | 61 | exit (ex); |
97 | 98 | gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP; |
98 | 99 | int only_secret = 0; |
99 | 100 | int offline = 0; |
101 | int from_file = 0; | |
102 | gpgme_data_t data = NULL; | |
103 | ||
100 | 104 | |
101 | 105 | if (argc) |
102 | 106 | { argc--; argv++; } |
176 | 180 | offline = 1; |
177 | 181 | argc--; argv++; |
178 | 182 | } |
183 | else if (!strcmp (*argv, "--from-file")) | |
184 | { | |
185 | from_file = 1; | |
186 | argc--; argv++; | |
187 | } | |
179 | 188 | else if (!strcmp (*argv, "--require-gnupg")) |
180 | 189 | { |
181 | 190 | argc--; argv++; |
190 | 199 | |
191 | 200 | if (argc > 1) |
192 | 201 | show_usage (1); |
202 | else if (from_file && !argc) | |
203 | show_usage (1); | |
193 | 204 | |
194 | 205 | init_gpgme (protocol); |
195 | 206 | |
201 | 212 | |
202 | 213 | gpgme_set_offline (ctx, offline); |
203 | 214 | |
204 | err = gpgme_op_keylist_start (ctx, argc? argv[0]:NULL, only_secret); | |
215 | if (from_file) | |
216 | { | |
217 | err = gpgme_data_new_from_file (&data, *argv, 1); | |
218 | fail_if_err (err); | |
219 | ||
220 | err = gpgme_op_keylist_from_data_start (ctx, data, 0); | |
221 | } | |
222 | else | |
223 | err = gpgme_op_keylist_start (ctx, argc? argv[0]:NULL, only_secret); | |
205 | 224 | fail_if_err (err); |
206 | 225 | |
207 | 226 | while (!(err = gpgme_op_keylist_next (ctx, &key))) |
222 | 241 | key->can_sign? "s":"", |
223 | 242 | key->can_certify? "c":"", |
224 | 243 | key->can_authenticate? "a":""); |
225 | printf ("flags :%s%s%s%s%s%s%s\n", | |
244 | printf ("flags :%s%s%s%s%s%s%s%s\n", | |
226 | 245 | key->secret? " secret":"", |
227 | 246 | key->revoked? " revoked":"", |
228 | 247 | key->expired? " expired":"", |
229 | 248 | key->disabled? " disabled":"", |
230 | 249 | key->invalid? " invalid":"", |
231 | key->is_qualified? " qualifid":"", | |
250 | key->is_qualified? " qualified":"", | |
251 | key->subkeys && key->subkeys->is_de_vs? " de-vs":"", | |
232 | 252 | key->subkeys && key->subkeys->is_cardkey? " cardkey":""); |
253 | printf ("upd : %lu (%u)\n", key->last_update, key->origin); | |
233 | 254 | |
234 | 255 | subkey = key->subkeys; |
235 | 256 | if (subkey) |
247 | 268 | subkey->can_sign? "s":"", |
248 | 269 | subkey->can_certify? "c":"", |
249 | 270 | subkey->can_authenticate? "a":""); |
250 | printf ("flags %2d:%s%s%s%s%s%s%s\n", | |
271 | printf ("flags %2d:%s%s%s%s%s%s%s%s\n", | |
251 | 272 | nsub, |
252 | 273 | subkey->secret? " secret":"", |
253 | 274 | subkey->revoked? " revoked":"", |
254 | 275 | subkey->expired? " expired":"", |
255 | 276 | subkey->disabled? " disabled":"", |
256 | 277 | subkey->invalid? " invalid":"", |
257 | subkey->is_qualified? " qualifid":"", | |
278 | subkey->is_qualified? " qualified":"", | |
279 | subkey->is_de_vs? " de-vs":"", | |
258 | 280 | subkey->is_cardkey? " cardkey":""); |
259 | 281 | } |
260 | 282 | for (nuids=0, uid=key->uids; uid; uid = uid->next, nuids++) |
267 | 289 | printf (" name: %s\n", uid->name); |
268 | 290 | if (uid->comment) |
269 | 291 | printf (" cmmnt: %s\n", uid->comment); |
292 | printf (" upd: %lu (%u)\n", uid->last_update, uid->origin); | |
270 | 293 | printf (" valid: %s\n", |
271 | 294 | uid->validity == GPGME_VALIDITY_UNKNOWN? "unknown": |
272 | 295 | uid->validity == GPGME_VALIDITY_UNDEFINED? "undefined": |
319 | 342 | err = gpgme_op_keylist_end (ctx); |
320 | 343 | fail_if_err (err); |
321 | 344 | keyarray[keyidx] = NULL; |
345 | gpgme_data_release (data); | |
322 | 346 | |
323 | 347 | result = gpgme_op_keylist_result (ctx); |
324 | 348 | if (result->truncated) |
102 | 102 | int print_status = 0; |
103 | 103 | int use_loopback = 0; |
104 | 104 | const char *sender = NULL; |
105 | const char *s; | |
105 | 106 | |
106 | 107 | if (argc) |
107 | 108 | { argc--; argv++; } |
228 | 229 | exit (1); |
229 | 230 | } |
230 | 231 | |
232 | if ((s = gpgme_get_ctx_flag (ctx, "redraw")) && *s) | |
233 | fputs ("Screen redraw suggested\n", stdout); | |
234 | ||
231 | 235 | fputs ("Begin Output:\n", stdout); |
232 | 236 | print_data (out); |
233 | 237 | fputs ("End Output.\n", stdout); |
14 | 14 | |
15 | 15 | GPG_AGENT_INFO= |
16 | 16 | export GPG_AGENT_INFO |
17 | GPG_AGENT=$(which gpg-agent) | |
17 | 18 | |
18 | 19 | token=$(echo "gpgme-$(pwd)" | tr ' ' '_') |
19 | 20 | |
20 | 21 | if [ "$1" = "--stop" ]; then |
21 | if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ | |
22 | if [ "$(gpg-connect-agent --no-autostart getval\ $token /bye 2>/dev/null | head -1)" \ | |
22 | 23 | != "D set" ]; then |
23 | 24 | echo "gpg-agent not running" >&2 |
24 | 25 | exit 0 |
28 | 29 | exit 0 |
29 | 30 | fi |
30 | 31 | |
31 | if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ | |
32 | if [ "$(gpg-connect-agent --no-autostart getval\ $token /bye 2>/dev/null | head -1)" \ | |
32 | 33 | = "D set" ]; then |
33 | 34 | echo "gpg-agent already running" >&2 |
34 | 35 | exit 0 |
35 | 36 | fi |
36 | 37 | |
37 | echo "starting gpg-agent " >&2 | |
38 | gpg-connect-agent putval\ $token\ set /bye >/dev/null 2>&1 | |
39 | if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ | |
38 | echo "starting gpg-agent.." >&2 | |
39 | ||
40 | # GnuPG prior to 2.1.12 needs --allow-loopback-pinentry for the | |
41 | # loopback entry to work. Old versions do not understand this though, | |
42 | # so we need to be careful. | |
43 | if "$GPG_AGENT" --gpgconf-test --allow-loopback-pinentry && | |
44 | test -f "$GNUPGHOME/gpg-agent.conf" && | |
45 | ! grep -q allow-loopback-pinentry "$GNUPGHOME/gpg-agent.conf"; then | |
46 | echo allow-loopback-pinentry >> "$GNUPGHOME/gpg-agent.conf" | |
47 | fi | |
48 | ||
49 | gpg-connect-agent --agent-program="${GPG_AGENT}|--debug-quick-random" putval\ $token\ set /bye | |
50 | if [ $? -ne 0 -o "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ | |
40 | 51 | != "D set" ]; then |
41 | 52 | echo "error starting gpg-agent" >&2 |
42 | 53 | exit 1 |