HandshakeTokenKey

Trait HandshakeTokenKey 

Source
pub trait HandshakeTokenKey: Send + Sync {
    // Required methods
    fn seal(
        &self,
        token_nonce: u128,
        data: &mut Vec<u8>,
    ) -> Result<(), CryptoError>;
    fn open<'a>(
        &self,
        token_nonce: u128,
        data: &'a mut [u8],
    ) -> Result<&'a [u8], CryptoError>;
}
Expand description

The trait for encrypting tokens that power retry packets and NEW_TOKEN frames.

Required Methods§

Source

fn seal(&self, token_nonce: u128, data: &mut Vec<u8>) -> Result<(), CryptoError>

Method for sealing a token in-place.

The nonce doesn’t need to be attached to the ciphertext, but the authentication tag is expected to be appended to data.

Source

fn open<'a>( &self, token_nonce: u128, data: &'a mut [u8], ) -> Result<&'a [u8], CryptoError>

Method for opening a sealed message data in-place.

Returns the portion of data that contains the decrypted plaintext.

Implementors§