Handle empty signing key slot in key_slot()

This commit is contained in:
Heiko Schaefer 2022-06-19 14:32:48 +02:00
parent 1ac64f5360
commit 17fc6ebeff
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D

View file

@ -245,17 +245,17 @@ pub fn key_slot(open: &mut Open, kt: KeyType) -> Result<Option<PublicKey>> {
match kt { match kt {
KeyType::Signing => { KeyType::Signing => {
// FIXME: handle empty signing key slot if let Ok(pkm) = open.public_key(KeyType::Signing) {
if let Some(ts) = times.signature() {
let pkm = open.public_key(KeyType::Signing)?; return Ok(Some(public_key_material_and_fp_to_key(
let key_sig = public_key_material_and_fp_to_key(
&pkm, &pkm,
KeyType::Signing, KeyType::Signing,
times.signature().expect("Signature time is unset"), ts,
fps.signature().expect("Signature fingerprint is unset"), fps.signature().expect("Signature fingerprint is unset"),
)?; )?));
Ok(Some(key_sig)) }
}
Ok(None)
} }
KeyType::Decryption => { KeyType::Decryption => {
if let Ok(pkm) = open.public_key(KeyType::Decryption) { if let Ok(pkm) = open.public_key(KeyType::Decryption) {