diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-10-09 14:19:42 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-10-09 14:33:45 +0200 |
commit | 071e0769e443391ac807b8ff6960a2de9c52f629 (patch) | |
tree | 36917a364f57aaa674f716e974fdac6bb94115de /openpgp-ffi/src | |
parent | 86e40dba44c73a5eb6f24f18e0425ac39d1dd287 (diff) |
ffi: Add key flag accessors for ValidKeyAmalgamation.
- Add pgp_valid_key_amalgamation_for_certification,
pgp_valid_key_amalgamation_for_signing,
pgp_valid_key_amalgamation_for_authentication,
pgp_valid_key_amalgamation_for_storage_encryption, and
pgp_valid_key_amalgamation_for_transport_encryption.
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/key_amalgamation.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/openpgp-ffi/src/key_amalgamation.rs b/openpgp-ffi/src/key_amalgamation.rs index f44ad04f..26a67d20 100644 --- a/openpgp-ffi/src/key_amalgamation.rs +++ b/openpgp-ffi/src/key_amalgamation.rs @@ -96,6 +96,46 @@ pub extern "C" fn pgp_valid_key_amalgamation_binding_signature<'a>(ka: *const Va .move_into_raw() } +/// Returns whether the key is certification capable. +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] +pub extern "C" fn pgp_valid_key_amalgamation_for_certification<'a>(ka: *const ValidKeyAmalgamation<'a>) + -> bool +{ + ka.ref_raw().for_certification() +} + +/// Returns whether the key is signing capable. +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] +pub extern "C" fn pgp_valid_key_amalgamation_for_signing<'a>(ka: *const ValidKeyAmalgamation<'a>) + -> bool +{ + ka.ref_raw().for_signing() +} + +/// Returns whether the key is authentication capable. +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] +pub extern "C" fn pgp_valid_key_amalgamation_for_authentication<'a>(ka: *const ValidKeyAmalgamation<'a>) + -> bool +{ + ka.ref_raw().for_authentication() +} + +/// Returns whether the key is intended for encrypting data at rest. +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] +pub extern "C" fn pgp_valid_key_amalgamation_for_storage_encryption<'a>(ka: *const ValidKeyAmalgamation<'a>) + -> bool +{ + ka.ref_raw().for_storage_encryption() +} + +/// Returns whether the key is intended for encrypting data in transit. +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] +pub extern "C" fn pgp_valid_key_amalgamation_for_transport_encryption<'a>(ka: *const ValidKeyAmalgamation<'a>) + -> bool +{ + ka.ref_raw().for_transport_encryption() +} + /// Creates one or more self-signatures that when merged with the /// certificate cause the key to expire at the specified time. /// |