[][src]Struct ffsend_api::pipe::crypto::gcm::GcmCrypt

pub struct GcmCrypt { /* fields omitted */ }

Something that can encrypt or decrypt given data using AES-GCM.

Methods

impl GcmCrypt[src]

pub fn new(mode: CryptMode, len: usize, key: &[u8], iv: &[u8]) -> Self[src]

Construct a new AES-GCM crypter.

It is highly recommended to use the encrypt() and decrypt() methods instead for constructing a new crypter.

The mode parameter defines whether this encrypts or decrypts. The length of the payload to encrypt or decrypt must be given to len, this excludes the appended verification tag on the encrypted payload.

The crypto key and input vector iv must also be given.

pub fn encrypt(len: usize, key: &[u8], iv: &[u8]) -> Self[src]

Create an AES-GCM encryptor.

The size in bytes of the data to encrypt must be given as len.

The encryption key and input vector iv must also be given.

pub fn decrypt(len: usize, key: &[u8], iv: &[u8]) -> Self[src]

Create an AES-GCM decryptor.

The size in bytes of the data to decrypt must be given as len, including the size of the suffixed tag.

The decryption key and input vector iv must also be given.

pub fn has_tag(&self) -> bool[src]

Check if the AES-GCM cryptographic tag is known.

When decrypting, this means all data has been processed and the suffixed tag was obtained.

Trait Implementations

impl Crypt for GcmCrypt[src]

fn crypt(&mut self, input: &[u8]) -> (usize, Option<Vec<u8>>)[src]

Encrypt/decrypt bytes from input, return the result. Read more

impl Pipe for GcmCrypt[src]

type Reader = GcmReader

The wrapping reader type used for this pipe.

type Writer = GcmWriter

The wrapping writer type used for this pipe.

fn reader(self, inner: Box<dyn Read>) -> Self::Reader[src]

Wrap the inner reader, bytes that are read are transformed through this pipe.

fn writer(self, inner: Box<dyn Write>) -> Self::Writer[src]

Wrap the inner writer, bytes that are read are transformed through this pipe.

fn pipe_transparent(&self, input: &[u8]) -> (usize, Option<Vec<u8>>)[src]

Transparently pipe input by immediately returning it. Read more

impl PipeRead<GcmCrypt> for GcmReader[src]

impl PipeWrite<GcmCrypt> for GcmWriter[src]

impl PipeLen for GcmCrypt[src]

impl Send for GcmCrypt[src]

Auto Trait Implementations

impl Sync for GcmCrypt

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

default fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> Same for T

type Output = T

Should always be Self