This now has the potential to return None if the certificate is invalid, the docstring should be updated.