Skip to main content

IsEncrypt

Trait IsEncrypt 

Source
pub trait IsEncrypt: Direction {
    // Required methods
    unsafe fn do_update(
        ctx: *mut EVP_CIPHER_CTX,
        input: &[u8],
        output: &mut [u8],
    ) -> Result<usize, ErrorStack>;
    unsafe fn do_finalize(
        ctx: *mut EVP_CIPHER_CTX,
        output: &mut [u8],
    ) -> Result<usize, ErrorStack>;
}
Expand description

Helper trait that routes to the correct EVP_Encrypt* or EVP_Decrypt* functions.

Sealed: only Encrypt and Decrypt implement this.

Required Methods§

Source

unsafe fn do_update( ctx: *mut EVP_CIPHER_CTX, input: &[u8], output: &mut [u8], ) -> Result<usize, ErrorStack>

Feed data into the cipher and write output.

§Errors

Returns Err if the underlying EVP update call fails.

§Safety

ctx must be a valid, initialised EVP_CIPHER_CTX*.

Source

unsafe fn do_finalize( ctx: *mut EVP_CIPHER_CTX, output: &mut [u8], ) -> Result<usize, ErrorStack>

Flush final block and write output.

§Errors

Returns Err if finalisation fails (e.g. auth tag mismatch for AEAD).

§Safety

ctx must be a valid, initialised EVP_CIPHER_CTX*.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§