roundcubemail/plugins/enigma/lib/enigma_engine.php
private function parse_plain_signed(&$p, $body, $prefix = '')
    {
        if (!$this->rc->config->get('enigma_signatures', true)) {
            return;
        }

        $this->load_pgp_driver();
        $part = $p['structure'];

        // Verify signature
        if ($this->rc->action == 'show' || $this->rc->action == 'preview' || $this->rc->action == 'print') {
            $sig = $this->pgp_verify($body);
        }

        // In this way we can use fgets on string as on file handle
        // Don't use php://temp for security (body may come from an encrypted part)
        $fd = fopen('php://memory', 'r+');
        if (!$fd) {
            return;
        }

        fwrite($fd, $body);
        rewind($fd);

        $body = $part->body = null;
        $part->body_modified = true;

        // Extract body (and signature?)
        while (($line = fgets($fd, 1024)) !== false) {
            if ($part->body === null)
                $part->body = '';
            else if (preg_match('/^-----BEGIN PGP SIGNATURE-----/', $line))
                break;
            else
                $part->body .= $line;
        }

        fclose($fd);

        // Remove "Hash" Armor Headers
        $part->body = preg_replace('/^.*\r*\n\r*\n/', '', $part->body);
        // de-Dash-Escape (RFC2440)
        $part->body = preg_replace('/(^|\n)- -/', '\\1-', $part->body);

        if ($prefix) {
            $part->body = $prefix . $part->body;
        }

        // Store signature data for display
        if (!empty($sig)) {
            $sig->partial = !empty($prefix);
            $this->signatures[$part->mime_id] = $sig;
        }
    }
private function parse_plain_signed(&$p, $body, $prefix = '')
    {
        if (!$this->rc->config->get('enigma_signatures', true)) {
            return;
        }

        $this->load_pgp_driver();
        $part = $p['structure'];

        // Verify signature
        if ($this->rc->action == 'show' || $this->rc->action == 'preview' || $this->rc->action == 'print') {
            $sig = $this->pgp_verify($body);
        }

        // In this way we can use fgets on string as on file handle
        // Don't use php://temp for security (body may come from an encrypted part)
        $fd = fopen('php://memory', 'r+');
        if (!$fd) {
            return;
        }

        fwrite($fd, $body);
        rewind($fd);

        $body = $part->body = null;
        $part->body_modified = true;

        // Extract body (and signature?)
        while (($line = fgets($fd, 1024)) !== false) {
            if ($part->body === null)
                $part->body = '';
            else if (preg_match('/^-----BEGIN PGP SIGNATURE-----/', $line))
                break;
            else
                $part->body .= $line;
        }

        fclose($fd);

        // Remove "Hash" Armor Headers
        $part->body = preg_replace('/^.*\r*\n\r*\n/', '', $part->body);
        // de-Dash-Escape (RFC2440)
        $part->body = preg_replace('/(^|\n)- -/', '\\1-', $part->body);

        if ($prefix) {
            $part->body = $prefix . $part->body;
        }

        // Store signature data for display
        if (!empty($sig)) {
            $sig->partial = !empty($prefix);
            $this->signatures[$part->mime_id] = $sig;
        }
    }
private function parse_plain_signed ( & $ p , $ body , $ prefix = '' ) { if ( ! $ this -> rc -> config -> get ( 'enigma_signatures' , true ) ) { return ; } $ this -> load_pgp_driver ( ) ; $ part = $ p [ 'structure' ] ; // Verify signature if ( $ this -> rc -> action == 'show' || $ this -> rc -> action == 'preview' || $ this -> rc -> action == 'print' ) { $ sig = $ this -> pgp_verify ( $ body ) ; } // In this way we can use fgets on string as on file handle // Don't use php://temp for security (body may come from an encrypted part) $ fd = fopen ( 'php://memory' , 'r+' ) ; if ( ! $ fd ) { return ; } fwrite ( $ fd , $ body ) ; rewind ( $ fd ) ; $ body = $ part -> body = null ; $ part -> body_modified = true ; // Extract body (and signature?) while ( ( $ line = fgets ( $ fd , 1024 ) ) !== false ) { if ( $ part -> body === null ) $ part -> body = '' ; else if ( preg_match ( '/^-----BEGIN PGP SIGNATURE-----/' , $ line ) ) break ; else $ part -> body .= $ line ; } fclose ( $ fd ) ; // Remove "Hash" Armor Headers $ part -> body = preg_replace ( '/^.*\r*\n\r*\n/' , '' , $ part -> body ) ; // de-Dash-Escape (RFC2440) $ part -> body = preg_replace ( '/(^|\n)- -/' , '\\1-' , $ part -> body ) ; if ( $ prefix ) { $ part -> body = $ prefix . $ part -> body ; } // Store signature data for display if ( ! empty ( $ sig ) ) { $ sig -> partial = ! empty ( $ prefix ) ; $ this -> signatures [ $ part -> mime_id ] = $ sig ; } }
Handler for plain signed message.
Excludes message and signature bodies and verifies signature.

@param array  Reference to hook's parameters
@param string Message (part) body
@param string Body prefix (additional text before the encrypted block)
Handler for plain signed message . Excludes message and signature bodies and verifies signature .