$sig_part = $this->_params['contents']->getMIMEPart($sig_id);
try {
- /* Check for 'x-imp-pgp-signature' type. This is set by the
- * 'plain' driver when parsing PGP armor text. */
- switch ($sig_part->getType()) {
- case 'application/x-imp-pgp-signature':
- $sig_result = $this->_imppgp->verifySignature($sig_part->getContents(array('canonical' => true)), $this->_address);
- break;
-
- default:
- $sig_result = $this->_imppgp->verifySignature($sig_part->replaceEOL($this->_params['contents']->getBodyPart($signed_id, array('mimeheaders' => true)), Horde_Mime_Part::RFC_EOL), $this->_address, $sig_part->getContents());
- break;
- }
+ $sig_result = $sig_part->getMetadata('imp-pgp-signature')
+ ? $this->_imppgp->verifySignature($sig_part->getContents(array('canonical' => true)), $this->_address)
+ : $this->_imppgp->verifySignature($sig_part->replaceEOL($this->_params['contents']->getBodyPart($signed_id, array('mimeheaders' => true)), Horde_Mime_Part::RFC_EOL), $this->_address, $sig_part->getContents());
$icon = Horde::img('alerts/success.png', _("Success"), null, $graphicsdir);
$sig_text = $sig_result->message;
$part1->setContents(substr($part1_data, strpos($part1_data, "\n\n") + 2));
$part2 = new Horde_Mime_Part();
- $part2->setType('application/x-imp-pgp-signature');
+ $part2->setType('application/pgp-signature');
$part2->setContents(Horde_String::convertCharset(implode("\n", $val['data']) . "\n" . implode("\n", $sig['data']), $charset));
+ // A true pgp-signature part would only contain the
+ // detached signature. However, we need to carry around
+ // the entire armored text to verify correctly. Use a
+ // IMP-specific content-type parameter to clue the PGP
+ // driver into this fact.
+ $part2->setMetadata('imp-pgp-signature', true);
$part->addPart($part1);
$part->addPart($part2);