diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-01-21 13:50:24 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-01-21 14:00:03 +0100 |
commit | a94fe6f6dec24f5817ded4b1859ef4e9ae4e013b (patch) | |
tree | 7654479af548a715ee0d45e2b5231b9dd12a1c22 /openpgp-ffi | |
parent | 48b3a1c9b2ca24540c3dd23d2f28620c6477703d (diff) |
openpgp: Make the various keyflags() methods return an Option.
- This signals the absence of a subpacket.
- Likewise for features(), key_server_preferences().
Diffstat (limited to 'openpgp-ffi')
-rw-r--r-- | openpgp-ffi/src/packet/signature.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/openpgp-ffi/src/packet/signature.rs b/openpgp-ffi/src/packet/signature.rs index 9b41282a..60903fc5 100644 --- a/openpgp-ffi/src/packet/signature.rs +++ b/openpgp-ffi/src/packet/signature.rs @@ -71,14 +71,14 @@ fn pgp_signature_issuer_fingerprint(sig: *const Signature) /// make certifications. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_certification(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().for_certification() + sig.ref_raw().key_flags().unwrap_or_default().for_certification() } /// Returns whether the KeyFlags indicates that the key can be used to /// make signatures. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_signing(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().for_signing() + sig.ref_raw().key_flags().unwrap_or_default().for_signing() } /// Returns whether the KeyFlags indicates that the key can be used to @@ -86,35 +86,35 @@ fn pgp_signature_for_signing(sig: *const Signature) -> bool { #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_transport_encryption(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().for_transport_encryption() + sig.ref_raw().key_flags().unwrap_or_default().for_transport_encryption() } /// Returns whether the KeyFlags indicates that the key can be used to /// encrypt data at rest. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_storage_encryption(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().for_storage_encryption() + sig.ref_raw().key_flags().unwrap_or_default().for_storage_encryption() } /// Returns whether the KeyFlags indicates that the key can be used /// for authentication. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_for_authentication(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().for_authentication() + sig.ref_raw().key_flags().unwrap_or_default().for_authentication() } /// Returns whether the KeyFlags indicates that the key is a split /// key. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_is_split_key(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().is_split_key() + sig.ref_raw().key_flags().unwrap_or_default().is_split_key() } /// Returns whether the KeyFlags indicates that the key is a group /// key. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_is_group_key(sig: *const Signature) -> bool { - sig.ref_raw().key_flags().is_group_key() + sig.ref_raw().key_flags().unwrap_or_default().is_group_key() } |