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>;
fn retain_key(&mut self, plaintext: Plaintext) -> 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§
Required Methods§
Sourcefn authenticate(
&mut self,
integrity: &Integrity<'_>,
query: &Reader<'_>,
) -> Result<Decision, Self::Error>
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.
Sourcefn decrypt_safe(
&mut self,
safe: &Safe<'_>,
query: &Reader<'_>,
source: &Source<'_>,
) -> Result<Plaintext, Self::Error>
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.
Sourcefn decrypt_key(
&mut self,
key: &ShroudedKey<'_>,
query: &Reader<'_>,
source: &Source<'_>,
) -> Result<Plaintext, Self::Error>
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.
Sourcefn bag(
&mut self,
bag: &Bag<'_>,
query: &Reader<'_>,
source: &Source<'_>,
) -> Result<(), Self::Error>
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.
Sourcefn key(
&mut self,
key: &PrivateKey<'_>,
query: &Reader<'_>,
source: &Source<'_>,
) -> Result<(), Self::Error>
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.
On success, retain_key receives this exact buffer after these scoped
views end. Inspect/retain metadata here without copying the key bytes.
Sourcefn retain_key(&mut self, plaintext: Plaintext) -> Result<(), Self::Error>
fn retain_key(&mut self, plaintext: Plaintext) -> Result<(), Self::Error>
Take the original unpadded key buffer after successful key inspection.
Moving it retains its existing capacity charge and prepaid wiping;
dropping it releases storage. No temporary Reader/model survives here.
A refusal terminates processing with the same plaintext source chain.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".