Skip to content

Commit

Permalink
Add a test case to check that the key creation time is correct
Browse files Browse the repository at this point in the history
When getting a certificate's creation time, assert that the
certificate's creation time (the Primary Key's creation time field) is
used, not the active binding signature's creation time.

See rpm-software-management#2004.
  • Loading branch information
nwalfield committed Apr 12, 2022
1 parent 29e5a26 commit f6d2847
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ EXTRA_DIST += data/keys/rpm.org-rsa-2048-test.secret
EXTRA_DIST += data/keys/CVE-2021-3521-badbind.asc
EXTRA_DIST += data/keys/CVE-2021-3521-nosubsig.asc
EXTRA_DIST += data/keys/CVE-2021-3521-nosubsig-last.asc
EXTRA_DIST += data/keys/different-creation-times.asc
EXTRA_DIST += data/keys/different-creation-times.secret
EXTRA_DIST += data/macros.testfile
EXTRA_DIST += data/macros.debug
EXTRA_DIST += data/t1.lua
Expand Down
60 changes: 60 additions & 0 deletions tests/rpmsigdig.at
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,66 @@ runroot rpmkeys --import /data/keys/CVE-2021-3521-nosubsig-last.asc
)
AT_CLEANUP

# -----------------------------------------
# Import a key where the binding signature's creation time is
# different from the certificate's creation time.
#
# If the key is identified as gpg-pubkey-62837bea-62553ec1, then the
# implementation is using the binding signature's creation time
# instead of the key's creation time.
AT_SETUP([rpmkeys --import different-creation-times])
AT_KEYWORDS([rpmkeys import])
RPMDB_INIT
AT_CHECK([
runroot rpmkeys --import /data/keys/different-creation-times.asc
runroot rpm -qi gpg-pubkey-62837bea-62553e62|grep -v Date|grep -v Version:
runroot rpm -q --provides gpg-pubkey
],
[0],
[[Name : gpg-pubkey
Version : 62837bea
Release : 62553e62
Architecture: (none)
Group : Public Keys
Size : 0
License : pubkey
Signature : (none)
Source RPM : (none)
Build Host : localhost
Packager : Alice Lovelace <[email protected]>
Summary : Alice Lovelace <[email protected]> public key
Description :
-----B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v20s1RSLL6TfwE
Zwh11+JmkomH4Bj6lKHS/ujBTR8SB6U6bsRdxpbVgltaMRcw8k7psDLB3+vEGjHZ
i+xyTmDmO2F1Hahqt4JkkEdOUwKUrGOKqPhXamxwrLcd2HzVqJ+HHzeiUN7wyDS6
AfWOO/Uikf26AHEXoaPWBqecM0pPehlX21lJ3ambpMB2T885Sg==
=IEYU
-----END PGP PUBLIC KEY BLOCK-----

gpg(Alice Lovelace <[email protected]>) = 4:a72b7d4f62837bea-62553e62
gpg(62837bea) = 4:a72b7d4f62837bea-62553e62
gpg(a72b7d4f62837bea) = 4:a72b7d4f62837bea-62553e62
]],
[])
AT_CLEANUP

# ------------------------------
# Test pre-built package verification
AT_SETUP([rpmkeys -K <signed> 1])
Expand Down

0 comments on commit f6d2847

Please sign in to comment.