dcavalca / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
Blob Blame History Raw
From 44b86112136e4804eb606636cbcb4ae847cad773 Mon Sep 17 00:00:00 2001
From: chantra <chantr4@gmail.com>
Date: Sat, 29 Jan 2022 07:05:18 +0000
Subject: [PATCH 09/30] [rpm2extents] Add test verifying RC code and signature
 validation text

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.
This test check that we get the expected results and is based on the rpmsigdig.at test.
---
 Makefile.am          |  2 +-
 tests/rpm2extents.at | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 288668819..96542c8c8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -185,7 +185,7 @@ bin_PROGRAMS +=		rpmgraph
 rpmgraph_SOURCES =	tools/rpmgraph.c
 rpmgraph_LDADD =	lib/librpm.la rpmio/librpmio.la @WITH_POPT_LIB@
 
-dist_bin_SCRIPTS =	scripts/gendiff
+dist_bin_SCRIPTS =	scripts/gendiff scripts/rpm2extents_dump
 
 rpmconfig_DATA = rpmrc
 rpmrc: $(top_srcdir)/rpmrc.in
diff --git a/tests/rpm2extents.at b/tests/rpm2extents.at
index f943b9af4..baea987e4 100644
--- a/tests/rpm2extents.at
+++ b/tests/rpm2extents.at
@@ -29,3 +29,36 @@ AT_CHECK([runroot_other cat /data/RPMS/hello-2.0-1.x86_64.rpm | runroot_other rp
 [ignore])
 AT_CLEANUP
 
+# Check that tailer writes checksig return code and content.
+#
+AT_SETUP([rpm2extents signature])
+AT_KEYWORDS([rpm2extents digest signature])
+AT_CHECK([
+RPMDB_INIT
+
+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
+rpm2extents_dump --dump-signature /tmp/hello-2.0-1.x86_64-signed.rpm
+runroot rpmkeys --import /data/keys/rpm.org-rsa-2048-test.pub
+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
+rpm2extents_dump --dump-signature /tmp/hello-2.0-1.x86_64-signed.rpm
+],
+[0],
+[RPMSignOutput RC 2
+RPMSignOutput Content     Header V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
+    Header SHA256 digest: OK
+    Header SHA1 digest: OK
+    Payload SHA256 digest: OK
+    V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
+    MD5 digest: OK
+
+RPMSignOutput RC 0
+RPMSignOutput Content     Header V4 RSA/SHA256 Signature, key ID 1964c5fc: OK
+    Header SHA256 digest: OK
+    Header SHA1 digest: OK
+    Payload SHA256 digest: OK
+    V4 RSA/SHA256 Signature, key ID 1964c5fc: OK
+    MD5 digest: OK
+
+],
+[])
+AT_CLEANUP
-- 
2.35.1