Skip to main content

Backend

Trait Backend 

Source
pub trait Backend {
    type Error;

    // Required methods
    fn authenticate(
        &mut self,
        integrity: &Integrity<'_>,
        query: &Reader<'_>,
    ) -> Result<Decision, Self::Error>;
    fn decrypt_safe(
        &mut self,
        safe: &Safe<'_>,
        query: &Reader<'_>,
        source: &Source<'_>,
    ) -> Result<Plaintext, Self::Error>;
    fn decrypt_key(
        &mut self,
        key: &ShroudedKey<'_>,
        query: &Reader<'_>,
        source: &Source<'_>,
    ) -> Result<Plaintext, Self::Error>;
    fn bag(
        &mut self,
        bag: &Bag<'_>,
        query: &Reader<'_>,
        source: &Source<'_>,
    ) -> Result<(), Self::Error>;
    fn key(
        &mut self,
        key: &PrivateKey<'_>,
        query: &Reader<'_>,
        source: &Source<'_>,
    ) -> Result<(), Self::Error>;
}
Expand description

A selected backend and extraction visitor. It must fund all backend work, temporary/output capacity and key/password handling through the supplied Reader before work. There is no default implementation or implicit engine.

Required Associated Types§

Source

type Error

Owned error type, independent of temporary decrypted input lifetimes.

Required Methods§

Source

fn authenticate( &mut self, integrity: &Integrity<'_>, query: &Reader<'_>, ) -> Result<Decision, Self::Error>

Check the entire original PFX integrity. For Password mode, MAC input is exactly safe logical octets. Signed mode uses the existing CMS verifier over the actual carried data. A missing MAC must be explicitly accepted or rejected here; it never gains an authentication proof from parsing.

Source

fn decrypt_safe( &mut self, safe: &Safe<'_>, query: &Reader<'_>, source: &Source<'_>, ) -> Result<Plaintext, Self::Error>

Decrypt one complete password-protected or enveloped safe. The model retains the original algorithms/recipients; Safe::Data is never passed. Return a wiping buffer on this current account. A failure terminates processing; ciphertext is not interpreted as plaintext on refusal.

Source

fn decrypt_key( &mut self, key: &ShroudedKey<'_>, query: &Reader<'_>, source: &Source<'_>, ) -> Result<Plaintext, Self::Error>

Decrypt one original PKCS#8 shrouded key, including a key inside an already encrypted safe. Its KDF is a separate paid operation.

Source

fn bag( &mut self, bag: &Bag<'_>, query: &Reader<'_>, source: &Source<'_>, ) -> Result<(), Self::Error>

Consume each original bag once in direct sibling/preorder nesting order. The parsed bag/source are scoped; owned extraction must fund its own retained storage. Unknown bags remain explicit and are not discarded.

Source

fn key( &mut self, key: &PrivateKey<'_>, query: &Reader<'_>, source: &Source<'_>, ) -> Result<(), Self::Error>

Consume the clear key obtained from a shrouded bag, under its new honest plaintext coordinates. The enclosing bag is not replayed to bag.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§