Skip to main content

KwKey

Struct KwKey 

Source
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

Source

pub fn from_raw(raw: KwKey) -> Self

Wrap a raw kw-key resource.

Source

pub fn as_raw(&self) -> &KwKey

Borrow the raw kw-key resource.

Source

pub fn into_raw(self) -> KwKey

Unwrap into the raw kw-key resource.

Source§

impl KwKey

Source

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.

Source

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.

Source

pub fn algorithm_name(&self) -> String

The registry algorithm name, "AES-KW".

Source

pub fn algorithm_length(&self) -> u32

The key length in bits.

Source

pub fn extractable(&self) -> bool

Whether the key material may be exported.

Source

pub fn can_wrap(&self) -> bool

Whether the key permits wrap.

Source

pub fn can_unwrap(&self) -> bool

Whether the key permits unwrap.

Source

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.

Source

pub async fn to_wrap_input_jwk(&self) -> Result<WrapInput, Error>

The JWK serialization as a WrapInput, behind the same gate.

Source

pub async fn export_key_raw(&self) -> Result<Vec<u8>, Error>

The raw key material, behind the extractability gate.

Source

pub async fn export_key_jwk(&self) -> Result<String, Error>

The key as an oct JWK, behind the same gate.

Trait Implementations§

Source§

impl Debug for KwKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<KwKey> for KwKey

Source§

fn from(raw: KwKey) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !Freeze for KwKey

§

impl RefUnwindSafe for KwKey

§

impl Send for KwKey

§

impl Sync for KwKey

§

impl Unpin for KwKey

§

impl UnsafeUnpin for KwKey

§

impl UnwindSafe for KwKey

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Resource for T
where T: 'static,

§

type Rep = Option<T>

The type which is actually stored in-memory for this resource. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.