note 113835 added to function.openssl-pkcs7-verify

From: Date: Fri, 06 Dec 2013 09:34:20 +0000
Subject: note 113835 added to function.openssl-pkcs7-verify
Groups: php.notes 
Request: Send a blank email to php-notes+get-197807@lists.php.net to get a copy of this message
To read signed message in base64 (not encrypted with priv&pub key): You can just decode content by "base64_decode" or "imap_base64" functions and then erase by hand(regexp) sign from bottom of mail. Unfortunately in my case (mail from Outlook) that message (decoded by "base64_decode") has some additional special chars in some places (ie. before every attachment encoded base_64) what make message e-mail unable to parse. After couple of hours I solved this: It's needed to save single e-mail and use 2x "openssl_pkcs7_verify" function in row on original email (with headers and content in base64 ): 1st use - extract sign (certificate) from e-mail and save to file *.cert 2nd use - extract (with use that *.cert file) decoded message to file*.out Code: $handle = imap_open('mailbox.eml', '', ''); $msg = 'home/john/tmp/email1.eml'; imap_savebody($handle, $msg, 1); openssl_pkcs7_verify($msg, 0, $msg . '.cert'); openssl_pkcs7_verify($msg, 0, $msg . '.cert', array(), $msg . '.cert', $msg.'.out'); $email_content = file_get_contents($msg . '.out'); ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/function.openssl-pkcs7-verify.php Edit -- https://master.php.net/note/edit/113835 Del: integrated -- https://master.php.net/note/delete/113835/integrated Del: useless -- https://master.php.net/note/delete/113835/useless Del: bad code -- https://master.php.net/note/delete/113835/bad+code Del: spam -- https://master.php.net/note/delete/113835/spam Del: non-english -- https://master.php.net/note/delete/113835/non-english Del: in docs -- https://master.php.net/note/delete/113835/in+docs Del: other reasons-- https://master.php.net/note/delete/113835 Reject -- https://master.php.net/note/reject/113835 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197807) next »