Pkcs7Ref

Struct Pkcs7Ref 

Source
pub struct Pkcs7Ref(/* private fields */);
Expand description

Reference to Pkcs7

Implementations§

Source§

impl Pkcs7Ref

Source

pub fn to_smime( &self, input: &[u8], flags: Pkcs7Flags, ) -> Result<Vec<u8>, ErrorStack>

Converts PKCS#7 structure to S/MIME format

This corresponds to SMIME_write_PKCS7.

Source

pub fn to_pem(&self) -> Result<Vec<u8>, ErrorStack>

Serializes the data into a PEM-encoded PKCS#7 structure.

The output will have a header of -----BEGIN PKCS7-----.

This corresponds to PEM_write_bio_PKCS7.

Source

pub fn to_der(&self) -> Result<Vec<u8>, ErrorStack>

Serializes the data into a DER-encoded PKCS#7 structure.

This corresponds to i2d_PKCS7.

Source

pub fn decrypt<PT>( &self, pkey: &PKeyRef<PT>, cert: &X509Ref, flags: Pkcs7Flags, ) -> Result<Vec<u8>, ErrorStack>
where PT: HasPrivate,

Decrypts data using the provided private key.

pkey is the recipient’s private key, and cert is the recipient’s certificate.

Returns the decrypted message.

This corresponds to PKCS7_decrypt.

Source

pub fn verify( &self, certs: &StackRef<X509>, store: &X509StoreRef, indata: Option<&[u8]>, out: Option<&mut Vec<u8>>, flags: Pkcs7Flags, ) -> Result<(), ErrorStack>

Verifies the PKCS#7 signedData structure contained by &self.

certs is a set of certificates in which to search for the signer’s certificate. store is a trusted certificate store (used for chain verification). indata is the signed data if the content is not present in &self. The content is written to out if it is not None.

This corresponds to PKCS7_verify.

Source

pub fn signers( &self, certs: &StackRef<X509>, flags: Pkcs7Flags, ) -> Result<Stack<X509>, ErrorStack>

Retrieve the signer’s certificates from the PKCS#7 structure without verifying them.

This corresponds to PKCS7_get0_signers.

Source

pub fn type_(&self) -> Option<&Asn1ObjectRef>

Return the type of a PKCS#7 structure as an Asn1Object

Source

pub fn signed(&self) -> Option<&Pkcs7SignedRef>

Get the signed data of a PKCS#7 structure of type PKCS7_SIGNED

Trait Implementations§

Source§

impl AsRef<Pkcs7Ref> for Pkcs7

Source§

fn as_ref(&self) -> &Pkcs7Ref

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<Pkcs7Ref> for Pkcs7

Source§

fn borrow(&self) -> &Pkcs7Ref

Immutably borrows from an owned value. Read more
Source§

impl ForeignTypeRef for Pkcs7Ref

Source§

type CType = PKCS7

The raw C type.
Source§

unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self

Constructs a shared instance of this type from its raw type.
Source§

unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self

Constructs a mutable reference of this type from its raw type.
Source§

fn as_ptr(&self) -> *mut Self::CType

Returns a raw pointer to the wrapped value.
Source§

impl Send for Pkcs7Ref

Source§

impl Sync for Pkcs7Ref

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.

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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 0 bytes