Blame 0009-rpm2extents-Add-test-verifying-RC-code-and-signature.patch

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