pub struct Pkcs7Ref(/* private fields */);
Expand description
Reference to Pkcs7
Implementations§
source§impl Pkcs7Ref
impl Pkcs7Ref
sourcepub fn to_smime(
&self,
input: &[u8],
flags: Pkcs7Flags
) -> Result<Vec<u8>, ErrorStack>
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
.
sourcepub fn to_pem(&self) -> Result<Vec<u8>, ErrorStack>
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
.
sourcepub fn to_der(&self) -> Result<Vec<u8>, ErrorStack>
pub fn to_der(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the data into a DER-encoded PKCS#7 structure.
This corresponds to i2d_PKCS7
.
sourcepub fn decrypt<PT>(
&self,
pkey: &PKeyRef<PT>,
cert: &X509Ref,
flags: Pkcs7Flags
) -> Result<Vec<u8>, ErrorStack>where
PT: HasPrivate,
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
.
sourcepub fn verify(
&self,
certs: &StackRef<X509>,
store: &X509StoreRef,
indata: Option<&[u8]>,
out: Option<&mut Vec<u8>>,
flags: Pkcs7Flags
) -> Result<(), ErrorStack>
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
.
sourcepub fn signers(
&self,
certs: &StackRef<X509>,
flags: Pkcs7Flags
) -> Result<Stack<X509>, ErrorStack>
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
.
sourcepub fn type_(&self) -> Option<&Asn1ObjectRef>
pub fn type_(&self) -> Option<&Asn1ObjectRef>
Return the type of a PKCS#7 structure as an Asn1Object
sourcepub fn signed(&self) -> Option<&Pkcs7SignedRef>
pub fn signed(&self) -> Option<&Pkcs7SignedRef>
Get the signed data of a PKCS#7 structure of type PKCS7_SIGNED