summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-10-09 14:19:42 +0200
committerNeal H. Walfield <neal@pep.foundation>2020-10-09 14:33:45 +0200
commit071e0769e443391ac807b8ff6960a2de9c52f629 (patch)
tree36917a364f57aaa674f716e974fdac6bb94115de
parent86e40dba44c73a5eb6f24f18e0425ac39d1dd287 (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.
-rw-r--r--openpgp-ffi/include/sequoia/openpgp.h25
-rw-r--r--openpgp-ffi/src/key_amalgamation.rs40
2 files changed, 65 insertions, 0 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h
index 75b6098b..104dede6 100644
--- a/openpgp-ffi/include/sequoia/openpgp.h
+++ b/openpgp-ffi/include/sequoia/openpgp.h
@@ -1184,6 +1184,31 @@ pgp_revocation_status_t pgp_valid_key_amalgamation_revocation_status (pgp_valid_
pgp_signature_t pgp_valid_key_amalgamation_binding_signature (pgp_valid_key_amalgamation_t ka);
/*/
+/// Returns whether the key is certification capable.
+/*/
+bool pgp_valid_key_amalgamation_for_certification (pgp_valid_key_amalgamation_t ka);
+
+/*/
+/// Returns whether the key is signing capable.
+/*/
+bool pgp_valid_key_amalgamation_for_signing (pgp_valid_key_amalgamation_t ka);
+
+/*/
+/// Returns whether the key is authentication capable.
+/*/
+bool pgp_valid_key_amalgamation_for_authentication (pgp_valid_key_amalgamation_t ka);
+
+/*/
+/// Returns whether the key is intended for encrypting data at rest.
+/*/
+bool pgp_valid_key_amalgamation_for_storage_encryption (pgp_valid_key_amalgamation_t ka);
+
+/*/
+/// Returns whether the key is intended for encrypting data in transit.
+/*/
+bool pgp_valid_key_amalgamation_for_transport_encryption (pgp_valid_key_amalgamation_t ka);
+
+/*/
/// Creates one or more self-signatures that when merged with the
/// certificate cause the key to expire at the specified time.
///
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.
///