[Mono-dev] HttpListener https bug?

salar2k salar2k at gmail.com
Mon Sep 6 01:11:11 EDT 2010

I'm trying to use Mono HttpListener but after some test I'm running into an
issue with HttpS.
The project works well with simple http requests but just doesn't serve

Here is what I've done to use it (win7), first try to create certificate

makecert -r -pe -n "CN=SALARPC" -b 01/01/2000 -e 01/01/2040 -eku -ss my -sr localMachine -sky exchange -sp "Microsoft RSA
SChannel Cryptographic Provider" -sy 12 -sv local.pvk local.cer

(this is microsoft makecert application)

I've create certifications without password.
and registration of files to the port:

httpcfg -add -port 9667 -pvk local.pvk -cert local.cer

All is done successfully.
Unfortunately it doesn't response to https port.
(note: actually httpcfg copies cer and pvk files for port 9667 to here:

Second try with openssl and pvktool:

    openssl genrsa -des3 -out localhost.pem 2048
    openssl rsa -in localhost.pem -out localhost.pem.nopass
    openssl req -new -key localhost.pem.nopass -out localhost.csr
    pvk -in localhost.pem.nopass -topvk -nocrypt -out localhost.pvk
    httpcfg -del -port 9667
    httpcfg -add -port 9667 -pvk localhost.pvk -cert localhost.crt

Still no luck with httplistener and https!

Debugging the mono code I realize that it throws internally an exception
during reading the request (HttpConnection.cs) which says "The
authentication or decryption has failed.":

    System.IO.IOException was caught
      Message=The authentication or decryption has failed.
           at Mono.Security.Protocol.Tls.SslStreamBase.EndRead(IAsyncResult
           at Mono.Net.HttpConnection.OnRead(IAsyncResult ares)
      InnerException: Mono.Security.Protocol.Tls.TlsException
           Message=A message could not be decoded because some field was out
of the specified range or the length of the message was incorrect.

Am I doing something wrong! What's the problem?
Or this is a bug?
[Mono-2.6.7 - windows 7]

View this message in context: http://mono.1490590.n4.nabble.com/HttpListener-https-bug-tp2527913p2527913.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list