I need to verify the X509 certificate domain using OpenSSL C-land.
I understand that the library does not do this for me and that I should implement something like the following algorithm:
- If the dnsName field of the subjectAlternativeName extension is present, set this value
name. - Otherwise, set the
nameobject in the CN field. - Compare
namewith the requested host name, allowing each asterisk to match [A-Za-z0-9 _] +, but not "dot" (.).
It seems to me that this requires a lot of code, but I did not find it.
Can anyone find an example of this? Or, alternatively, test the performance of my algorithm?
EDIT: This is what I came up with: https://gist.github.com/2821083 . It seems really odd that OpenSSL would leave it until the code is called.
Burke source
share