public function buildEncrypted($certificate)
    {
        $stream = new Stream('php://temp', 'wb+');

        $content = base64_encode(
            (new Cryptography())->encrypt(
                json_encode(new MessageDecorator($this->getMessage())),
                $certificate
            )
        );

        $stream->write($content);

        return $this->getHttpMessage()
            ->withAddedHeader('Content-Type', 'text/plain')
            ->withBody($stream);
    }
public function buildEncrypted($certificate)
    {
        $stream = new Stream('php://temp', 'wb+');

        $content = base64_encode(
            (new Cryptography())->encrypt(
                json_encode(new MessageDecorator($this->getMessage())),
                $certificate
            )
        );

        $stream->write($content);

        return $this->getHttpMessage()
            ->withAddedHeader('Content-Type', 'text/plain')
            ->withBody($stream);
    }
public function buildEncrypted ( $ certificate ) { $ stream = new Stream ( 'php://temp' , 'wb+' ) ; $ content = base64_encode ( ( new Cryptography ( ) ) -> encrypt ( json_encode ( new MessageDecorator ( $ this -> getMessage ( ) ) ) , $ certificate ) ) ; $ stream -> write ( $ content ) ; return $ this -> getHttpMessage ( ) -> withAddedHeader ( 'Content-Type' , 'text/plain' ) -> withBody ( $ stream ) ; }
Build the encrypted response to send

@param string $certificate

@return MessageInterface
Build the encrypted response to send