richardphibel / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
629b27
From 44b86112136e4804eb606636cbcb4ae847cad773 Mon Sep 17 00:00:00 2001
629b27
From: chantra <chantr4@gmail.com>
629b27
Date: Sat, 29 Jan 2022 07:05:18 +0000
629b27
Subject: [PATCH 09/30] [rpm2extents] Add test verifying RC code and signature
629b27
 validation text
629b27
629b27
When transcoding an RPM, the RPM signatures are being validated on the fly and the result from the signature validation is being written at the tail of the transcoded file.
629b27
This test check that we get the expected results and is based on the rpmsigdig.at test.
629b27
---
629b27
 Makefile.am          |  2 +-
629b27
 tests/rpm2extents.at | 33 +++++++++++++++++++++++++++++++++
629b27
 2 files changed, 34 insertions(+), 1 deletion(-)
629b27
629b27
diff --git a/Makefile.am b/Makefile.am
629b27
index 288668819..96542c8c8 100644
629b27
--- a/Makefile.am
629b27
+++ b/Makefile.am
629b27
@@ -185,7 +185,7 @@ bin_PROGRAMS +=		rpmgraph
629b27
 rpmgraph_SOURCES =	tools/rpmgraph.c
629b27
 rpmgraph_LDADD =	lib/librpm.la rpmio/librpmio.la @WITH_POPT_LIB@
629b27
 
629b27
-dist_bin_SCRIPTS =	scripts/gendiff
629b27
+dist_bin_SCRIPTS =	scripts/gendiff scripts/rpm2extents_dump
629b27
 
629b27
 rpmconfig_DATA = rpmrc
629b27
 rpmrc: $(top_srcdir)/rpmrc.in
629b27
diff --git a/tests/rpm2extents.at b/tests/rpm2extents.at
629b27
index f943b9af4..baea987e4 100644
629b27
--- a/tests/rpm2extents.at
629b27
+++ b/tests/rpm2extents.at
629b27
@@ -29,3 +29,36 @@ AT_CHECK([runroot_other cat /data/RPMS/hello-2.0-1.x86_64.rpm | runroot_other rp
629b27
 [ignore])
629b27
 AT_CLEANUP
629b27
 
629b27
+# Check that tailer writes checksig return code and content.
629b27
+#
629b27
+AT_SETUP([rpm2extents signature])
629b27
+AT_KEYWORDS([rpm2extents digest signature])
629b27
+AT_CHECK([
629b27
+RPMDB_INIT
629b27
+
629b27
+runroot_other cat /data/RPMS/hello-2.0-1.x86_64-signed.rpm | runroot_other rpm2extents SHA256 > /tmp/hello-2.0-1.x86_64-signed.rpm 2> /dev/null
629b27
+rpm2extents_dump --dump-signature /tmp/hello-2.0-1.x86_64-signed.rpm
629b27
+runroot rpmkeys --import /data/keys/rpm.org-rsa-2048-test.pub
629b27
+runroot_other cat /data/RPMS/hello-2.0-1.x86_64-signed.rpm | runroot_other rpm2extents SHA256 > /tmp/hello-2.0-1.x86_64-signed.rpm
629b27
+rpm2extents_dump --dump-signature /tmp/hello-2.0-1.x86_64-signed.rpm
629b27
+],
629b27
+[0],
629b27
+[RPMSignOutput RC 2
629b27
+RPMSignOutput Content     Header V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
629b27
+    Header SHA256 digest: OK
629b27
+    Header SHA1 digest: OK
629b27
+    Payload SHA256 digest: OK
629b27
+    V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
629b27
+    MD5 digest: OK
629b27
+
629b27
+RPMSignOutput RC 0
629b27
+RPMSignOutput Content     Header V4 RSA/SHA256 Signature, key ID 1964c5fc: OK
629b27
+    Header SHA256 digest: OK
629b27
+    Header SHA1 digest: OK
629b27
+    Payload SHA256 digest: OK
629b27
+    V4 RSA/SHA256 Signature, key ID 1964c5fc: OK
629b27
+    MD5 digest: OK
629b27
+
629b27
+],
629b27
+[])
629b27
+AT_CLEANUP
629b27
-- 
629b27
2.35.1
629b27