In order to delete the public keys from the key ring, we would require the key_id. The key_id can be idenfied using the below steps using the file where the public key is stored.
To get the Key Details
gpg --throw-keyids < [Key-File-Absolute Path]
pub 1021D/1689B887 2005-03-11 ABC Company
sub 1048f/47E5X96D 2005-03-11 [expires: 2015-03-09]
To get the Key-ID from the keyfile
key_id=${gpg --throw-keyids < [Key-File-Absolute Path] | head -1 | awk {'print $2'} | cut -d '/' -f2 | tr [A-Z] [a-z]}
Delete from GPG keyring
gpg --delete-key --yes $key_id
Delete from RPM keyring
rpm -e --allmatches gpg-pubkey-$key_id
No comments:
Post a Comment