pub struct CipherCtx<Dir> { /* private fields */ }Expand description
Implementations§
Source§impl<Dir: Direction> CipherCtx<Dir>
impl<Dir: Direction> CipherCtx<Dir>
Sourcepub fn update(
&mut self,
input: &[u8],
output: &mut [u8],
) -> Result<usize, ErrorStack>where
Dir: IsEncrypt,
pub fn update(
&mut self,
input: &[u8],
output: &mut [u8],
) -> Result<usize, ErrorStack>where
Dir: IsEncrypt,
Feed input into the cipher; write plaintext/ciphertext to output.
output must be at least input.len() + block_size - 1 bytes.
Returns the number of bytes written.
§Errors
Sourcepub fn update_to_vec(&mut self, input: &[u8]) -> Result<Vec<u8>, ErrorStack>where
Dir: IsEncrypt,
pub fn update_to_vec(&mut self, input: &[u8]) -> Result<Vec<u8>, ErrorStack>where
Dir: IsEncrypt,
Feed input through the cipher and return the output as a Vec<u8>.
Allocates input.len() + block_size bytes, calls Self::update, then
truncates to the actual number of bytes written. Use this when the caller
cannot easily compute the output size in advance.
§Errors
Sourcepub fn finalize(&mut self, output: &mut [u8]) -> Result<usize, ErrorStack>where
Dir: IsEncrypt,
pub fn finalize(&mut self, output: &mut [u8]) -> Result<usize, ErrorStack>where
Dir: IsEncrypt,
Finalise the operation (flush padding / verify auth tag).
§Errors
Sourcepub fn set_params(&mut self, params: &Params<'_>) -> Result<(), ErrorStack>
pub fn set_params(&mut self, params: &Params<'_>) -> Result<(), ErrorStack>
Set dynamic parameters on the context (e.g. GCM tag length).
§Errors
Sourcepub fn as_ptr(&self) -> *mut EVP_CIPHER_CTX
pub fn as_ptr(&self) -> *mut EVP_CIPHER_CTX
Return the raw EVP_CIPHER_CTX* pointer. Returns a mutable pointer
because most OpenSSL EVP functions require EVP_CIPHER_CTX* even for
logically read-only operations.
Trait Implementations§
Auto Trait Implementations§
impl<Dir> Freeze for CipherCtx<Dir>
impl<Dir> RefUnwindSafe for CipherCtx<Dir>where
Dir: RefUnwindSafe,
impl<Dir> !Sync for CipherCtx<Dir>
impl<Dir> Unpin for CipherCtx<Dir>where
Dir: Unpin,
impl<Dir> UnsafeUnpin for CipherCtx<Dir>
impl<Dir> UnwindSafe for CipherCtx<Dir>where
Dir: UnwindSafe,
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