Crypt-SMIME

 view release on metacpan or  search on metacpan

SMIME.pod  view on Meta::CPAN

=item signonly()

  $sign = $smime->signonly($prepared_mime);

Generate a signature from a MIME message. The resulting signature is encoded in
Base64. The MIME message to be passed to this method should be preprocessed
beforehand by the prepareSmimeMessage() method. You would rarely need to call
this method directly.


The resulting signature will be tainted if any of the original MIME
message, the private key or its certificate is tainted.


=item prepareSmimeMessage()

  ($prepared_mime, $outer_header)
      = $smime->prepareSmimeMessage($source_mime);

Preprocess a MIME message to be signed. C<$prepared_mime> will be a string
containing the processed MIME message, and C<$outer_header> will be a string
that is a list of headers to be moved to the top-level of MIME message. You
would rarely need to call this method directly.


The entity body of C<$source_mime> will be directly copied to
C<$prepared_mime>. Any headers of C<$source_mime> except C<Content-*>, C<MIME-*>
and C<Subject> will be copied to C<$prepared_mime>, and those excluded headers
will be copied to C<$outer_header>. Note that the C<Subject> header will be
copied to both side exceptionally.


=item check()

  use Crypt::SMIME qw(:constants);

  $source_mime = $smime->check($signed_mime);
  $source_mime = $smime->check($signed_mime, $flags);

Verify a signature of S/MIME message and return a MIME message. The method dies
if it fails to verify it.


When the option C<Crypt::SMIME::NO_CHECK_CERTIFICATE> is given as
C<$flags>, the signer's certificate chain is not verified. The default
value for C<$flags> is C<0>, which performs all the verifications.


The resulting message will be tainted if the original S/MIME message,
the C<$flags>, verification time (L</setAtTime()>) or at least one
of the provided public keys are tainted.


=item encrypt()

  $encrypted_mime = $smime->encrypt($raw_mime);
  $encrypted_mime = $smime->encrypt($raw_mime, $cipher);

Encrypt a MIME message and return a S/MIME message. You can pass any
C<$cipher> string your OpenSSL library understands. Default is
"AES-128-CBC".


Any headers except C<Content-*>, C<MIME-*> and C<Subject> will be moved to the
top-level of the MIME message. C<Subject> header will be copied to both of the
plain text part and the top-level for mail clients which can't properly handle
S/MIME messages.


The resulting message will be tainted if the original MIME message or
at least one public key is tainted.


=item decrypt()

  $decrypted_mime = $smime->decrypt($encrypted_mime);

Decrypt an S/MIME and return a MIME message. This method dies if it fails to
decrypt it.


The resulting message will be tainted if any of the original S/MIME
message, the private key or its certificate is tainted.


=item isSigned()

  $is_signed = $smime->isSigned($mime);

Return true if the given string is a signed S/MIME message. Note that if the
message was encrypted after signing, this method returns false because in that
case the signature is hidden in the encrypted message.


=item isEncrypted()

  $is_encrypted = $smime->isEncrypted($mime);

Return true if the given string is an encrypted S/MIME message. Note that if the
message was signed with non-detached signature after encryption, this method
returns false because in that case the encrypted message is hidden in the
signature.


=back

=over

=item setAtTime()

  $yesterday = time - (60*60*24);
  $smime->setAtTime($yesterday);

Set the time to use for verification. Default is to use the current time.
Must be an unix epoch timestamp.


=item setVerifyFlags()

  $smime->setVerifyFlags(C<Crypt::SMIME::CRL_CHECK>);



( run in 0.511 second using v1.01-cache-2.11-cpan-e1769b4cff6 )