diff --git a/lib/rpmts.cc b/lib/rpmts.cc index 95ec19e1bb..b6a7e38708 100644 --- a/lib/rpmts.cc +++ b/lib/rpmts.cc @@ -421,6 +421,7 @@ static void addGpgProvide(Header h, const char *n, const char *v) } struct pgpdata_s { + const char *fingerprint; const char *signid; char *timestr; char *verid; @@ -433,6 +434,7 @@ static void initPgpData(rpmPubkey key, struct pgpdata_s *pd) { pgpDigParams pubp = rpmPubkeyPgpDigParams(key); memset(pd, 0, sizeof(*pd)); + pd->fingerprint = rpmPubkeyFingerprintAsHex(key); pd->signid = rpmPubkeyKeyIDAsHex(key); pd->shortid = pd->signid + 8; pd->userid = pgpDigParamsUserID(pubp); @@ -442,7 +444,7 @@ static void initPgpData(rpmPubkey key, struct pgpdata_s *pd) pd->time = pgpDigParamsCreationTime(pubp); rasprintf(&pd->timestr, "%x", pd->time); - rasprintf(&pd->verid, "%d:%s-%s", pgpDigParamsVersion(pubp), pd->signid, pd->timestr); + rasprintf(&pd->verid, "%d:%s-%s", pgpDigParamsVersion(pubp), pd->fingerprint, pd->timestr); } static void finiPgpData(struct pgpdata_s *pd) @@ -517,7 +519,7 @@ static int makePubkeyHeader(rpmts ts, rpmPubkey key, rpmPubkey *subkeys, goto exit; headerPutString(h, RPMTAG_NAME, "gpg-pubkey"); - headerPutString(h, RPMTAG_VERSION, kd.shortid); + headerPutString(h, RPMTAG_VERSION, kd.fingerprint); headerPutString(h, RPMTAG_RELEASE, kd.timestr); headerPutString(h, RPMTAG_DESCRIPTION, d); headerPutString(h, RPMTAG_GROUP, group); @@ -779,11 +781,11 @@ rpmRC rpmtxnDeletePubkey(rpmtxn txn, rpmPubkey key) /* Both import and delete just return OK on test-transaction */ rc = RPMRC_OK; if (!(rpmtsFlags(txn->ts) & RPMTRANS_FLAG_TEST)) { - const char *keyid = rpmPubkeyKeyIDAsHex(key); + const char *fp = rpmPubkeyFingerprintAsHex(key); if (txn->ts->keyringtype == KEYRING_FS) - rc = rpmtsDeleteFSKey(txn, keyid+8); + rc = rpmtsDeleteFSKey(txn, fp); else - rc = rpmtsDeleteDBKey(txn, keyid+8); + rc = rpmtsDeleteDBKey(txn, fp); } rpmKeyringFree(keyring); } diff --git a/tests/rpmdb.at b/tests/rpmdb.at index d93569a0b2..7c57f2bffe 100644 --- a/tests/rpmdb.at +++ b/tests/rpmdb.at @@ -151,9 +151,9 @@ runroot rpm -qa | sort ], [0], [foo-1.0-1.noarch -gpg-pubkey-1964c5fc-58e63918 -gpg-pubkey-757bf69e-661d22a8 -gpg-pubkey-eb04e625-62521e00 +gpg-pubkey-152bb32fd9ca982797e835cfb0645aec757bf69e-661d22a8 +gpg-pubkey-771b18d3d7baa28734333c424344591e1964c5fc-58e63918 +gpg-pubkey-b6542f92f30650c36b6f41bcb3a771bfeb04e625-62521e00 hello-2.0-1.x86_64 ], []) diff --git a/tests/rpmsigdig.at b/tests/rpmsigdig.at index ed9662c801..4d376a0d4e 100644 --- a/tests/rpmsigdig.at +++ b/tests/rpmsigdig.at @@ -347,11 +347,11 @@ RPMDB_INIT runroot rpmkeys \ --define "_keyring rpmdb" \ --import /data/keys/rpm.org-rsa-2048-test.pub -runroot rpm -qi gpg-pubkey-1964c5fc-58e63918|grep -v Date|grep -v Version: -runroot rpm -q --provides gpg-pubkey-1964c5fc-58e63918], +runroot rpm -qi gpg-pubkey-771b18d3d7baa28734333c424344591e1964c5fc-58e63918|grep -v Date|grep -v Version: +runroot rpm -q --provides gpg-pubkey-771b18d3d7baa28734333c424344591e1964c5fc-58e63918], [0], [Name : gpg-pubkey -Version : 1964c5fc +Version : 771b18d3d7baa28734333c424344591e1964c5fc Release : 58e63918 Architecture: (none) Group : Public Keys @@ -393,9 +393,9 @@ UNW2iqnN3BA7guhOv6OMiROF1+I7Q5nWT63mQC7IgQ== =Z6nu -----END PGP PUBLIC KEY BLOCK----- -gpg(rpm.org RSA testkey ) = 4:4344591e1964c5fc-58e63918 -gpg(1964c5fc) = 4:4344591e1964c5fc-58e63918 -gpg(4344591e1964c5fc) = 4:4344591e1964c5fc-58e63918 +gpg(rpm.org RSA testkey ) = 4:771b18d3d7baa28734333c424344591e1964c5fc-58e63918 +gpg(1964c5fc) = 4:771b18d3d7baa28734333c424344591e1964c5fc-58e63918 +gpg(4344591e1964c5fc) = 4:771b18d3d7baa28734333c424344591e1964c5fc-58e63918 ], []) RPMTEST_CLEANUP @@ -410,7 +410,7 @@ runroot rpmkeys \ --define "_keyringpath /tmp/kr" \ --define "_keyring fs" \ --import /data/keys/rpm.org-rsa-2048-test.pub -runroot_other cat /tmp/kr/gpg-pubkey-1964c5fc-58e63918.key | grep -v 'Version: ' +runroot_other cat /tmp/kr/gpg-pubkey-771b18d3d7baa28734333c424344591e1964c5fc-58e63918.key | grep -v 'Version: ' ], [0], [-----BEGIN PGP PUBLIC KEY BLOCK----- @@ -703,12 +703,12 @@ RPMTEST_CHECK([ runroot rpmkeys \ --define "_keyring rpmdb" \ --import /data/keys/different-creation-times.asc -runroot rpm -qi gpg-pubkey-62837bea-62553e62|grep -v Date|grep -v Version: +runroot rpm -qi gpg-pubkey-2f38916f5e77cf307b338596a72b7d4f62837bea-62553e62|grep -v Date|grep -v Version: runroot rpm -q --provides gpg-pubkey ], [0], [[Name : gpg-pubkey -Version : 62837bea +Version : 2f38916f5e77cf307b338596a72b7d4f62837bea Release : 62553e62 Architecture: (none) Group : Public Keys @@ -744,9 +744,9 @@ AfWOO/Uikf26AHEXoaPWBqecM0pPehlX21lJ3ambpMB2T885Sg== =IEYU -----END PGP PUBLIC KEY BLOCK----- -gpg(Alice Lovelace ) = 4:a72b7d4f62837bea-62553e62 -gpg(62837bea) = 4:a72b7d4f62837bea-62553e62 -gpg(a72b7d4f62837bea) = 4:a72b7d4f62837bea-62553e62 +gpg(Alice Lovelace ) = 4:2f38916f5e77cf307b338596a72b7d4f62837bea-62553e62 +gpg(62837bea) = 4:2f38916f5e77cf307b338596a72b7d4f62837bea-62553e62 +gpg(a72b7d4f62837bea) = 4:2f38916f5e77cf307b338596a72b7d4f62837bea-62553e62 ]], []) RPMTEST_CLEANUP