isset($sig_result->email) &&
$GLOBALS['registry']->hasMethod('contacts/addField') &&
$GLOBALS['prefs']->getValue('add_source')) {
- $status[] = '[' . $this->getConfigParam('imp_contents')->linkViewJS($this->_mimepart, 'view_attach', _("View Certificate"), array('params' => array('mode' => IMP_Contents::RENDER_INLINE, 'view_smime_key' => 1))) . '] [' . Horde::link('#', '', null, null, $this->_impsmime->savePublicKeyURL($this->getConfigParam('imp_contents')->getMailbox(), $this->getConfigParam('imp_contents')->getUid(), $sig_id) . ' return false;') . _("Save Certificate in your Address Book") . '</a>]';
+ $status[] = '[' . $this->getConfigParam('imp_contents')->linkViewJS($this->_mimepart, 'view_attach', _("View Certificate"), array('params' => array('mode' => IMP_Contents::RENDER_INLINE, 'view_smime_key' => 1))) . '] [' . Horde::link('#', '', null, null, $this->_impsmime->savePublicKeyURL($this->getConfigParam('imp_contents')->getMailbox(), $this->getConfigParam('imp_contents')->getUid(), $base_id) . ' return false;') . _("Save Certificate in your Address Book") . '</a>]';
}
} catch (Horde_Exception $e) {
self::$_cache[$base_id]['status'][0]['icon'] = Horde::img('alerts/error.png', _("Error"));
$contents = $injector->getInstance('IMP_Injector_Factory_Contents')->create(new IMP_Indices($vars->mailbox, $vars->uid));
$mime_part = $contents->getMIMEPart($vars->mime_id);
if (empty($mime_part)) {
- throw new IMP_Exception('Cannot retrieve public key from message.');
+ throw new IMP_Exception(_("Cannot retrieve public key from message."));
}
/* Add the public key to the storage system. */
try {
- $imp_smime->addPublicKey($mime_part);
+ $stream = $vars->mime_id
+ ? $contents->getBodyPart($vars->mime_id, array('mimeheaders' => true, 'stream' => true))
+ : $contents->fullMessageText();
+ $raw_text = $mime_part->replaceEOL($stream, Horde_Mime_Part::RFC_EOL);
+
+ $sig_result = $imp_smime->verifySignature($raw_text);
+ $imp_smime->addPublicKey($sig_result->cert);
echo Horde::wrapInlineScript(array('window.close();'));
} catch (Horde_Exception $e) {
- $notification->push(_("No Certificate found"), 'horde.error');
+ throw new IMP_Exception(_("No certificate found."));
}
break;
}