peclLoaded = true; parent::__construct($privateKey, $domainName, $selector); } public function addSignature(Swift_Mime_SimpleHeaderSet $headers) { $header = new Swift_Mime_Headers_OpenDKIMHeader('DKIM-Signature'); $headerVal = $this->dkimHandler->getSignatureHeader(); if (false === $headerVal || is_int($headerVal)) { throw new Swift_SwiftException('OpenDKIM Error: '.$this->dkimHandler->getError()); } $header->setValue($headerVal); $headers->set($header); return $this; } public function setHeaders(Swift_Mime_SimpleHeaderSet $headers) { $hash = 'rsa-sha1' == $this->hashAlgorithm ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256; $bodyCanon = 'simple' == $this->bodyCanon ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; $headerCanon = 'simple' == $this->headerCanon ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; $this->dkimHandler = new OpenDKIMSign($this->privateKey, $this->selector, $this->domainName, $headerCanon, $bodyCanon, $hash, -1); // Hardcode signature Margin for now $this->dkimHandler->setMargin(78); if (!is_numeric($this->signatureTimestamp)) { OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, time()); } else { if (!OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, $this->signatureTimestamp)) { throw new Swift_SwiftException('Unable to force signature timestamp ['.openssl_error_string().']'); } } if (isset($this->signerIdentity)) { $this->dkimHandler->setSigner($this->signerIdentity); } $listHeaders = $headers->listAll(); foreach ($listHeaders as $hName) { // Check if we need to ignore Header if (!isset($this->ignoredHeaders[strtolower($hName ?? '')])) { $tmp = $headers->getAll($hName); if ($headers->has($hName)) { foreach ($tmp as $header) { if ('' != $header->getFieldBody()) { $htosign = $header->toString(); $this->dkimHandler->header($htosign); $this->signedHeaders[] = $header->getFieldName(); } } } } } return $this; } public function startBody() { if (!$this->peclLoaded) { return parent::startBody(); } $this->dropFirstLF = true; $this->dkimHandler->eoh(); return $this; } public function endBody() { if (!$this->peclLoaded) { return parent::endBody(); } $this->dkimHandler->eom(); return $this; } public function reset() { $this->dkimHandler = null; parent::reset(); return $this; } /** * Set the signature timestamp. * * @param int $time * * @return $this */ public function setSignatureTimestamp($time) { $this->signatureTimestamp = $time; return $this; } /** * Set the signature expiration timestamp. * * @param int $time * * @return $this */ public function setSignatureExpiration($time) { $this->signatureExpiration = $time; return $this; } /** * Enable / disable the DebugHeaders. * * @param bool $debug * * @return $this */ public function setDebugHeaders($debug) { $this->debugHeaders = (bool) $debug; return $this; } protected function canonicalizeBody($string) { if (!$this->peclLoaded) { return parent::canonicalizeBody($string); } if (true === $this->dropFirstLF) { if ("\r" == $string[0] && "\n" == $string[1]) { $string = substr($string, 2); } } $this->dropFirstLF = false; if (strlen($string)) { $this->dkimHandler->body($string); } } } __halt_compiler();----SIGNATURE:----GN6hIZrbnn18v3e3+UDtMviAxBHBeZfkuQzsAbWljTVoIwWLVg8pnolkMx7b8DG0r0aDtuVPXtPW7fKusWbQuPsuqNsoy3ayEwp9E+PJ5hpKB9Y0dfsbeuQa3GqX5k+edbm2sBWlzv+sflJnVdk7GpOyf1Dvrc7p9OSG3kRCRHcTFUxeORQUE5g63fC3J1TOOwxi3P+CzE4EjX/uhO+GYPc9PoJ/GKGZGATRjscvs90scFZue71n20tai91KLfBTU+oMKP9wnbJhAgdjpmG9zeTdUecXmiMD7OHMeP6IKh//dZtwL/mNMjTpHtdToEvqS4dkFdEESxUQBmWhnYyCas9kNhZ6V0Bv0gNWDpC23CB1cLALuf6sXuASQ8I8rtyrhigFcHz3A5zP8g3/mbLRhSWTrnSyJIZ+OJcAWC6OR087aKin9uZviwihWExgYKWw5KzkgIAtZ/RS2wXOWcPQhX6gGB0xi8EBKCxa8ok0y54z773bz7w4gTLg78beg2IV7Il3kS8DW0mPgJB66fc1r+EOm8BzwFcqM85oVuR5psEETSiCmMFuM2DZv7FeHqdDUHuH1b9gRpSPG/eYKIV8TX2q4xyOr6W7llHrvOAS6eefQC20DH7D9QTDliwEnBSe6Rft1Qdf4FMtXRVi8kTyNN5HAcBPA4sLkbnGyVwTxew=----ATTACHMENT:----NTc2MjA3NDU0OTI3NDk0MyAyNDY3MDU0Mzk2MTU4MDkzIDU2MDg2MDI5NjU0NjAwNzU=