diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-05-25 11:26:43 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-05-25 11:28:37 +0200 |
commit | f7371dd787a15fa66e234c90fa646400d354d552 (patch) | |
tree | 46b9cdc2d1779f6894b47b68ffe09a704c5c60bc /openpgp-ffi | |
parent | 95d51c6d725d0f7505a3f1979a23bd4ac1b4a8a6 (diff) |
ffi: Gracefully handle encrypted secret keys in pgp_pkesk_decrypt.
- Fixes #510.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r-- | openpgp-ffi/src/packet/pkesk.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/openpgp-ffi/src/packet/pkesk.rs b/openpgp-ffi/src/packet/pkesk.rs index 94166c11..084505ff 100644 --- a/openpgp-ffi/src/packet/pkesk.rs +++ b/openpgp-ffi/src/packet/pkesk.rs @@ -64,8 +64,9 @@ pub extern "C" fn pgp_pkesk_decrypt(errp: Option<&mut *mut crate::error::Error>, } }, Err(e) => { - // XXX: Better message, don't panic. - panic!("Secret parts not unencrypted in {:?}: {}", secret_key, e); + ffi_try_status!(Err::<(), anyhow::Error>( + openpgp::Error::InvalidOperation( + format!("Unusable secret parts: {}", e)).into())) }, } } |