Codebase list gpgme1.0 / 14b148b
python: Allow returning signatures made by unknown keys in `decrypt` -- This functionality got dropped somewhere after 1.12, as part of the cleanup of the `Context.decrypt` call signature. Reintroduce it again, now using an explicit keyword argument `filter_signatures` (which defaults to hiding signatures by unknown keys). GnuPG-bug-id: 5292 Jasper Spaans authored 3 years ago Werner Koch committed 2 years ago
2 changed file(s) with 12 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
55 * cpp, qt: Add support for trust signatures. [#5421]
66
77 * qt: Add support for flags in LDAP server options. [#5217]
8
9 * python: New optional parameter filter_signatures for decrypt.
10 [#5292]
811
912 * Interface changes relative to the 1.15.1 release:
1013 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
341341
342342 return self.__read__(sink, ciphertext), result, sig_result
343343
344 def decrypt(self, ciphertext, sink=None, passphrase=None, verify=True):
344 def decrypt(self, ciphertext, sink=None, passphrase=None, verify=True, filter_signatures=True):
345345 """Decrypt data
346346
347347 Decrypt the given ciphertext and verify any signatures. If
353353 signatures are required and no MissingSignatures error will be
354354 raised).
355355
356 The filter_signatures argument can be used to force this
357 function to return signatures that are not fully trusted - for
358 example because they were made by unknown keys.
359
356360 If the ciphertext is symmetrically encrypted using a
357361 passphrase, that passphrase can be given as parameter, using a
358362 callback registered at the context, or out-of-band via
363367 passphrase -- for symmetric decryption
364368 verify -- check signatures (boolean or iterable of keys,
365369 see above) (default True)
370 filter_signatures -- if this function should filter out signatures
371 that are not completely OK (default True)
366372
367373 Returns:
368374 plaintext -- the decrypted data (or None if sink is given)
436442 results=results)
437443
438444 if do_sig_verification:
439 # filter out all invalid signatures
440 verify_result.signatures = list(filter(lambda s: s.status == errors.NO_ERROR, verify_result.signatures))
445 if filter_signatures:
446 verify_result.signatures = list(filter(lambda s: s.status == errors.NO_ERROR, verify_result.signatures))
441447 if required_keys is not None:
442448 missing = []
443449 for key in required_keys: