{"id":2288,"date":"2015-01-08T12:42:19","date_gmt":"2015-01-08T20:42:19","guid":{"rendered":"http:\/\/www.curlybrace.com\/words\/?p=2288"},"modified":"2015-01-08T12:42:19","modified_gmt":"2015-01-08T20:42:19","slug":"minimal-steps-to-fake-authenticode-signature-self-signing","status":"publish","type":"post","link":"https:\/\/www.curlybrace.com\/words\/2015\/01\/minimal-steps-to-fake-authenticode-signature-self-signing\/","title":{"rendered":"Minimal Steps to Fake Authenticode Signature (Self-Signing)"},"content":{"rendered":"<p>Here are the minimum steps required to self-sign an executable for development and testing:<\/p>\n<pre class=\"dos\">makecert -sv mykey.pvk -n \"CN=MyCompany\" -len 2048 mycert.cer -r\npvk2pfx -pvk mykey.pvk -spc mycert.cer -pfx mycert.pfx -po mypassword\n<\/pre>\n<p>Note: You&#8217;ll be prompted to create a certificate password and it must match whatever you supply to <tt>pvk2pfx<\/tt> with the <tt>-po<\/tt> switch.<\/p>\n<p>To sign an executable, use:<\/p>\n<pre class=\"dos\">signtool sign \/f mycert.pfx \/t http:\/\/timestamp.comodoca.com\/authenticode \/v executable.exe\n<\/pre>\n<p>Note: once you have a real code signing certificate, you&#8217;ll use whatever timestamp server your provider gives you. Comodo works fine for self-signing testing purposes.<\/p>\n<p>To automatically sign a binary at build-time in Visual Studio, add go to your Project Settings | Build Events | Post-Build Event, and add something like this to the Command Line setting:<\/p>\n<pre>signtool sign \/f MyCertificatePath\\mycert.pfx \/p mypassword \/t http:\/\/timestamp.comodoca.com\/authenticode \/v $(TargetPath)\n<\/pre>\n<p>Explanation of <tt>makecert<\/tt> command:<\/p>\n<p>-sv Specifies the private key file.<\/p>\n<p>-n Specifies the certificate name.<\/p>\n<p>-len Generated key length, in bits. <a href=\"http:\/\/stackoverflow.com\/questions\/12844868\/clickonce-signers-certificate-not-valid-for-signing-when-using-makecer-pvk2pfx\">This StackOverflow answer<\/a> indicates that <a href=\"https:\/\/support.microsoft.com\/kb\/2661254?wa=wsignin1.0\">Microsoft released an update blocking certificates with keys under 1024 bits long<\/a>.<\/p>\n<p>-r Specifies self-signed, i.e. not a root certificate.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are the minimum steps required to self-sign an executable for development and testing: makecert -sv mykey.pvk -n &#8220;CN=MyCompany&#8221; -len 2048 mycert.cer -r pvk2pfx -pvk mykey.pvk -spc mycert.cer -pfx mycert.pfx -po mypassword Note: You&#8217;ll be prompted to create a certificate &hellip; <a href=\"https:\/\/www.curlybrace.com\/words\/2015\/01\/minimal-steps-to-fake-authenticode-signature-self-signing\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,283],"tags":[],"class_list":["post-2288","post","type-post","status-publish","format-standard","hentry","category-technology","category-windows-technology"],"_links":{"self":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/2288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/comments?post=2288"}],"version-history":[{"count":6,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/2288\/revisions"}],"predecessor-version":[{"id":2294,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/2288\/revisions\/2294"}],"wp:attachment":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/media?parent=2288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/categories?post=2288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/tags?post=2288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}