From d6c3ecfe649a87f12fd52eea37a64abf6751f685 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 26 Sep 2012 15:38:22 -0400 Subject: [PATCH] signature: add 0:'none' to _public_key_algorithm_enum. This avoids crashing with: Exception raised: Traceback (most recent call last): ... File "/home/wking/src/pgp-mime/pgp_mime/signature.py", line 264, in set_public_key_algorithm self.public_key_algorithm = self._public_key_algorithm_enum[value] KeyError: 0 When `gpgme-tool` responds with signatures like: ... (null) ... which I was coming up in the test suite (I'm not sure why). --- pgp_mime/signature.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pgp_mime/signature.py b/pgp_mime/signature.py index 1f7a1d2..23a0128 100644 --- a/pgp_mime/signature.py +++ b/pgp_mime/signature.py @@ -158,6 +158,7 @@ class Signature (object): _validity_enum_inv = dict((v,k) for k,v in _validity_enum.items()) _public_key_algorithm_enum = { # GPGME_PK_* in gpgme.h + 0: 'none', 1: 'RSA', # Rivest, Shamir, Adleman 2: 'RSA for encryption and decryption only', 3: 'RSA for signing and verification only', -- 2.26.2