pub struct CryptoEngine { /* private fields */ }Expand description
Motor de encriptación/desencriptación.
Implementations§
Source§impl CryptoEngine
impl CryptoEngine
Sourcepub fn new(recipients: Vec<RecipientKey>) -> Self
pub fn new(recipients: Vec<RecipientKey>) -> Self
Crea un nuevo motor con los recipients dados.
Sourcepub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>>
pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>>
Encripta bytes para todos los recipients. Retorna ciphertext como Vec
Sourcepub fn encrypt_str(&self, plaintext: &str) -> Result<String>
pub fn encrypt_str(&self, plaintext: &str) -> Result<String>
Encripta un string, retorna ciphertext en hex.
Sourcepub fn decrypt_str(&mut self, ciphertext_hex: &str) -> Result<String>
pub fn decrypt_str(&mut self, ciphertext_hex: &str) -> Result<String>
Desencripta ciphertext hex.
Sourcepub fn can_decrypt(&self) -> bool
pub fn can_decrypt(&self) -> bool
Verifica si puede desencriptar.
Sourcepub fn load_identity(&mut self) -> Result<()>
pub fn load_identity(&mut self) -> Result<()>
Carga la identidad de desencriptación.
Sourcepub fn load_identity_from_path(&mut self, path: &PathBuf) -> Result<()>
pub fn load_identity_from_path(&mut self, path: &PathBuf) -> Result<()>
Carga identidad desde path específico.
Sourcepub fn has_recipients(&self) -> bool
pub fn has_recipients(&self) -> bool
Retorna true si hay al menos un recipient configurado.
Sourcepub fn encrypted_for_label(&self) -> String
pub fn encrypted_for_label(&self) -> String
Retorna el alias/descripción de la clave usada.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CryptoEngine
impl RefUnwindSafe for CryptoEngine
impl Send for CryptoEngine
impl Sync for CryptoEngine
impl Unpin for CryptoEngine
impl UnsafeUnpin for CryptoEngine
impl UnwindSafe for CryptoEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more