Enable SSL verification of hostname using certificates with SAN DNS entries

This assumes that ASN1_STRING_data returns something that is:
- Terminated with `\0` and doesn't contain embedded `\0`
- Is UTF-8 formatted.

Please look at the original code to see what is necessary to convert to UTF-8, then check for invalid length and characters that cannot be correctly handled.  Do this here and below.