diff options
Diffstat (limited to 'openpgp-ffi/src/key_amalgamation.rs')
-rw-r--r-- | openpgp-ffi/src/key_amalgamation.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/openpgp-ffi/src/key_amalgamation.rs b/openpgp-ffi/src/key_amalgamation.rs index a7bbeeec..c7a8870d 100644 --- a/openpgp-ffi/src/key_amalgamation.rs +++ b/openpgp-ffi/src/key_amalgamation.rs @@ -11,17 +11,21 @@ use libc::{size_t, time_t}; extern crate sequoia_openpgp as openpgp; use self::openpgp::packet::key; use self::openpgp::cert::amalgamation::ValidAmalgamation; +use self::openpgp::cert::amalgamation::ValidateAmalgamation; use self::openpgp::crypto; use super::packet::key::Key; use super::packet::signature::Signature; use super::packet::Packet; +use super::policy::Policy; use super::revocation_status::RevocationStatus; use crate::error::Status; +use crate::Maybe; use crate::MoveIntoRaw; use crate::MoveResultIntoRaw; use crate::RefRaw; +use crate::MoveFromRaw; use crate::maybe_time; /// A local alias to appease the proc macro transformation. @@ -134,3 +138,22 @@ fn pgp_valid_key_amalgamation_set_expiration_time( } } } + +/// Changes the policy applied to the `ValidKeyAmalgamation`. +/// +/// This consumes the key amalgamation. +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" +fn pgp_valid_key_amalgamation_with_policy<'a>(errp: Option<&mut *mut crate::error::Error>, + ka: *mut ValidKeyAmalgamation<'a>, + policy: *const Policy, + time: time_t) + -> Maybe<ValidKeyAmalgamation<'a>> +{ + ffi_make_fry_from_errp!(errp); + + let ka = ka.move_from_raw(); + let policy = policy.ref_raw(); + let time = maybe_time(time); + + ka.with_policy(&**policy, time).move_into_raw(errp) +} |