{"id":245,"date":"2016-01-19T14:05:48","date_gmt":"2016-01-19T14:05:48","guid":{"rendered":"http:\/\/www.pkipartner.support\/?page_id=245"},"modified":"2016-01-28T10:35:01","modified_gmt":"2016-01-28T10:35:01","slug":"codesign-signing-jar-files","status":"publish","type":"page","link":"https:\/\/pkipartner.com\/support\/codesign-signing-jar-files\/","title":{"rendered":"Codesign &#8211; Signing JAR Files"},"content":{"rendered":"<h1>Signing JAR Files<\/h1>\n<h3>Option 1: \u00a0\u00a0\u00a0\u00a0 Use JarSigner with a PKCS12 file<\/h3>\n<h3 style=\"padding-left: 30px;\"><strong>Prerequisites:<\/strong><br \/>\n<strong>Java Development Kit (JDK):<\/strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<a href=\"http:\/\/java.sun.com\/products\/archive\/index.html\">5.0u8 or better<\/a><br \/>\n<strong>Operating System:<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Linux (or any Unix like OS), Mac OS X, Windows XP or better.<\/h3>\n<ol>\n<li>Export Certificate from the browser.\n<ul>\n<li>Internet Explorer(IE): <a href=\"https:\/\/support.comodo.com\/index.php?_m=knowledgebase&amp;_a=viewarticle&amp;kbarticleid=225\">How do I back up my Digital ID certificate? (Windows, IE)<\/a><\/li>\n<li>Firefox(FF): <a href=\"https:\/\/support.comodo.com\/index.php?_m=knowledgebase&amp;_a=viewarticle&amp;kbarticleid=1221\">How do I backup my certificate with Firefox?<\/a><\/li>\n<\/ul>\n<\/li>\n<li>Check to see if the Keytool can read the PFX(.p12) file<br \/>\n<strong>keytool -list -v -storetype pkcs12 -keystore file.pfx <\/strong><\/p>\n<p>If it can:<br \/>\njarsigner -tsa <a href=\"http:\/\/timestamp.comodoca.com\/rfc3161\"><strong>http:\/\/timestamp.comodoca.com\/rfc3161<\/strong><\/a> -storetype <strong>pkcs12<\/strong> -keystore <strong><em>file.pfx<\/em><\/strong> <em>myjar.jar<\/em> <strong>&#8220;myalias&#8221;<\/strong><\/p>\n<p><strong>Note:<\/strong> &#8220;myalias&#8221; is the alias listed in the output from the <strong>keytool -v -list<\/strong> command that was run above step.<\/p>\n<p><strong>Note2:<\/strong> In the event you wish to change your alias, please use:<\/p>\n<p><strong>keytool -changealias -alias <em>&#8220;your-current-alias&#8221;<\/em> -destalias <em>&#8220;new-alias&#8221;<\/em> -keystore <em>\/path\/to\/keystore<\/em> -storepass <em>your-keystore-password<\/em><\/strong><\/li>\n<li>To verify the signature of the file&#8230;<br \/>\n<strong>jarsigner -verify JAR_FILE <\/strong><\/p>\n<p>Where <strong>JAR_FILE<\/strong> is the file that was signed.<\/li>\n<\/ol>\n<p>That&#8217;s all there is to it.<\/p>\n<h3>Option 2: \u00a0\u00a0\u00a0\u00a0 Converting PVK and SPC to p12(PFX)<\/h3>\n<p><strong>Windows XP only!!!!!<\/strong><\/p>\n<p>If you already have a .PVK and .SPC file one will need to combine them into a PFX format with pvk2pfx tool which can be found as a part of <a href=\"http:\/\/www.microsoft.com\/whdc\/devtools\/wdk\/default.mspx\">Windows Driver Development Kit<\/a><\/p>\n<p>\u2022 pvk file (generated by IE, and stored in c:\\mykey.pvk by default when collecting Comodo&#8217;s Code Signing Certificate)<br \/>\n\u2022 spc file (the cert)<\/p>\n<p>&nbsp;<\/p>\n<ol>\n<li>Combine SPC and PVK into one PFX\/PKCS12 file.<br \/>\npvk2pfx -pvk <strong><em>mypvkfile.pvk<\/em><\/strong> -pi <strong><em>mypassword<\/em><\/strong> -spc <strong><em>myspcfile.spc<\/em><\/strong> -pfx <strong><em>mypfxfile.pfx<\/em><\/strong><\/li>\n<li>the PFX file has been created, check to see if the keytool can read the PFX\/P12 file:<br \/>\nkeytool -list -v -storetype pkcs12 -keystore <strong>file.pfx<\/strong><\/p>\n<p>If it can:<br \/>\njarsigner -tsa <a href=\"http:\/\/timestamp.comodoca.com\/rfc3161\">http:\/\/timestamp.comodoca.com\/rfc3161<\/a> -storetype pkcs12 -keystore <strong><em>file.pfx<\/em><\/strong><strong> myjar.jar <em>&#8220;myalias&#8221;<\/em><\/strong><\/p>\n<p><strong>Note:<\/strong> &#8220;myalias&#8221; is the alias listed in the output from the <strong>keytool -v -list<\/strong> command that was run in the previous step.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Signing JAR Files Option 1: \u00a0\u00a0\u00a0\u00a0 Use JarSigner with a PKCS12 file Prerequisites: Java Development Kit (JDK):\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a05.0u8 or better Operating System: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Linux (or any Unix like OS), Mac OS X, Windows XP or better. Export Certificate from the browser. Internet Explorer(IE): How do\u2026<\/p>\n<p> <a class=\"continue-reading-link\" href=\"https:\/\/pkipartner.com\/support\/codesign-signing-jar-files\/\"><span>Continue reading<\/span><i class=\"crycon-right-dir\"><\/i><\/a> <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/pkipartner.com\/support\/wp-json\/wp\/v2\/pages\/245"}],"collection":[{"href":"https:\/\/pkipartner.com\/support\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pkipartner.com\/support\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pkipartner.com\/support\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pkipartner.com\/support\/wp-json\/wp\/v2\/comments?post=245"}],"version-history":[{"count":3,"href":"https:\/\/pkipartner.com\/support\/wp-json\/wp\/v2\/pages\/245\/revisions"}],"predecessor-version":[{"id":601,"href":"https:\/\/pkipartner.com\/support\/wp-json\/wp\/v2\/pages\/245\/revisions\/601"}],"wp:attachment":[{"href":"https:\/\/pkipartner.com\/support\/wp-json\/wp\/v2\/media?parent=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}