{"id":647,"date":"2006-12-15T18:55:32","date_gmt":"2006-12-16T02:55:32","guid":{"rendered":"\/?p=647"},"modified":"2006-12-16T01:25:48","modified_gmt":"2006-12-16T09:25:48","slug":"creating-test-certificates-2","status":"publish","type":"post","link":"https:\/\/www.identityblog.com\/?p=647","title":{"rendered":"Creating test certificates"},"content":{"rendered":"<p>Once you have a Certificate Authority, you have a factory for producing certificates.&nbsp; This will let you mint test certificates for&nbsp;your InfoCard relying party (they will also work should you want&nbsp;to experiment with&nbsp;being&nbsp;a managed card provider).<\/p>\n<p>The gotcha is that before they will work on&nbsp;a machine, they have to be hand-installed.&nbsp; Why?&nbsp; They have&nbsp;not been&nbsp;issued by&nbsp;the widely distributed&nbsp;trust root authorities&nbsp;shipped with Window,&nbsp; Macs, and&nbsp;Linux.&nbsp; Thus they don&#39;t work &#8220;out of the box&#8221;.&nbsp;&nbsp;That&#39;s why you&nbsp;need for the installation step.<\/p>\n<p>The result is that&nbsp;while perfect for testing and experimentation, these certs won&#39;t work as production certs in the real world.&nbsp;&nbsp; There you&#39;ll have to go to a commercial provider.&nbsp; But this won&#39;t break the bank.&nbsp; My identityblog cert costs quite a bit less $2.00 per month.<\/p>\n<p>We&#39;ll deal with this issues in another part of this guide.&nbsp; For now,&nbsp;let&#39;s turn to using your factory to create a test cert.<\/p>\n<p><strong>Create a Certificate Request for your machine<\/strong><\/p>\n<p>Change directory&nbsp;to the &#8220;openssl\/democa&#8221; directory you made earlier.&nbsp; Run&nbsp;&#8220;makereq&#8221; to generate a <strong>machine SSL key<\/strong> and corresponding <strong>certificate request<\/strong>. This time the system will ask for a passphrase to protect the SSL key for which the cert is being requested. In other words, this is a different key, cert and passphrase combination than you used with the Certificate Authority.<\/p>\n<p>When running the script, enter a simple&nbsp;DNS name as the CN (hostname) field.&nbsp; In my case, for example,&nbsp;I used <a href=\"https:\/\/www.identityblog.com\/\">www.identityblog.com<\/a> as the CN. <em>Don&#39;t use the http:\/\/ prefix or nothing works!<\/em><\/p>\n<p><a href=\"\/wp-content\/images\/2006\/12\/makereq.gif\"><img title=\"makereq screenshot\" alt=\"makereq screenshot\" src=\"\/wp-content\/images\/2006\/12\/makereq-thumb.gif\" \/><\/a><\/p>\n<p>After running the script, the machine&#39;s private key will be written to democa\/keys\/privkey.pem. Meanwhile a certificate request will be placed in democa\/requests\/cert.csr.<\/p>\n<p><strong>Create your Certificate<\/strong><\/p>\n<p>Next, run &#8220;makecert&#8221; &#8211; which puts the certificate request from the last step into the Certificate Authority (i.e. factory) to produce a certificate. You&#39;ll be asked for the CA&#39;s passphrase:<\/p>\n<p><a href=\"\/wp-content\/images\/2006\/12\/makecert.gif\"><img title=\"makecert screenshot\" alt=\"makecert screenshot\" src=\"\/wp-content\/images\/2006\/12\/makecert-thumb.gif\" \/><\/a><\/p>\n<p>When this is complete, the cert has been created, and is in &#8220;democa\/certs\/cert.crt&#8221;.<\/p>\n<p><strong>If you want to use the cert within IIS<\/strong><\/p>\n<p>If you want to use the cert in IIS, run &#8220;makep12&#8221; and get ready for a final conflagration of passprases. This script combines your private key and cert into a single &#8220;.p12&#8221; file that can be installed as a windows machine cert. To do so it performs a format translation. You will have to supply the machine key&#39;s passphrase to decode the &#8220;.pem&#8221; formatted file so the translation can proceed. Then you will be asked for an export passphrase (the one used to protect it in the new p12 format). I always use the same passphrase &#8211; who cares what format the information is in?<\/p>\n<p><a href=\"\/wp-content\/images\/2006\/12\/makep12.gif\"><img title=\"makep12 screenshot\" alt=\"makep12 screenshot\" src=\"\/wp-content\/images\/2006\/12\/makep12-thumb.gif\" \/><\/a><\/p>\n<p>&#8220;makep12&#8221; puts the combined Windows key\/certificate file in &#8220;democa\/keys\/iiscert.p12&#8221;<\/p>\n<p>Now your openssl machine key is in &#8220;democa\/keys\/privkey.pem&#8221;. Your machine cert is in &#8220;democa\/certs\/cert.crt&#8221;. Your IIS key\/cert combination, if you made one, is in &#8220;democa\/keys\/iiscert.p12&#8221;.<\/p>\n<p><strong>Moving the files into the &#8220;keys&#8221; directory<\/strong><\/p>\n<p>To use my sample managed card code, create a &#8220;keys&#8221; directory under your http server&#39;s root directory. Move the privkey.pem you just created into <strong>&#8220;keys\/host.key&#8221;<\/strong>. Move the cert you just created into <strong>&#8220;keys\/host.crt&#8221;.<\/strong> Create a file called <strong>&#8220;keys\/host.pwd&#8221;<\/strong> and put the machine key&#39;s passphrase into that file. Then the scripts I provide should work with your newly created keys and cert.<\/p>\n<p>Follow instructions elsewhere in this guide if you want to install the combined p12 key into Windows and IIS.<\/p>\n<p><strong>What if you want more certificates?<\/strong><\/p>\n<p>You&#39;ve got a certificate factory now, and can make as many certs as you like by going back to the &#8220;Create a certificate request&#8221; step and running through the process again.<\/p>\n<p>&nbsp;<\/p>\n<p><em \/><\/p>\n<p><strong \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once you have a Certificate Authority, you have a factory for producing certificates.&nbsp; This will let you mint test certificates for&nbsp;your InfoCard relying party (they will also work should you want&nbsp;to experiment with&nbsp;being&nbsp;a managed card provider). The gotcha is that before they will work on&nbsp;a machine, they have to be hand-installed.&nbsp; Why?&nbsp; They have&nbsp;not been&nbsp;issued &hellip; <a href=\"https:\/\/www.identityblog.com\/?p=647\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Creating test certificates<\/span><\/a><\/p>\n","protected":false},"author":68,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/posts\/647"}],"collection":[{"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=647"}],"version-history":[{"count":0,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=\/wp\/v2\/posts\/647\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.identityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.identityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}