Don't panic if a key doesn't contain secret key material, skip it.
- If a key specified using `--recipient-file` does not contain secret key material, don't panic, just skip it. - It is perfectly reasonable for only a subset of keys in a TSK to contain secret key material.
This commit is contained in:
@ -109,24 +109,14 @@ impl<'c, 'store, 'rstore> Helper<'c, 'store, 'rstore>
|
||||
= HashMap::new();
|
||||
let mut identities: HashMap<KeyID, Fingerprint> = HashMap::new();
|
||||
for tsk in secrets {
|
||||
for ka in tsk.keys()
|
||||
for ka in tsk.keys().secret()
|
||||
// XXX: Should use the message's creation time that we do not know.
|
||||
.with_policy(sq.policy, None)
|
||||
.for_transport_encryption().for_storage_encryption()
|
||||
{
|
||||
let id: KeyID = ka.key().fingerprint().into();
|
||||
let key = ka.key();
|
||||
keys.insert(
|
||||
id.clone(),
|
||||
(
|
||||
tsk.clone(),
|
||||
if let Ok(key) = key.parts_as_secret() {
|
||||
key.clone()
|
||||
} else {
|
||||
panic!("Cert does not contain secret keys and private-key-store option has not been set.");
|
||||
}
|
||||
)
|
||||
);
|
||||
keys.insert(id.clone(), (tsk.clone(), key.clone()));
|
||||
identities.insert(id.clone(), tsk.fingerprint());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user