pub trait Cipher {
type Err;
// Required methods
fn size(&self) -> usize;
fn decrypt(&mut self, packet: Packet) -> Result<Vec<u8>, Self::Err>;
fn encrypt(&mut self, payload: Vec<u8>) -> Result<Packet, Self::Err>;
}
Expand description
The cipher implemented to decrypt data from a Packet
or encrypt data to Packet.
The associated error which can be returned when encrypting or decrypting.
The size of the Message Authentication Code for this Cipher, in bytes.
Transform the Packet using the Cipher into it’s decrypted payload.
Transform the payload into it’s encrypted Packet using the Cipher.