{"id":94,"date":"2008-07-28T10:11:06","date_gmt":"2008-07-28T14:11:06","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=94"},"modified":"2011-09-15T13:26:46","modified_gmt":"2011-09-15T18:26:46","slug":"verify-pkcs7-cms","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=94","title":{"rendered":"Verify pkcs#7 CMS"},"content":{"rendered":"<p><strong>Use OpenSSL<\/strong><br \/>\nC:\\OpenSSL\\bin\\openssl\\smime -verify -binary -in c:\\temp\\toverify.bin -out c:\\temp\\toverify_temp.bin -inform DER -noverify > output.txt<\/p>\n<p><strong>Use CAPICOM<\/strong><\/p>\n<pre lang=\"csharp\">\r\nstring sodFile = @\"C:\\\\temp\\\\sod.bin\";\r\nUtilities ut = new UtilitiesClass();\r\nSignedData sd = new SignedDataClass();\r\nsd.Verify(\r\n(Convert.ToBase64String(ByteUtil.ReadBinaryFile(sodFile))), \r\nfalse, \r\nCAPICOM_SIGNED_DATA_VERIFY_FLAG.CAPICOM_VERIFY_SIGNATURE_ONLY);\r\n<\/pre>\n<p>Use Chilkat<\/p>\n<pre lang=\"csharp\">\r\nChilkat.Mime mime = new Mime();\r\nbool chilkatUnlocked = mime.UnlockComponent(\"trial\");\r\nlog.InfoFormat(\"Unlock Chilkat: {0}\", chilkatUnlocked);\r\n\r\nstring sodFile = @\"C:\\\\temp\\\\sod.bin\";\r\nbyte[] toverify = ByteUtil.ReadBinaryFile(sodFile);\r\n\r\nmime.LoadMimeBinary(toverify);\r\nmime.UnwrapExtras = false;\r\n\r\nbool verified = mime.UnwrapSecurity();\r\nlog.DebugFormat(\"verified: {0}\", verified);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Use OpenSSL C:\\OpenSSL\\bin\\openssl\\smime -verify -binary -in c:\\temp\\toverify.bin -out c:\\temp\\toverify_temp.bin -inform DER -noverify > output.txt Use CAPICOM string sodFile = @&#8221;C:\\\\temp\\\\sod.bin&#8221;; Utilities ut = new UtilitiesClass(); SignedData sd = new SignedDataClass(); sd.Verify( (Convert.ToBase64String(ByteUtil.ReadBinaryFile(sodFile))), false, CAPICOM_SIGNED_DATA_VERIFY_FLAG.CAPICOM_VERIFY_SIGNATURE_ONLY); Use Chilkat Chilkat.Mime mime = new &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=94\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[112],"tags":[],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-pki"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-1w","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=94"}],"version-history":[{"count":1,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":3408,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/94\/revisions\/3408"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}