diff options
author | Neal H. Walfield <neal@pep.foundation> | 2019-05-07 12:13:20 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2019-05-07 12:18:47 +0200 |
commit | 214e6a2cac09e29bcbae61cbccdeb58afa38611a (patch) | |
tree | 9f7556ecaef5ccaec17a9caf692b9d071e7a47a1 /openpgp-ffi/src | |
parent | a23be8beccfb4bec44ea99ce6943b50800998b01 (diff) |
openpgp-ffi: Wrap TPKBuilder::general_purpose
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/tpk.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/openpgp-ffi/src/tpk.rs b/openpgp-ffi/src/tpk.rs index 2083add9..eeb115e0 100644 --- a/openpgp-ffi/src/tpk.rs +++ b/openpgp-ffi/src/tpk.rs @@ -709,6 +709,24 @@ pub extern "system" fn pgp_tpk_builder_new() -> *mut TPKBuilder { box_raw!(TPKBuilder::new()) } +/// Generates a general-purpose key. +/// +/// The key's primary key is certification- and signature-capable. +/// The key has one subkey, an encryption-capable subkey. +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] +pub extern "system" fn pgp_tpk_builder_general_purpose(cs: c_int, + uid: *const c_char) + -> *mut TPKBuilder +{ + let uid = if uid.is_null() { + None + } else { + Some(ffi_param_cstr!(uid).to_string_lossy()) + }; + box_raw!(TPKBuilder::general_purpose( + Some(int_to_cipher_suite(cs)), uid)) +} + /// Generates a key compliant to [Autocrypt Level 1]. /// /// Autocrypt requires a user id, however, if `uid` is NULL, a TPK is |