[Mono-devel-list] HTTPS Post

Martin Hinks mhinks at gmail.com
Mon Jun 20 03:55:38 EDT 2005


Trusting all certs should work fine, but how were you doing cert
validation before? It is possible to select only valid certs as
opposed to trusting all....

Have you looked at the TLSTest application?

Martin

On 6/17/05, Jeff Tickle <jeff at jefftickle.com> wrote:
> And now, here I am at work without my GPG key.  Oh well.
> 
> I did some more bug searching now that I've learned a bit more about
> what's going on here through IRC and such.  Turns out certificate trust
> seems to be a problem in mono.  I'll investigate it more, but for now,
> the workaround is to simply trust all certificates.  Works fine when I
> do that.
> 
> -Jeff
> 
> Jeff Tickle wrote:
> > Sorry, here's the exception:
> >
> > System.Net.WebException: Not connected ---> System.IO.IOException: The
> > authentication or decryption has failed.
> > in <0x001e1>
> > Mono.Security.Protocol.Tls.SslClientStream:NegotiateHandshake ()
> > in (wrapper remoting-invoke-with-check)
> > Mono.Security.Protocol.Tls.SslClientStream:NegotiateHandshake ()
> > in <0x000bb> Mono.Security.Protocol.Tls.SslClientStream:BeginWrite
> > (System.Byte[] buffer, Int32 offset, Int32 count, System.AsyncCallback
> > callback, System.Object state)
> > in <0x0001b> Mono.Security.Protocol.Tls.SslClientStream:Write
> > (System.Byte[] buffer, Int32 offset, Int32 count)
> > in <0x00035> System.Net.WebConnection:Write (System.Byte[] buffer, Int32
> > offset, Int32 size)--- End of inner exception stack trace ---
> >
> > in <0x0013b> System.Net.WebConnection:Write (System.Byte[] buffer, Int32
> > offset, Int32 size)
> > in <0x00116> System.Net.WebConnectionStream:WriteRequest ()
> > in (wrapper remoting-invoke-with-check)
> > System.Net.WebConnectionStream:WriteRequest ()
> > in <0x00147> System.Net.WebConnectionStream:Close ()
> > in <0x000a6> Test:Main (System.String[] args)
> >
> > Also, this is the 1.1.7 packaged with Ubuntu.  Last night, I installed
> > the binary package of 1.1.8 on my Debian server, and the exception is
> > much more concise, perhaps less-helpful:
> >
> > System.Net.WebException: Error writing request.
> > in <0x0020d> System.Net.WebConnectionStream:WriteRequest ()
> > in (wrapper remoting-invoke-with-check)
> > System.Net.WebConnectionStream:WriteRequest ()
> > in <0x00147> System.Net.WebConnectionStream:Close ()
> > in <0x000a6> Test:Main (System.String[] args)
> >
> > -Jeff
> >
> > Martin Hinks wrote:
> >
> >
> >
> >>>>>>What is the exact exception thrown - and where does the stack trace
> >>>>>>say it originated - it does indeed sound like a certmgr thing, but
> >>>>>>more information would help.
> >>>>>>
> >>>>>>Martin
> >>>>>>
> >>>>>>On 6/17/05, Jeff Tickle <jeff at jefftickle.com> wrote:
> >>>>>>
> >>>>>>Not sure if it's a bug or just my lack of understanding of
> >
> > security, but
> >
> >>>>>>the fact is, this code works without fail in .NET, but not in Mono:
> >>>>>>
> >>>>>>using System;
> >>>>>>using System.IO;
> >>>>>>using System.Net;
> >>>>>>
> >>>>>>public class Test {
> >>>>>>   public static void Main(string[] args)
> >>>>>>   {
> >>>>>>       try {
> >>>>>>           WebRequest request =
> >>>>>>WebRequest.Create("https://api.safepages.com/process.pl");
> >>>>>>           request.Method = "POST";
> >>>>>>           request.ContentType = "application/x-www-form-urlencoded";
> >>>>>>           byte[] bytes =
> >>>>>>System.Text.Encoding.UTF8.GetBytes("action=dialup_add&mode=test");
> >>>>>>           request.ContentLength = bytes.Length;
> >>>>>>           Stream s = request.GetRequestStream();
> >>>>>>           s.Write(bytes,0,bytes.Length);
> >>>>>>           s.Close();
> >>>>>>           Console.WriteLine(new
> >>>>>>StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd());
> >>>>>>       } catch (WebException e) {
> >>>>>>           Console.WriteLine(e);
> >>>>>>       }
> >>>>>>   }
> >>>>>>}
> >>>>>>
> >>>>>>It should return an error saying that the login was invalid.
> >
> > Instead it
> >
> >>>>>>throws an exception, and the stack trace suggests it has to do with a
> >>>>>>failure to agree on security.
> >>>>>>
> >>>>>>I did read a bit on certmgr.  I tried importing the certificate of this
> >>>>>>particular site, but it wouldn't go anywhere but the AddressBook and
> >>>>>>didn't seem to make a difference.
> >>>>>>
> >>>>>>Thanks for any help!
> >>>>>>
> >>>>>>-Jeff
> >>>>>>
> >
> >
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 


-- 
Martin Hinks



More information about the Mono-devel-list mailing list