pub struct AesSession { /* private fields */ }Available on crate feature
std only.Expand description
High-performance session encryption using ring’s AES-256-GCM (hardware accelerated on ARM64/x86_64)
Implementations§
Source§impl AesSession
impl AesSession
Create from a 32-byte shared secret (derived from PQC handshake). This is the “initiator” side.
Create the “peer” (responder) side — send/recv keys are swapped so that initiator’s encrypt can be decrypted by peer’s decrypt, and vice versa.
Sourcepub fn encrypt_in_place(
&self,
aad: &[u8],
buf: &mut Vec<u8>,
) -> Result<(), EncryptError>
pub fn encrypt_in_place( &self, aad: &[u8], buf: &mut Vec<u8>, ) -> Result<(), EncryptError>
Encrypt in place: appends 16-byte tag. Returns total ciphertext length.
Sourcepub fn encrypt(
&self,
aad: &[u8],
plaintext: &[u8],
) -> Result<Vec<u8>, EncryptError>
pub fn encrypt( &self, aad: &[u8], plaintext: &[u8], ) -> Result<Vec<u8>, EncryptError>
Encrypt: allocates a new Vec with ciphertext.
Sourcepub fn decrypt_in_place<'a>(
&self,
aad: &[u8],
buf: &'a mut [u8],
) -> Result<&'a mut [u8], EncryptError>
pub fn decrypt_in_place<'a>( &self, aad: &[u8], buf: &'a mut [u8], ) -> Result<&'a mut [u8], EncryptError>
Decrypt in place: verifies tag and truncates. Returns plaintext slice.
Auto Trait Implementations§
impl !Freeze for AesSession
impl RefUnwindSafe for AesSession
impl Send for AesSession
impl Sync for AesSession
impl Unpin for AesSession
impl UnsafeUnpin for AesSession
impl UnwindSafe for AesSession
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