To verify a .p7m file with openssl_pkcs7_verify() you must convert it to S/MIME format. For example...<?phpfunction der2smime($file){ $to=<<<TXTMIME-Version: 1.0Content-Disposition: attachment; filename="smime.p7m"Content-Type: application/x-pkcs7-mime; smime-type=signed-data; name="smime.p7m"Content-Transfer-Encoding: base64\nTXT; $from=file_get_contents($file); $to.=chunk_split(base64_encode($from)); return file_put_contents($file,$to);}?>