pub struct KeyEstablishmentBudget<'a> { /* private fields */ }Expand description
Cumulative KDF allowance borrowed from one immutable operation policy.
Share this instance across every recipient, derived key and retry. Reservations are monotonic, including failed provider calls. Input slices remain borrowed; only the provider’s returned key buffer is owned and zeroized by this API.
Implementations§
Source§impl<'a> KeyEstablishmentBudget<'a>
impl<'a> KeyEstablishmentBudget<'a>
Sourcepub fn new(policy: &'a KeyEstablishmentPolicy) -> Result<Self, PolicyViolation>
pub fn new(policy: &'a KeyEstablishmentPolicy) -> Result<Self, PolicyViolation>
Validate the snapshot before compiling or executing key-establishment work.
Sourcepub fn derive_key(
&mut self,
provider: &dyn CryptoProvider,
parameters: &KdfParameters<'_>,
secret: &[u8],
) -> Result<Zeroizing<Vec<u8>>, XmlEncError>
pub fn derive_key( &mut self, provider: &dyn CryptoProvider, parameters: &KdfParameters<'_>, secret: &[u8], ) -> Result<Zeroizing<Vec<u8>>, XmlEncError>
Derive through the selected provider only after syntax, permission, capability and aggregate allocation/CPU reservations have succeeded.
Sourcepub fn agree_and_derive(
&mut self,
provider: &dyn CryptoProvider,
key: &dyn KeyAgreementKey,
agreement: &KeyAgreementParameters<'_>,
parameters: &KdfParameters<'_>,
) -> Result<Zeroizing<Vec<u8>>, XmlEncError>
pub fn agree_and_derive( &mut self, provider: &dyn CryptoProvider, key: &dyn KeyAgreementKey, agreement: &KeyAgreementParameters<'_>, parameters: &KdfParameters<'_>, ) -> Result<Zeroizing<Vec<u8>>, XmlEncError>
Agree and derive using the same monotonic operation allowance. Permission and both workspace/output reservations precede either provider callback.
Sourcepub const fn hash_blocks(&self) -> usize
pub const fn hash_blocks(&self) -> usize
Cumulative compression work reserved, including failed attempts.
Sourcepub const fn owned_bytes(&self) -> usize
pub const fn owned_bytes(&self) -> usize
Cumulative output allocations reserved, including failed attempts.
Sourcepub const fn modular_work(&self) -> usize
pub const fn modular_work(&self) -> usize
Cumulative finite-field validation and exponentiation work reserved.