Trait SealingCipher

Source
pub trait SealingCipher: CipherCore {
    // Required methods
    fn compress<B: AsRef<[u8]>>(&mut self, buf: B) -> Result<Vec<u8>, Self::Err>;
    fn pad(&mut self, buf: Vec<u8>, padding: u8) -> Result<Vec<u8>, Self::Err>;
    fn encrypt<B: AsMut<[u8]>>(&mut self, buf: B) -> Result<(), Self::Err>;
    fn seal<B: AsRef<[u8]>>(
        &mut self,
        buf: B,
        seq: u32,
    ) -> Result<Vec<u8>, Self::Err>;
}
Expand description

A cipher able to seal a payload to create a Packet.

Required Methods§

Source

fn compress<B: AsRef<[u8]>>(&mut self, buf: B) -> Result<Vec<u8>, Self::Err>

Decompress the buf using the SealingCipher.

Source

fn pad(&mut self, buf: Vec<u8>, padding: u8) -> Result<Vec<u8>, Self::Err>

Pad the buf to match SealingCipher’s block size with random data, by increasing it by padding bytes and prefixing the buf it with it’s len.

Source

fn encrypt<B: AsMut<[u8]>>(&mut self, buf: B) -> Result<(), Self::Err>

Encrypt the buf using using the SealingCipher.

Source

fn seal<B: AsRef<[u8]>>( &mut self, buf: B, seq: u32, ) -> Result<Vec<u8>, Self::Err>

Generate a seal from the HMAC algorithm to produce a Message Authentication Code.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§