How do I catch the domain name mismatch?
I use SSL_get_peer_certificate(ssl) to get the certificate, then SSL_get_verify_result(ssl); to verify the certificate. How can i catch the domain name mismatch here as I am not catching it currently.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
SSL_get_verify_resultdoesnot do a hostname mismatch search. We have to do that manually taking into consideration multiple CN’s and subject alternative names(SAN’s) that come in the certificate.The functions that can be used for handling multiple CN’s are :
calling
X509_NAME_get_index_by_NIDagain using the new lastpos will give us the next CN until it returns -1 which says there are no more CN’s available.this function gives a
X509_NAME_ENTRY *, which can be converted tochar *usingASN1_STRING_to_UTF8.Be sure to consider the wildcards that come in the SAN’s and CN’s