Merge pull request #394 from ignaloidas/default-to-3DES

Default to 3DES when preferred algorithms don't have any supporting algorithm
This commit is contained in:
Michael Greene
2022-11-02 21:24:56 -07:00
committed by GitHub
2 changed files with 23 additions and 1 deletions

View File

@@ -2437,7 +2437,7 @@ class PGPKey(Armorable, ParentRef, PGPObject):
uid = next(iter(self.userids), None)
if uid is None and self.parent is not None:
uid = next(iter(self.parent.userids), None)
pref_cipher = next(c for c in uid.selfsig.cipherprefs if c.is_supported)
pref_cipher = next((c for c in uid.selfsig.cipherprefs if c.is_supported), SymmetricKeyAlgorithm.TripleDES)
cipher_algo = prefs.pop('cipher', pref_cipher)
if cipher_algo not in uid.selfsig.cipherprefs: