[ Index ]

MailPress 7.2

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/ -> MP_Swift_Signer_smime.class.php (source)

   1  <?php
   2  class MP_Swift_Signer_smime extends MP_Swift_signer_
   3  {
   4      public $Swift_Signer_type = 'SMime';
   5  
   6  	function sign( $signer = false )
   7      {
   8          $config = get_option( Mailpress_signer_smime::option_name );
   9  
  10          if ( !$config ) return $signer;
  11  
  12          $signer = new Swift_Signers_SMimeSigner();
  13  
  14          $certificate = ( isset( $config['Certificate'] ) && !empty( $config['Certificate'] ) && is_file( $config['Certificate'] ) );
  15          $privatekey = ( isset( $config['privateKey'] ) && !empty( $config['privateKey'] ) && is_file( $config['privateKey'] ) );
  16          $passphrase = ( isset( $config['passphrase'] ) && !empty( $config['passphrase'] ) );
  17          $encryption = ( isset( $config['Encryption'] ) && !empty( $config['Encryption'] ) && is_file( $config['Encryption'] ) );
  18  
  19          if ( $certificate && $privatekey )
  20          {
  21              if ( $passphrase )     $signer->setSignCertificate( $config['Certificate'], [$config['privateKey'], $config['passphrase']] );
  22              else                $signer->setSignCertificate( $config['Certificate'],  $config['privateKey'] );
  23          }
  24  
  25          if ( $encryption ) $signer->setEncryptCertificate( $config['Encryption'] );
  26  
  27  
  28          return $signer;
  29      }
  30  }


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1