0

Edit: Having read this question and answer I have a bit more of an understanding. My question now then, is: can I use a certificate that a user has had signed by a registered CA such as VeriSign, GoDaddy, etc, in place of signing a certificate myself? If so, what mechanism do I need to use to verify it? Will CRL or OCSP have details from all CAs or will I need to check their individual registers?

Original: I'd like to know how I verify the validity of certificates from various CAs for the purpose of mutual authentication on a website, or whether this is even an issue to be considered?

I am in the process of learning about mutual authentication and how it works, along with certificate signing in general so any pointers or references to read to help understand this subject would be appreciated.

Currently I have a simple Ubuntu Server running in a VirtualBox that I am using to experiment with. This is running nginx and mysql, both of which are configured to require TLS/SSL. The next step I want to implement is mutual authentication between nginx and the client browser; I have successfully set this up on the server using a self-signed CA certificate. However, I am struggling to understand how the certificate sent by the browser is verified.

I have a public/private key pair on the host OS, and I could feasibly generate a certificate signing request and send it to the guest server, which could sign it against the CA certificate and return it to my host. This certificate will be signed, but not by a registered CA. Taking this one step further, I now visit another website that I do not control: does it need to sign my certificate also?

My understanding is that once a certificate has been signed that is it, it does not need to be signed again except for renewal. This is only true if signed by a registered CA such as GoDaddy, CACert, etc. Therefore, back to my website, how do I know whether this is a valid certificate? If I use CRL or OCSP to check whether it has been revoked or not, will it check for all providers or just the company who maintains the list/server?

Assuming that one way or another I can validate the authenticity of the certificate, how do I then use that to authenticate (or, I suppose more accurately, authorise) the specific user? Do I need to store a copy of their public key and check against this or is it possible to extract some unique detail that would enable me to authorise them?

This is a new area for me and I have undoubtedly made some incorrect assumptions as well as exposed some gaps in my knowledge and understanding of the subject. I'd appreciate any answers that will help correct these. Also, if the question isn't specific enough for forum rules I apologise and any guidance on how to better frame it so it doesn't violate the rules would be helpful.

2

Mutual/client authentication via certificates is not a common configuration, thus you may not find much information on this topic, e.g. for nginx, as you might expect.

That said, you asked:

  • "Can I use a certificate that a user has had signed by a registered CA such as VeriSign, GoDaddy, etc, in place of signing a certificate myself?"

Yes. Let's assume that your client has a certificate, issued by one of the above CAs. To get that client to send its certificate to your server (e.g. nginx), you need to configure your server with a list of CAs that it will trust. As part of the SSL/TLS handshake, the server "requests" that the client send its client certificate by sending to the client a list of CAs that the server trusts; the client can then choose one (among possibly several) certificate that has a "trust path" to those of those CAs that the server trusts.

This means that on the server end, you can configure the list of CAs you trust, using their certificates (and public keys); you do not need the private keys of the CAs for this.

  • "If so, what mechanism do I need to use to verify it? Will CRL or OCSP have details from all CAs or will I need to check their individual registers?"

OK, this is where things might be a little tricky. The practical answer to this question is "it depends on the software/application you are using". Since mutual/client authentication is not very common, many applications may not have CRL/OCSP functionality for client certificate verification implemented. But let's assume, for the sake of discussion, that nginx (or mysql) can do this.

Within an X509v3 certificate itself, there are extensions which define where to find the CRLs for verifying that certificate, and/or for defining the OCSP responder to contact for verification.

The CRLs relevant to the presented certificate should be defined, in that certificate, by the CRL distribution points extension. There are many possible formats for this extension; the linked RFC 5280 documentation goes into specifics. But this extension, if present, is what any software (such as your website server) would look for, in order to discover where/how to get any CRLs that might mention this certificate.

The URL for the OCSP responder to contact, for example, might appear in the "authority information access" extension of the certificate. For example, using openssl x509 -noout -text < /path/to/cert.pem on a certificate, you might see this displayed like so:

Certificate:
    Data:
        Version: 3 (0x2)

        ...

        X509v3 extensions:
            X509v3 Basic Constraints: 
                CA:FALSE

            ...

            Authority Information Access: 
                OCSP - URI:https://ocsp.example.com

Thus the server in question has to parse these attributes/extensions out of the client-provided certificate in order to discover who to contact, for that certificate, for CRLs or OCSP data for that certificate. In most cases, the CAs signing/issuing the certificates will also be the organizations maintaining the CRLs and/or OCSP responders for those certificates.

Hope this helps!

  • That's a really helpful answer, thanks. I had put that project on the back burner for a while as I was struggling to find this information. VMT! – Ashley Bye Feb 20 '16 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.