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
impl DecryptionKey
Sourcepub async fn decrypt(
&self,
label: Option<Vec<u8>>,
ciphertext: Vec<u8>,
) -> Result<Vec<u8>, Error>
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
impl DecryptionKey
Sourcepub async fn unwrap(
&self,
label: Option<Vec<u8>>,
ciphertext: Vec<u8>,
) -> Result<UnwrapInput, Error>
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
impl DecryptionKey
Sourcepub fn algorithm_name(&self) -> String
pub fn algorithm_name(&self) -> String
See encryption-key.algorithm-name.
Source§impl DecryptionKey
impl DecryptionKey
Sourcepub fn algorithm_hash(&self) -> Option<String>
pub fn algorithm_hash(&self) -> Option<String>
See encryption-key.algorithm-hash.
Source§impl DecryptionKey
impl DecryptionKey
Sourcepub fn algorithm_length(&self) -> Option<u32>
pub fn algorithm_length(&self) -> Option<u32>
See encryption-key.algorithm-length.
Source§impl DecryptionKey
impl DecryptionKey
Sourcepub fn algorithm_public_exponent(&self) -> Option<Vec<u8>>
pub fn algorithm_public_exponent(&self) -> Option<Vec<u8>>
See encryption-key.algorithm-public-exponent.
Source§impl DecryptionKey
impl DecryptionKey
Sourcepub fn can_decrypt(&self) -> bool
pub fn can_decrypt(&self) -> bool
Whether this key may decrypt. See
decryption-key-options.can-decrypt.
Source§impl DecryptionKey
impl DecryptionKey
Sourcepub fn can_unwrap(&self) -> bool
pub fn can_unwrap(&self) -> bool
Whether this key may unwrap. See
decryption-key-options.can-unwrap.
Source§impl DecryptionKey
impl DecryptionKey
Sourcepub fn extractable(&self) -> bool
pub fn extractable(&self) -> bool
Whether the export functions may return this key’s material.
See decryption-key-options.extractable.
Source§impl DecryptionKey
impl DecryptionKey
Sourcepub async fn export_key_jwk(&self) -> Result<String, Error>
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
impl DecryptionKey
Source§impl DecryptionKey
impl DecryptionKey
Sourcepub async fn to_wrap_input_jwk(&self) -> Result<WrapInput, Error>
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
impl DecryptionKey
Sourcepub async fn to_wrap_input_pkcs8(&self) -> Result<WrapInput, Error>
pub async fn to_wrap_input_pkcs8(&self) -> Result<WrapInput, Error>
The PKCS#8 serialization as a wrap-input, behind the same
gate.