Struct dco3_crypto::Crypter

source ·
pub struct Crypter<'b, C, State = Open> {
    pub crypter: C,
    pub buffer: &'b mut Vec<u8>,
    pub count: usize,
    pub plain_file_key: PlainFileKey,
    pub mode: Mode,
    pub state: PhantomData<State>,
}
Expand description

Allows chunked en- and decryption. Holds a reference to a buffer to store the mssage, processed bytes as count and the used plain file key and mode. Requires generic type annotation The type ‘C’ represents an internal handler for the encryption functions with chunking

Fields§

§crypter: C§buffer: &'b mut Vec<u8>§count: usize§plain_file_key: PlainFileKey§mode: Mode§state: PhantomData<State>

Trait Implementations§

source§

impl<'b> ChunkedEncryption<'b, Crypter> for Crypter<'b, Crypter>

source§

fn try_new_for_decryption( plain_file_key: PlainFileKey, buffer: &'b mut Vec<u8> ) -> Result<Self, DracoonCryptoError>

Returns a Crypter for decryption by passing the plain file key and a writable (mutable) buffer
source§

fn try_new_for_encryption( buffer: &'b mut Vec<u8> ) -> Result<Self, DracoonCryptoError>

Returns a Crypter for enryption by passing a writable (mutable) buffer
source§

fn update(&mut self, data: &[u8]) -> Result<usize, DracoonCryptoError>

Update the Crypter with given data
source§

fn set_tag(&mut self, tag: &[u8]) -> Result<(), DracoonCryptoError>

Set the tag before finalizing the encryption
source§

fn finalize(&mut self) -> Result<usize, DracoonCryptoError>

Finalize decryption / encryption
source§

fn get_message(&mut self) -> &Vec<u8>

Get the message (result of encryption / decryption) from buffer
source§

fn get_plain_file_key(&self) -> PlainFileKey

Get the plain file key used for either encryption or decryption

Auto Trait Implementations§

§

impl<'b, C, State> Freeze for Crypter<'b, C, State>
where C: Freeze,

§

impl<'b, C, State> RefUnwindSafe for Crypter<'b, C, State>
where C: RefUnwindSafe, State: RefUnwindSafe,

§

impl<'b, C, State> Send for Crypter<'b, C, State>
where C: Send, State: Send,

§

impl<'b, C, State> Sync for Crypter<'b, C, State>
where C: Sync, State: Sync,

§

impl<'b, C, State> Unpin for Crypter<'b, C, State>
where C: Unpin, State: Unpin,

§

impl<'b, C, State = Open> !UnwindSafe for Crypter<'b, C, State>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more