/** * Signing tests */ function test_Signing() { $this->Mail->Body = 'This message is S/MIME signed.'; $this->BuildBody(); $dn = array('countryName' => 'UK', 'stateOrProvinceName' => 'Here', 'localityName' => 'There', 'organizationName' => 'PHP', 'organizationalUnitName' => 'PHPMailer', 'commonName' => 'PHPMailer Test', 'emailAddress' => '*****@*****.**'); $password = '******'; $certfile = 'certfile.txt'; $keyfile = 'keyfile.txt'; //Make a new key pair $pk = openssl_pkey_new(); //Create a certificate signing request $csr = openssl_csr_new($dn, $pk); //Create a self-signed cert $cert = openssl_csr_sign($csr, null, $pk, 1); //Save the cert openssl_x509_export($cert, $certout); file_put_contents($certfile, $certout); //Save the key openssl_pkey_export($pk, $pkeyout, $password); file_put_contents($keyfile, $pkeyout); $this->Mail->Sign($certfile, $keyfile, $password); $this->assertTrue($this->Mail->Send(), 'S/MIME signing failed'); unlink($certfile); unlink($keyfile); }
/** * Signing tests */ function test_Signing() { $this->Mail->Sign( 'certfile.txt', 'keyfile.txt', 'password' ); //TODO this is not really testing signing, but at least helps coverage }