I'm using openssl_pkcs7_verify()
(http://www.php.net/manual/en/function.openssl-pkcs7-verify.php) to verify a signed mail content with smime (p7s) information. This function is useful for my purpose, but i want to use it with content stored on memory wrappers (php://memory or php://temp), openssl_pkcs7_verify()
accepts only filepaths as parameters and not filepointers (like ones i can get from a fopen('php://memory', ...) ), i tried to use this code:
$filep = fopen('php://memory', 'wb+');
$file_metadata = stream_get_meta_data($filep);
$filename = $file_metadata["uri"];
openssl_pkcs7_verify($filename, PKCS7_NOVERIFY, $filename)
but obviously $filename
contains php://memory
, and not particular reference to memory related to fopen
call (not to memory referenced by $filep
), so code generates an error about openssl_pkcs7_verify()
is unable to write on path passed on parameter 3. It forces me to use a temp file, but could be a great improvement use in memory content and not file content, avoiding I/O latency and other issues.