Change the Swift_Message to apply the signing.

@return $this
341784
public function signMessage(Swift_Message $message)
    {
        if (null === $this->signCertificate && null === $this->encryptCert) {
            return $this;
        }

        if ($this->signThenEncrypt) {
            $this->smimeSignMessage($message);
            $this->smimeEncryptMessage($message);
        } else {
            $this->smimeEncryptMessage($message);
            $this->smimeSignMessage($message);
        }
    }
1065636
public function createMessage(): Message
    {
        $message = \Swift_Message::newInstance()
            ->setSubject($this->options['subject'])
            ->setFrom($this->options['from'])
            ->setTo($this->options['recipient'])
            ->setBcc($this->options['bcc']);

        $this->setBody($message, $this->options['template'], $this->options['parameters']);

        foreach ($this->options['attachments'] as $file) {
            $message->attach($this->createAttachment($file));
        }

        return $message;
    }
633771
public function reset()
    {
        $this->_to = array();
        $this->_headers = array();
        $this->_subject = null;
        $this->_message = null;
        $this->_wrap = 78;
        $this->_params = null;
        $this->_attachments = array();
        $this->_uid = $this->getUniqueId();
        return $this;
    }
32170
public function apply()
    {
        if (!isset($_SESSION) || empty($_SESSION)) {
            return $this;
        }


        foreach ($this->messageBlocks as $messageBlock) {
            foreach ($messageBlock->getMessagesByStorage() as $storageType => $messages) {
                $this->addMessagesByStorageType($storageType, $messages);
            }
        }

        foreach ($this->scheduledMessages as $storageType => $messages) {
            $this->addMessagesByStorageType($storageType, $messages);
        }

        $types = array_keys($this->getMessageTypes());
        $updatedStorages = [];

        foreach ($types as $type) {
            $storage = $this->getStorageByMessageType($type);
            if ($storage && $storage->getMessages(false)->getItems()) {
                $updatedStorages[] = $type;
            }
        }


        if ($updatedStorages) {
            Mage::getSingleton('ecomdev_varnish/cookie')->set(
                self::COOKIE_NAME, implode(',', $updatedStorages)
            );
        }

        return $this;
    }
195948
public function addMessage(string $message)
  {
    if ( false === ($step=$this->currentStep()) ){
      throw new \Exception('No current step');
    }
    
    $step->addMessage($message);
    return $this;
  }
197361
private function doTransitionFromB() : self
    {
        if ($this->getToken() === Grammar::T_V) {
            $this
                ->setState(self::STATE_A)
                ->addPosition(1)
                ->addTokenValue(Grammar::T_V);
            return $this;
        }

        if ($this->getToken() === Grammar::T_I && $this->hasToken(1) && $this->getToken(1) === Grammar::T_V) {
            $this
                ->setState(self::STATE_Y)
                ->addPosition(2)
                ->addTokenValue(Grammar::T_V, Grammar::T_I);
            return $this;
        }

        if ($this->getToken() === Grammar::T_I && $this->hasToken(1) && $this->getToken(1) === Grammar::T_X) {
            $this
                ->setState(self::STATE_Y)
                ->addPosition(2)
                ->addTokenValue(Grammar::T_X, Grammar::T_I);
            return $this;
        }

        $this->setState(self::STATE_A);
        return $this;
    }
1289374
public function tick()
    {
        if ($this->ticksUntilUnload !== null) {
            --$this->ticksUntilUnload;
            if ($this->ticksUntilUnload < 1) {
                $this->unloadDoctrineEntities();
                $this->ticksUntilUnload = $this->unloadDoctrineEveryTick;
            }
        }

        return $this;
    }
