1--TEST-- 2openssl_cms_verify() tests 3--SKIPIF-- 4<?php if (!extension_loaded("openssl")) print "skip"; ?> 5--FILE-- 6<?php 7$outfile = tempnam(sys_get_temp_dir(), "cms_v_basic"); 8if ($outfile === false) { 9 die("failed to get a temporary filename!"); 10} 11 12$contentfile = $outfile . ".out"; 13 14$pkcsfile = __DIR__ . "/openssl_cms_verify__pkcsfile.tmp"; 15$eml = __DIR__ . "/signed.eml"; 16$wrong = "wrong"; 17$empty = ""; 18$cainfo = array(); 19 20var_dump(openssl_cms_verify($wrong, 0)); 21var_dump(openssl_cms_verify($empty, 0)); 22var_dump(openssl_cms_verify($eml, 0)); 23var_dump(openssl_cms_verify($eml, 0, $empty)); 24var_dump(openssl_cms_verify($eml, OPENSSL_CMS_NOVERIFY, $outfile)); 25var_dump(openssl_cms_verify($eml, OPENSSL_CMS_NOVERIFY, $outfile, $cainfo, $outfile, $contentfile)); 26var_dump(openssl_cms_verify($eml, OPENSSL_CMS_NOVERIFY, $outfile, $cainfo, $outfile, $contentfile, $pkcsfile)); 27var_dump(file_get_contents($pkcsfile)); 28 29if (file_exists($outfile)) { 30 echo "true\n"; 31 unlink($outfile); 32} 33 34if (file_exists($contentfile)) { 35 echo "true\n"; 36 unlink($contentfile); 37} 38?> 39--CLEAN-- 40<?php 41unlink(__DIR__ . DIRECTORY_SEPARATOR . '/openssl_cms_verify__pkcsfile.tmp'); 42?> 43--EXPECT-- 44bool(false) 45bool(false) 46bool(false) 47bool(false) 48bool(true) 49bool(true) 50bool(true) 51string(2058) "-----BEGIN CMS----- 52MIIFzQYJKoZIhvcNAQcCoIIFvjCCBboCAQExDzANBglghkgBZQMEAgEFADALBgkq 53hkiG9w0BBwGgggNwMIIDbDCCAtWgAwIBAgIJAK7FVsxyN1CiMA0GCSqGSIb3DQEB 54BQUAMIGBMQswCQYDVQQGEwJCUjEaMBgGA1UECBMRUmlvIEdyYW5kZSBkbyBTdWwx 55FTATBgNVBAcTDFBvcnRvIEFsZWdyZTEeM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