We use a custom app which uses Matrix SSL (client side) to perform certificate validation on MAC and Linux systems. My question is, does Matrix SSL keep a cert store cache of intermediate and trusted roots so it can perform its checks against what the server sends? Or does it call up something like OCSP or use AIA extensions like browsers do in order to validate the chain? Or can Matrix SSL be developed to use both methods?
After having a look at the documentation of MatrixSSL I assume that:
- Since it is transport layer agnostic it will not (and can not) retrieve missing intermediate certificates by itself. To do this it would need to have some kind of HTTP client (maybe with proxy support to) and I cannot see any such thing documented.
- It will also not check by itself, that the hostname matches the certificate. You need to add your own certValidator to do this. If you don't verify the hostname in the certificate you will accept any certificate signed by a trusted CA for an arbitrary host, which will effectively leave you open to man-in-the-middle attacks. That means implementing this is a must, unless you need to check only against some fixed certificates (i.e. certificate pinning).
- The API contains functions for CRL handling, but requires the developer to provide the CRL itself. It has function to get the URL for the CRL but the developer than has to retrieve the data for the URL by itself.
- There is no documented API for OCSP. Since OCSP requires HTTP access and since MatrixSSL itself is transport agnostic it can be assumed, that it will not do OCSP lookups by itself and will also not give the developer the necessary information to do OCSP lookups.
At the end this is about the security you get from OpenSSL, i.e. no hostname checking, only manual CRL, no documented API for OCSP (although there is an undocumented but fairly complex API in OpenSSL).
Since you are using MatrixSSL only for your own custom app I would recommend to keep it simple and secure by only accepting few specific certificates which are controlled by you and which are hard-coded inside the application. In this case you would not need the more complex stuff like hostname or revocation checks.
I think you are confusing two things. For browers, as for any other TLS stack I can think of, the certificate chain validation will be done by checking certificates signatures untill it finds a certificate already in its trust store. (You can go in the Preferences/Options of your browser and check the default trusted CAs).
Then, in order to check revocation status, it'll either use CRL, OCSP, or just doesn't even bother as revocation is kind of broken anyway.