1372435
protected function smimeEncryptMessage(Swift_Message $message)
    {
        // If we don't have a certificate we can't encrypt the message
        if (null === $this->encryptCert) {
            return;
        }

        // Work on a clone of the original message
        $encryptMessage = clone $message;
        $encryptMessage->clearSigners();

        if ($this->wrapFullMessage) {
            // The original message essentially becomes the body of the new
            // wrapped message
            $encryptMessage = $this->wrapMimeMessage($encryptMessage);
        } else {
            // Only keep header needed to parse the body correctly
            $this->clearAllHeaders($encryptMessage);
            $this->copyHeaders(
                $message,
                $encryptMessage,
                [
                    'Content-Type',
                    'Content-Transfer-Encoding',
                    'Content-Disposition',
                ]
            );
        }

        // Convert the message content (including headers) to a string
        // and place it in a temporary file
        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
        $encryptMessage->toByteStream($messageStream);
        $messageStream->commit();
        $encryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();

        // Encrypt the message
        if (!openssl_pkcs7_encrypt(
                $messageStream->getPath(),
                $encryptedMessageStream->getPath(),
                $this->encryptCert,
                [],
                0,
                $this->encryptCipher
            )
        ) {
            throw new Swift_IoException(sprintf('Failed to encrypt S/Mime message. Error: "%s".', openssl_error_string()));
        }

        // Parse the resulting signed message content back into the Swift message
        // preserving the original headers
        $this->parseSSLOutput($encryptedMessageStream, $message);
    }
563172
public function getSwiftMessage()
    {
        if (!$this->swiftMessage) {
            $this->swiftMessage = $this->getManager()->getSwift()->createMessage();
        }

        return $this->swiftMessage;
    }
178369
protected function setHttpOptions(): self
    {
        if ($this->config->has('http') && is_array($this->config->get('http'))) {
            $this->config->forget('http.base_uri');
            $this->httpOptions = $this->config->get('http');
        }

        return $this;
    }
146583
public function sign($hexPrivateKey)
    {
        $this->setSignatures(Signer::signMultiple($this->tosign, $hexPrivateKey));
        return $this;
    }
303681
public function sign(string $passphrase): AbstractTransaction
    {
        $publicKey = PublicKey::fromPassphrase($passphrase);
        $this->transaction->asset['delegate']['publicKey'] = $publicKey->getHex();

        parent::sign($passphrase);

        return $this;
    }
1192335
public function setNotificationRecipient($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->notification_recipient !== $v) {
            $this->notification_recipient = $v;
            $this->modifiedColumns[] = RemoteAppPeer::NOTIFICATION_RECIPIENT;
        }


        return $this;
    }
1106322
protected function doSign()
    {
        foreach ($this->bodySigners as $signer) {
            $altered = $signer->getAlteredHeaders();
            $this->saveHeaders($altered);
            $signer->signMessage($this);
        }

        foreach ($this->headerSigners as $signer) {
            $altered = $signer->getAlteredHeaders();
            $this->saveHeaders($altered);
            $signer->reset();

            $signer->setHeaders($this->getHeaders());

            $signer->startBody();
            $this->bodyToByteStream($signer);
            $signer->endBody();

            $signer->addSignature($this->getHeaders());
        }
    }
1145632
function signIn()
    {
        $this->identifier->withIdentity()->import($this->withIdentity());
        $this->identifier->signIn();
        return $this;
    }
25834
public function setErrorMessage($message)
    {
        switch (gettype($message)) {
            case 'string':
                $this->errorMessage = trim($message);
                break;
            case 'array':
                $this->errorMessage = empty($message) ? '' : $message;
                break;
            default:
                $this->errorMessage = '';
                break;
        }

        return $this;
    }
392150
public function setMessage() {

		$fieldnames = func_get_args();
		$instance	= $this -> getMessageInstance();

		if(0 === count($fieldnames)) {

			foreach($this -> rules as $rule) {
				$fieldnames[$rule -> field] = $rule -> field;
			}
		}	

		foreach($fieldnames as $fieldname) {

			if(false === is_string($fieldname)) {
				return trigger_error(sprintf('All fieldnames used in "%s"() must be of the type string, "%s" given', __METHOD__, gettype($fieldname)), E_USER_ERROR);
			}
		}

		if(count($instance :: getFieldnames()) === 0) {
			$instance :: setFieldnames($fieldnames);
		}

		return $instance;
	}