pub trait HostWithStore<T>: HasData + Send {
// Required method
fn prepare(
accessor: &Accessor<T, Self>,
variant: Sha2Variant,
input: Resource<Password>,
salt: Vec<u8>,
iterations: u32,
) -> impl Future<Output = Result<Result<Resource<DeriveInput>, Error>>> + Send;
}Required Methods§
Sourcefn prepare(
accessor: &Accessor<T, Self>,
variant: Sha2Variant,
input: Resource<Password>,
salt: Vec<u8>,
iterations: u32,
) -> impl Future<Output = Result<Result<Resource<DeriveInput>, Error>>> + Send
fn prepare( accessor: &Accessor<T, Self>, variant: Sha2Variant, input: Resource<Password>, salt: Vec<u8>, iterations: u32, ) -> impl Future<Output = Result<Result<Resource<DeriveInput>, Error>>> + Send
Parameterize a derivation: salt and the iteration count are
bound now, and the output length arrives per use (the platform’s
own split — Pbkdf2Params at deriveBits, length from the
target’s get-key-length at deriveKey).
Security:
iterationsis the work factor: it is the only brake on brute-force attack against the password. Use the largest count your latency budget allows.- Use a unique random
saltper password, so equal passwords do not derive equal keys and precomputed tables do not apply.
A zero iteration count fails error.other, the platform’s
OperationError (RFC 8018 requires a positive count), checked here
rather than at use so a misparameterized input cannot mint. An
implementation not serving the variant fails error.unsupported
(the truncated SHA-2 variants are unserved package-wide).
Unlike hkdf-sha2.prepare, running the derivation early cannot
discard the base secret entirely: PBKDF2 has no extract step, so
the input retains password-derived keyed state (the PRF’s key
schedule) for its lifetime — equivalent in sensitivity to HKDF’s
retained PRK, and still not the raw password bytes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.