diff --git a/src/lib.rs b/src/lib.rs index 2b97de65c424dd1a4940aeeeef3ceea008368df1..645628d0a31bbfba0a1943a4c426d0a14975ef26 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -148,6 +148,25 @@ ffi!(fn pgp_config_cipher_suite(session: *mut Session, suite: PepCipherSuite) session.set_cipher_suite(suite) }); +// Given the pEp cipher suite indicator enum, returns whether the +// cipher suite is supported. +// +// Returns `StatusOk` if it is supported, and `CannotConfig` is not +// supported by the current cryptographic backend. +ffi!(fn pgp_cipher_suite_is_supported(session: *mut Session, + suite: PepCipherSuite) + -> Result<()> +{ + let _session = Session::as_mut(session)?; + + let suite: Result = suite.try_into(); + if let Err(_err) = suite { + Err(Error::CannotConfig("cipher suite".into())) + } else { + Ok(()) + } +}); + // Decrypts the key. // // On success, returns the decrypted key.