pub struct AesSession { /* private fields */ }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 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. 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.