Skip to main content

DecryptionKey

Struct DecryptionKey 

Source
pub struct DecryptionKey { /* private fields */ }
Expand description

A private key. decrypt and unwrap are one-shot on the immutable key; the extractability contract in README.md applies.

Implementations§

Source§

impl DecryptionKey

Source

pub async fn decrypt( &self, label: Option<Vec<u8>>, ciphertext: Vec<u8>, ) -> Result<Vec<u8>, Error>

Decrypt a ciphertext produced by the matching public key under the same label. Fails error.not-permitted without the can-decrypt grant; every decryption failure is the one detail-free error.authentication-failed (see the interface doc).

Source§

impl DecryptionKey

Source

pub async fn unwrap( &self, label: Option<Vec<u8>>, ciphertext: Vec<u8>, ) -> Result<UnwrapInput, Error>

Decrypt a wrapped key into an unwrap-input for a typed unwrap mint (see the wrapping interface): the material never reaches the caller. Fails error.not-permitted without the can-unwrap grant; failures are otherwise as decrypt.

Source§

impl DecryptionKey

Source

pub fn algorithm_name(&self) -> String

See encryption-key.algorithm-name.

Source§

impl DecryptionKey

Source

pub fn algorithm_hash(&self) -> Option<String>

See encryption-key.algorithm-hash.

Source§

impl DecryptionKey

Source

pub fn algorithm_length(&self) -> Option<u32>

See encryption-key.algorithm-length.

Source§

impl DecryptionKey

Source

pub fn algorithm_public_exponent(&self) -> Option<Vec<u8>>

See encryption-key.algorithm-public-exponent.

Source§

impl DecryptionKey

Source

pub fn can_decrypt(&self) -> bool

Whether this key may decrypt. See decryption-key-options.can-decrypt.

Source§

impl DecryptionKey

Source

pub fn can_unwrap(&self) -> bool

Whether this key may unwrap. See decryption-key-options.can-unwrap.

Source§

impl DecryptionKey

Source

pub fn extractable(&self) -> bool

Whether the export functions may return this key’s material. See decryption-key-options.extractable.

Source§

impl DecryptionKey

Source

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

The private key as a JWK, behind the extractability gate and fallible beyond it like every export (README.md, “Extractability”).

Source§

impl DecryptionKey

Source

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

The private key as a PKCS#8 PrivateKeyInfo (DER), behind the same gate.

Source§

impl DecryptionKey

Source

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

The private-key JWK serialization as a wrap-input, for wrapping under another key. Behind the extractability gate.

Source§

impl DecryptionKey

Source

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

The PKCS#8 serialization as a wrap-input, behind the same gate.

Trait Implementations§

Source§

impl Debug for DecryptionKey

Source§

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

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

impl From<DecryptionKey> for DecryptionKey

Source§

fn from(raw: DecryptionKey) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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.