[IronPython] SslStream exception
Garabatus Raptus
garabatus at gmail.com
Wed Aug 1 12:37:32 PDT 2007
Thanxs a lot.
Now, I'm having another issue ... I want to bypass the Validation of
the server certificate but looks like the callback funtion is not
working properly.
Is this the way to create the Sslstream:
sslStream = SslStream( client.GetStream(), False,
RemoteCertificateValidationCallback ( self.ValidateServerCertificate),
None)
------------------
def ValidateServerCertificate( sender, certificate, chain, sslPolicyErrors):
return True
regards,
gara
On 8/1/07, Dino Viehland <dinov at exchange.microsoft.com> wrote:
> You have two options: You can catch a Python exception or a .NET exception, and you'll get either the Python exception object or the .NET exception object. To catch a .NET exception as a Python exception you need to catch the closest base exception which might be Exception or SystemError (if you let the exception go unhandled it's whatever gets reported there). To catch the .NET exception you just need to grab it from the correct namespace, for example:
>
> try:
> # do something
> except System.ArgumentException, ex:
> print ex
>
> and ex will end up being the ArgumentException instance.
>
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Garabatus Raptus
> Sent: Wednesday, August 01, 2007 10:20 AM
> To: users at lists.ironpython.com
> Subject: [IronPython] SslStream exception
>
> Hi there,
>
> I'm new to IronPython and I would like to know how can I catch an
> exception generated by SslStream, Example:
>
> client = TcpClient(self.server, self.port)
>
> sslStream = SslStream( client.GetStream(), False,
> RemoteCertificateValidationCallback (self.ValidateServerCertificate),
> None)
>
> try:
> sslStream.AuthenticateAsClient("secure.mydomain....")
> except <HERE?> :
>
> .... <HERE?> ...
> return
>
> Is there any link where I can read about it and found some examples?
>
> regards,
>
> gara
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
More information about the Users
mailing list