dnf/0005-tests-Use-PGP-keys-without-SHA-1.patch
2024-07-24 12:11:49 +02:00

163 lines
8.1 KiB
Diff

From b23e3fbd8747fdf89c2a90d6ffd899fc53378aa3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 23 Jul 2024 14:56:46 +0200
Subject: [PATCH] tests: Use PGP keys without SHA-1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Tests failed on RHEL 10 where SHA-1 is disabled in a DEFAULT crypto
policy and where librepo is configured to use rpm-sequoia which
respects the crypto policy (in contrast to gpgme):
1: ======================================================================
1: FAIL: test_rawkey2infos (tests.test_crypto.CryptoTest.test_rawkey2infos)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1: File "/home/test/rhel/dnf/dnf-4.20.0/tests/test_crypto.py", line 75, in test_rawkey2infos
1: self.assertEqual(info.userid, 'Dandy Fied <dnf@example.com>')
1: AssertionError: '' != 'Dandy Fied <dnf@example.com>'
1: + Dandy Fied <dnf@example.com>
The root cause was that tests/keys/key.pub used the SHA-1 digest
algorithm.
This patch replaces that key with a 4096-bit RSA key signed using
SHA-384 digest algorithm.
Resolves: https://issues.redhat.com/browse/RHEL-50218
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
tests/keys/key.pub | 75 ++++++++++++++++++++++++++++----------------
tests/test_crypto.py | 14 ++++-----
2 files changed, 55 insertions(+), 34 deletions(-)
diff --git a/tests/keys/key.pub b/tests/keys/key.pub
index 1b4ad15b7..750e51ac1 100644
--- a/tests/keys/key.pub
+++ b/tests/keys/key.pub
@@ -1,30 +1,51 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1
-mQENBFP0iHYBCADWDO8H+0nIqGgTUisRjjWj9zknXks8PgGIyWydBSjJh84d3lqw
-Tv+RAxClR2j1YBoyMGT9DxN7NwzneQ6Rj4pIP+Z9LYPA7TFYXiSIws1n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4WOVx5Qg
+03k28pKwSd8+S/6Q6o8+HQgQvSF/fYijE/sk0H9RQdQYUIAKnGdRGILTMu540n/R
+rQFB6pjPhOoo5LB6DSEOpB0eRaZn+H40rg8E9F7dXrMR6q9WsyVWMdCkosLqxmVy
+kwsp+iTOMOmOx37EpxYCXtIeYazMoaL9fKYjnaN6kt4CxvlCGLpxTnNMNtCHoU9N
+3bQZ5RxBa+R0l6xzMvwpkuCQEa59SdfOwo5uCUTgGTMm5hsJ060LW4Vupg==
+=P1HS
-----END PGP PUBLIC KEY BLOCK-----
diff --git a/tests/test_crypto.py b/tests/test_crypto.py
index bb55d2203..dbbcfd630 100644
--- a/tests/test_crypto.py
+++ b/tests/test_crypto.py
@@ -30,7 +30,7 @@ import dnf.yum.misc
import tests.support
-FINGERPRINT = '0BE49FAF9C955F4F1A98D14B24362A8492530C8E'
+FINGERPRINT = '88FBCE424BA9952A141A6A297B5443AEAA6F01F3'
KEYFILE = tests.support.resource_path('keys/key.pub')
KEYFILE_URL = 'file://%s' % KEYFILE
@@ -53,11 +53,11 @@ class CryptoTest(tests.support.TestCase):
def test_keyids_from_pubring(self):
ids = dnf.crypto.keyids_from_pubring(self.PUBRING_DIR)
- self.assertIn('24362A8492530C8E', ids)
+ self.assertIn('7B5443AEAA6F01F3', ids)
def test_printable_fingerprint(self):
self.assertEqual(dnf.crypto._printable_fingerprint(FINGERPRINT),
- '0BE4 9FAF 9C95 5F4F 1A98 D14B 2436 2A84 9253 0C8E')
+ '88FB CE42 4BA9 952A 141A 6A29 7B54 43AE AA6F 01F3')
def test_pubring_dir(self):
self.assertNotEqual(os.environ.get('GNUPGHOME'), self.PUBRING_DIR)
@@ -68,10 +68,10 @@ class CryptoTest(tests.support.TestCase):
with open(KEYFILE, 'rb') as keyfile:
info = dnf.crypto.rawkey2infos(keyfile)[0]
self.assertEqual(info.fingerprint, FINGERPRINT)
- self.assertEqual(info.short_id, '92530C8E')
- self.assertEqual(info.rpm_id, '92530c8e')
- self.assertIn(b'Frmy6HXUL\n', info.raw_key)
- self.assertEqual(info.timestamp, 1408534646)
+ self.assertEqual(info.short_id, 'AA6F01F3')
+ self.assertEqual(info.rpm_id, 'aa6f01f3')
+ self.assertIn(b'E4bO2zVZwe\n', info.raw_key)
+ self.assertEqual(info.timestamp, 1721738657)
self.assertEqual(info.userid, 'Dandy Fied <dnf@example.com>')
def test_retrieve(self):
--
2.45.2