From 30a4b63d66918937fc17cef798a52e12fe316844 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 10 Oct 2012 16:04:10 +0200 Subject: apt/auth.py,tests/test_auth.py: be robust against lower case keyids --- apt/auth.py | 5 +++-- tests/test_auth.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apt/auth.py b/apt/auth.py index 9d001af0..eff13b1a 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -175,8 +175,9 @@ def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): got_fingerprint = line.split(":")[9] # stop after the first to ensure no subkey trickery break - # strip the leading "0x" is there is one - signing_key_fingerprint = keyid.replace("0x", "") + # strip the leading "0x" is there is one and uppercase (as this is + # what gnupg is using) + signing_key_fingerprint = keyid.replace("0x", "").upper() if got_fingerprint != signing_key_fingerprint: raise AptKeyError( "Fingerprints do not match, not importing: '%s' != '%s'" % ( diff --git a/tests/test_auth.py b/tests/test_auth.py index ade2f1b9..d742a471 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -207,7 +207,8 @@ class TestAuthKeys(unittest.TestCase): self.addCleanup(self._stop_keyserver) apt.auth.add_key_from_keyserver( - "0xA1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553", "hkp://localhost:19191") + "0xa1bD8E9D78F7FE5C3E65D8AF8B48AD6246925553", + "hkp://localhost:19191") ret = apt.auth.list_keys() self.assertEqual(len(ret), 1) -- cgit v1.2.3