pub struct KwKey(/* private fields */);Expand description
A key-wrap.kw-key: a dedicated key-wrapping key (AES-KW), bound to
its algorithm at creation.
Implementations§
Source§impl KwKey
impl KwKey
Sourcepub async fn wrap(&self, input: WrapInput) -> Result<Vec<u8>, Error>
pub async fn wrap(&self, input: WrapInput) -> Result<Vec<u8>, Error>
Encrypt serialized key material (the WIT kw-key.wrap contract:
deterministic; JWK-formatted input is space-padded to a multiple
of 8; the input domain is a multiple of 8 bytes, at least 16).
Consumes the WrapInput.
Sourcepub async fn unwrap(
&self,
wrapped: impl Into<Vec<u8>>,
) -> Result<UnwrapInput, Error>
pub async fn unwrap( &self, wrapped: impl Into<Vec<u8>>, ) -> Result<UnwrapInput, Error>
Decrypt and integrity-check wrapped key material into an
UnwrapInput for a typed unwrap mint. Every integrity failure —
including input outside the wrapped-form domain — fails
Error::AuthenticationFailed.
Sourcepub fn algorithm_name(&self) -> String
pub fn algorithm_name(&self) -> String
The registry algorithm name, "AES-KW".
Sourcepub fn algorithm_length(&self) -> u32
pub fn algorithm_length(&self) -> u32
The key length in bits.
Sourcepub fn extractable(&self) -> bool
pub fn extractable(&self) -> bool
Whether the key material may be exported.
Sourcepub fn can_unwrap(&self) -> bool
pub fn can_unwrap(&self) -> bool
Whether the key permits unwrap.
Sourcepub async fn to_wrap_input_raw(&self) -> Result<WrapInput, Error>
pub async fn to_wrap_input_raw(&self) -> Result<WrapInput, Error>
This key’s raw material as a WrapInput, behind the same
extractability gate as export_key_raw.
Sourcepub async fn to_wrap_input_jwk(&self) -> Result<WrapInput, Error>
pub async fn to_wrap_input_jwk(&self) -> Result<WrapInput, Error>
The JWK serialization as a WrapInput, behind the same gate.
Sourcepub async fn export_key_raw(&self) -> Result<Vec<u8>, Error>
pub async fn export_key_raw(&self) -> Result<Vec<u8>, Error>
The raw key material, behind the extractability gate.
Sourcepub async fn export_key_jwk(&self) -> Result<String, Error>
pub async fn export_key_jwk(&self) -> Result<String, Error>
The key as an oct JWK, behind the same gate.