mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-29 10:09:10 +01:00
Smime W.I.P:
- Return extracted signed content as horde_mime_part object
This commit is contained in:
parent
d38cc11f7e
commit
eb6fc7a366
@ -176,33 +176,11 @@ class Smime extends Horde_Crypt_Smime
|
|||||||
*
|
*
|
||||||
* @param string $data The signed S/MIME data.
|
* @param string $data The signed S/MIME data.
|
||||||
*
|
*
|
||||||
* @return string The contents embedded in the signed data.
|
* @return Horde_Mime_Part returns content of signed message as mime part object
|
||||||
* @throws Horde_Crypt_Exception
|
|
||||||
*/
|
*/
|
||||||
public function extractSignedContents($data)
|
public function extractSignedContents($data)
|
||||||
{
|
{
|
||||||
/* Check for availability of OpenSSL PHP extension. */
|
return \Horde_Mime_Part::parseMessage(parent::extractSignedContents($data));
|
||||||
$this->checkForOpenSSL();
|
|
||||||
|
|
||||||
/* Create temp files for input/output. */
|
|
||||||
$input = $this->_createTempFile('horde-smime');
|
|
||||||
$output = $this->_createTempFile('horde-smime');
|
|
||||||
$certs = $this->_createTempFile('horde-smime');
|
|
||||||
|
|
||||||
|
|
||||||
/* Write text to file. */
|
|
||||||
file_put_contents($input, $data);
|
|
||||||
unset($data);
|
|
||||||
|
|
||||||
if (openssl_pkcs7_verify($input, PKCS7_NOVERIFY, $certs) === true &&
|
|
||||||
openssl_pkcs7_verify($input, PKCS7_NOVERIFY, $certs, array(), $certs, $output) === true) {
|
|
||||||
$ret = file_get_contents($output);
|
|
||||||
if ($ret) {
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Horde_Crypt_Exception(Horde_Crypt_Translation::t("Could not extract data from signed S/MIME part."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user