Skip to main content

DecryptResult

Struct DecryptResult 

Source
pub struct DecryptResult<'ctx> { /* private fields */ }
Expand description

Result of a decryption operation. Exposes the plaintext bytes plus the underlying VerifyResult (which carries recipient / symenc / file info / protection info / format metadata).

Implementations§

Source§

impl<'ctx> DecryptResult<'ctx>

Source

pub fn plaintext(&self) -> &[u8]

The decrypted plaintext bytes.

Source

pub fn into_plaintext(self) -> Vec<u8>

Consume the result and return the owned plaintext bytes.

Source

pub fn verify_result(&self) -> &VerifyResult<'ctx>

Borrow the underlying verify result for full metadata access (per-signature status, etc.).

Source

pub fn recipient_count(&self) -> Result<usize>

Number of public-key recipients on the encrypted message.

Source

pub fn recipient_at(&self, idx: usize) -> Result<Option<Recipient>>

Borrow the recipient at idx.

Source

pub fn used_recipient(&self) -> Result<Option<Recipient>>

The recipient that actually decrypted the message (i.e. matched a key in the keyring). None if decrypted via a password.

Source

pub fn symenc_count(&self) -> Result<usize>

Number of password-based (symmetric) recipients.

Source

pub fn symenc_at(&self, idx: usize) -> Result<Option<Symenc>>

Borrow the symenc at idx.

Source

pub fn used_symenc(&self) -> Result<Option<Symenc>>

The symenc that actually decrypted the message (matched a supplied password). None if decrypted via a public-key recipient.

Source

pub fn file_info(&self) -> Result<Option<FileInfo>>

File metadata (name + mtime) from the literal-data packet.

Source

pub fn protection_info(&self) -> Result<(String, String, bool)>

(mode, cipher, valid) — protection info of the encrypted stream. mode is one of "none", "cfb", "cfb-mdc", "aead-ocb", "aead-eax". valid is true iff MDC/AEAD integrity was verified.

Source

pub fn format(&self) -> Result<char>

Format character of the literal data ('b', 't', 'u', etc.).

Auto Trait Implementations§

§

impl<'ctx> !RefUnwindSafe for DecryptResult<'ctx>

§

impl<'ctx> !Send for DecryptResult<'ctx>

§

impl<'ctx> !Sync for DecryptResult<'ctx>

§

impl<'ctx> !UnwindSafe for DecryptResult<'ctx>

§

impl<'ctx> Freeze for DecryptResult<'ctx>

§

impl<'ctx> Unpin for DecryptResult<'ctx>

§

impl<'ctx> UnsafeUnpin for DecryptResult<'ctx>

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.

Source§

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

Source§

type Error = !

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.