dcrypt_symmetric/streaming/mod.rs
1//! Streaming encryption APIs for large data
2//!
3//! This module provides streaming interfaces for encrypting and decrypting
4//! large amounts of data in a memory-efficient way.
5
6use crate::error::Result;
7use std::io::{Read, Write};
8
9/// Trait for streaming encryption
10pub trait StreamingEncrypt<W: Write> {
11 /// Writes plaintext data to the stream
12 fn write(&mut self, data: &[u8]) -> Result<()>;
13
14 /// Finalizes the stream, encrypting any remaining data
15 fn finalize(self) -> Result<W>;
16}
17
18/// Trait for streaming decryption
19pub trait StreamingDecrypt<R: Read> {
20 /// Reads and decrypts data from the stream
21 fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
22}
23
24// Re-export streaming implementations
25pub mod chacha20poly1305;
26pub mod gcm;