Add client certificate authentication and SNI callback support #364
+1,083
−50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes #133
This PR adds convenience methods for client certificate authentication (mTLS) and Server Name Indication (SNI) callback support:
Client certificate methods (8 new methods on
http_request):has_client_certificate()- check if client presented a certificateget_client_cert_dn()- get subject Distinguished Nameget_client_cert_issuer_dn()- get issuer DNget_client_cert_cn()- get Common Name from subjectis_client_cert_verified()- check if certificate chain is verifiedget_client_cert_fingerprint_sha256()- get hex-encoded SHA-256 fingerprintget_client_cert_not_before()/get_client_cert_not_after()- get validity timesSNI callback support (requires libmicrohttpd 0.9.71+):
sni_callback()builder method oncreate_webserverFiles Changed
src/httpserver/http_request.hppsrc/http_request.cppsrc/httpserver/create_webserver.hppsrc/httpserver/webserver.hppsrc/webserver.cpptest/integ/ws_start_stop.cppexamples/client_cert_auth.cppREADME.mdTest plan
make check- 14/14 pass)