use crate::error::Result;
use crate::ffi;
use crate::ffi_safe::{call_for_optional_string, call_for_string, call_for_u32};
pub struct Symenc {
pub(crate) handle: ffi::rnp_symenc_handle_t,
}
impl Symenc {
pub(crate) fn new(handle: ffi::rnp_symenc_handle_t) -> Self {
Symenc { handle }
}
pub fn cipher(&self) -> Result<String> {
call_for_string(|raw| unsafe { ffi::rnp_symenc_get_cipher(self.handle, raw) })
}
pub fn aead_alg(&self) -> Result<Option<String>> {
call_for_optional_string(|out| unsafe { ffi::rnp_symenc_get_aead_alg(self.handle, out) })
}
pub fn hash_alg(&self) -> Result<String> {
call_for_string(|raw| unsafe { ffi::rnp_symenc_get_hash_alg(self.handle, raw) })
}
pub fn s2k_type(&self) -> Result<String> {
call_for_string(|raw| unsafe { ffi::rnp_symenc_get_s2k_type(self.handle, raw) })
}
pub fn s2k_iterations(&self) -> Result<u32> {
call_for_u32(|out| unsafe { ffi::rnp_symenc_get_s2k_iterations(self.handle, out) })
}
}