Skip to content

Commit

Permalink
Add test case for ima file signatures
Browse files Browse the repository at this point in the history
Key generated with:
openssl ecparam -name secp256k1 -genkey -noout -out privkey.pem

Co-authored-by: Michal Domonkos <[email protected]>
Resolves: rpm-software-management#3237
  • Loading branch information
ffesti and dmnks committed Nov 21, 2024
1 parent 593d94d commit 509bcb4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/data/keys/privkey.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHQCAQEEIAqhMWlmwcHwa2pXlyxUfPUvKMdrHHxGAkKz0EfHrlZpoAcGBSuBBAAK
oUQDQgAEhJIpSysqJlsr0+nAwQDYaqk4hkLmU+2Pje5jCpI6QfakJD+bVrXqF+5Z
xbwEh+e+lrhDLfj9+jJTOda4WD83Ng==
-----END EC PRIVATE KEY-----
25 changes: 25 additions & 0 deletions tests/rpmsigdig.at
Original file line number Diff line number Diff line change
Expand Up @@ -1820,3 +1820,28 @@ POST-IMPORT

gpgconf --kill gpg-agent
RPMTEST_CLEANUP

AT_SETUP([ima])
AT_KEYWORDS([rpmsign file signature])

RPMTEST_SETUP
cp /data/RPMS/hello-2.0-1.x86_64.rpm /tmp/
gpg2 --import /data/keys/rpm.org-rsa-2048-test.secret
rpmsign --key-id 4344591E1964C5FC --addsign --signfiles --fskpath=/data/keys/privkey.pem /tmp/hello-2.0-1.x86_64.rpm

RPMTEST_CHECK([[
rpm -qp --qf "[%{filenames}:%{filesignatures}\n]" /tmp/hello-2.0-1.x86_64.rpm | sed 's/:.\+$/:(...)/'
rpm -qp --qf "[%{filenames}:%{filesignatures}\n]" /data/RPMS/imatest-1.0-1.fc34.noarch.rpm
]],
[0],
[/usr/bin/hello:(...)
/usr/share/doc/hello-2.0:
/usr/share/doc/hello-2.0/COPYING:(...)
/usr/share/doc/hello-2.0/FAQ:(...)
/usr/share/doc/hello-2.0/README:(...)
/usr/share/example1:030204a598255400483046022100e5117bdafa73baaeb1f1dc46ecaa46981a62d417745a33532572b63dc6d95d16022100c789107ac5b91e2d915e1df3c7b78414f6b3f50899d44c1de381d0e938dfc82b
/usr/share/example2:030204a598255400473045022100c10943795bff5d9c0db53dd4f8e4b845615fd08a2be295c30a80f5bdb4e6a41302203038840cc6abaab92acb56cb3e3ce520b17f22ff7444a8d5d0f703a44d5307a3
],
[ignore])

RPMTEST_CLEANUP

0 comments on commit 509bcb4

Please sign in to comment.