Hello,
I think many people know and use
HttpListener[
^] class.
As far as I can see from the note on MSDN it supports https traffic:
If you create an HttpListener using https, you must select a Server Certificate for that listener. Otherwise, an HttpWebRequest query of this HttpListener will fail with an unexpected close of the connection.
I added root certificate to the trusted in localstorage and one more certificate to personal also in localstorage which signed by root certificate:
ROOT
makecert.exe -sr localmachine -ss MY -a sha1 -n "CN=Root,O=DO_NOT_TRUST,OU=test purposes" -sky signature -pe -r "Root.cer" -sv "RootKey.pvk"
Personal
makecert.exe -sr localmachine -ss MY -a sha1 -n "CN=*.codeproject.com,O=DO_NOT_TRUST,OU=test purposes" -sky exchange -pe -ir localmachine -iv "RootKey.pvk" -ic "Root.cer"
I binded certificate to port like this:
netsh http add sslcert ipport=0.0.0.0:8081 certhash="{hash}" appid={guid}
And everything works but only for sites on localhost. When I try to open for example https://codeproject.com. HttpListener "doesn't hear" request. Browser tries to open web page and failed with timeout.
BTW, I know it's called like man-in-the-middle attack but it's only for test purposes and unfortunately I can't use Fiddler which also use this technique.
By tradition my question is not simple, I believe here is no "free rating" guys, sorry :) but if you are able to help me it would be great.
One more note - I've read almost all articles about this and all examples for localhost there. So if you're going to provide me with the link to an article please check it may be this example also for localhost ;)
And one more - May be your suggestion will be using of TcpListner or something like this. For now I don't want to change logic, I will change logic if it only solution.
Thanks a lot. Timur.