<p>I want to do what myopenid does -- once you've logged, you can click a button that generates you an SSL certificate; the browser then downloads this certificate and stores it.  When you later go back to yourid.myopenid.com, your browser can use its stored certificate for authentication so you don't ever need a password.</p>

<p>So my questions is what is required to get this working?  How do I generate certificates?  How do I validate them once they're presented back to me?</p>

<p>My stack is Rails on Apache using Passenger, but I'm not too particular.</p>

[{'answer_id': 28717, 'author': 'russtbarnacle', 'author_id': 2178, 'author_profile': 'https://Stackoverflow.com/users/2178', 'pm_score': 4, 'selected': True, 'text': '<p>These are usually referred to as client side certificates.</p>\n\n<p>I\'ve not actually used it but a modified version of restful-authentication can be found here <a href="http://github.com/labria/restful-authentication/tree/master" rel="noreferrer">here</a> that looks like what your after.</p>\n\n<p>I found this via <a href="http://drnicwilliams.com/2008/02/22/zero-sign-on-with-client-certificates/" rel="noreferrer">Dr. Nic\'s post</a></p>\n'}, {'answer_id': 28742, 'author': 'Mark Renouf', 'author_id': 758, 'author_profile': 'https://Stackoverflow.com/users/758', 'pm_score': 2, 'selected': False, 'text': '<p>Depends on the server, but the simplest solution I know of, using Apache:</p>\n\n<p><strong><a href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#ssloptions" rel="nofollow noreferrer">FakeBasicAuth</a></strong></p>\n\n<blockquote>\n  <p>"When this option is enabled, the Subject Distinguished Name (DN) of the Client X509 Certificate is translated into a HTTP Basic Authorization username. This means that the standard Apache authentication methods can be used for access control. The user name is just the Subject of the Client\'s X509 Certificate (can be determined by running OpenSSL\'s openssl x509 command: openssl x509 -noout -subject -in certificate.crt). Note that no password is obtained from the user... "</p>\n</blockquote>\n\n<p>Not sure about rails, but the usual REMOTE_USER environment variable should be accessible in some way.</p>\n'}, {'answer_id': 33344, 'author': 'erickson', 'author_id': 3474, 'author_profile': 'https://Stackoverflow.com/users/3474', 'pm_score': 1, 'selected': False, 'text': '<p>If you want to generate certificates, you need to cause the client to generate a key pair, and send you at least the public key. You can do this in Firefox via a Javascript call, it\'s <a href="http://developer.mozilla.org/en/GenerateCRMFRequest" rel="nofollow noreferrer">crypto.generateCRMFRequest</a>. I\'m guessing there are browser-specific methods available in other browsers too. But first, you need to figure out how to issue a certificate once you get a public key.</p>\n\n<p>You could script something on the server with OpenSSL, but it has built-in support for CSRs, not the CRMF format Firefox will send you. So you\'d need to write some code to convert the CRMF to a CSR, which will require some sort of DER processing capability&hellip; I\'m just scratching the surface here&mdash;operating a CA, even for a toy application, is not trivial.</p>\n\n<p>SSO solutions like OpenId and PKI solutions do overlap, and there is an elegance in PKI. But the devil is in the details, and there are good reasons why this approach has been around a long time but has only taken off in government and military applications.</p>\n\n<p>If you are interested in pursuing this, follow up with some questions specific to the platform you would want to develop your CA service on.</p>\n'}, {'answer_id': 429477, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>I've been working on a solution to this problem.  I wanted to do the same thing and I know lots of other website owners want this feature,  with or without a third party provider. </p>\n\n<p>I created the necessary server setup and a firefox plugin to handle the certificate-based authentication.  Go to mypassfree.com to grab the free firefox plugin.  Email me (link on that page) for the server setup as I haven't packaged it yet with a nice installer.</p>\n\n<p>Server setup is Apache2 + OpenSSL + Perl  (but you could rewrite the perl scripts in any language) </p>\n\n<p>Jonathan</p>\n"}, {'answer_id': 13123984, 'author': 'Rich', 'author_id': 8261, 'author_profile': 'https://Stackoverflow.com/users/8261', 'pm_score': 1, 'selected': False, 'text': '<p>You can generate a certificate in the client\'s browser using browser-specific code. See <a href="https://stackoverflow.com/questions/9197484">this question</a></p>\n\n<p>You could also generate SSL client certs server-side using OpenSSL in Ruby (<a href="https://stackoverflow.com/questions/13028355">see this q</a>). (This will work in any browser without browser-specific code, but your server will have generated the client\'s private key, which is not ideal for crypto purists.)</p>\n\n<p>Whichever method you use to generate them, you will then need to configure your webserver to require the client certificates. See <a href="http://httpd.apache.org/docs/2.2/ssl/ssl_howto.html#accesscontrol" rel="nofollow noreferrer">the Apache docs</a> for an example.</p>\n'}]
['https://Stackoverflow.com/questions/28599', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1190/']