diff options
Diffstat (limited to 'plugins/enigma/lib/enigma_engine.php')
-rw-r--r-- | plugins/enigma/lib/enigma_engine.php | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php index 8a64c07ff..e4972c6a9 100644 --- a/plugins/enigma/lib/enigma_engine.php +++ b/plugins/enigma/lib/enigma_engine.php @@ -92,9 +92,6 @@ class enigma_engine if ($this->smime_driver) return; - // NOT IMPLEMENTED! - return; - $driver = 'enigma_driver_' . $this->rc->config->get('enigma_smime_driver', 'phpssl'); $username = $this->rc->user->get_username(); @@ -246,7 +243,7 @@ class enigma_engine fclose($fh); } - + /** * Handler for PGP/MIME signed message. * Verifies signature. @@ -255,14 +252,14 @@ class enigma_engine */ private function parse_pgp_signed(&$p) { - $this->load_pgp_driver(); - $struct = $p['structure']; - // Verify signature if ($this->rc->action == 'show' || $this->rc->action == 'preview') { + $this->load_pgp_driver(); + $struct = $p['structure']; + $msg_part = $struct->parts[0]; $sig_part = $struct->parts[1]; - + // Get bodies $this->set_part_body($msg_part, $p['object']->uid); $this->set_part_body($sig_part, $p['object']->uid); @@ -294,7 +291,31 @@ class enigma_engine */ private function parse_smime_signed(&$p) { - $this->load_smime_driver(); + // Verify signature + if ($this->rc->action == 'show' || $this->rc->action == 'preview') { + $this->load_smime_driver(); + + $struct = $p['structure']; + $msg_part = $struct->parts[0]; + + // Verify + $sig = $this->smime_driver->verify($struct, $p['object']); + + // Store signature data for display + $this->signatures[$struct->mime_id] = $sig; + + // Message can be multipart (assign signature to each subpart) + if (!empty($msg_part->parts)) { + foreach ($msg_part->parts as $part) + $this->signed_parts[$part->mime_id] = $struct->mime_id; + } + else { + $this->signed_parts[$msg_part->mime_id] = $struct->mime_id; + } + + // Remove signature file from attachments list + unset($struct->parts[1]); + } } /** @@ -306,22 +327,22 @@ class enigma_engine { $this->load_pgp_driver(); $part = $p['structure']; - + // Get body $this->set_part_body($part, $p['object']->uid); - // Decrypt + // Decrypt $result = $this->pgp_decrypt($part->body); - + // Store decryption status $this->decryptions[$part->mime_id] = $result; - + // Parse decrypted message if ($result === true) { // @TODO } } - + /** * Handler for PGP/MIME encrypted message. * @@ -359,7 +380,7 @@ class enigma_engine */ private function parse_smime_encrypted(&$p) { - $this->load_smime_driver(); +// $this->load_smime_driver(); } /** |