News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
SecureSocket trouble  
by Mone [onlymetal83 at hotmail dot com]
posted on 2003/10/02

Hi
I've a problem with the method SecuritySocket.Send()
I'm writing a proxy to make some control on the page comes from a serverHTTP to the browser.
When i send the request to the server the method sometimes sends correctly the request, but other times throws exception with this messages:
-The Certificate message is invalid (if i try to re-send the request that create this error, the send method work correctly)
-The other side has sent a failure alert.
-And other errors i can't mind at this moment...
or worst of them, it don't throws anything and the program rust in peace.
This is a part of the code. (the method "Segna" writes on file the string we parse it)


***************************************************************************************************


SecureProtocol sp = SecureProtocol.Ssl3;
SecurityOptions options = new SecurityOptions(sp);
options.Certificate = null;
options.Entity = ConnectionEnd.Client;
options.CommonName = Host;
options.VerificationType = CredentialVerification.Manual;
options.Verifier = new CertVerifyEventHandler(OnVerify);
options.Flags = SecurityFlags.Default;
options.AllowedAlgorithms = SslAlgorithms.SECURE_CIPHERS;
MySecureSocket = new SecureSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp,options);
MySecureSocket.Connect(new IPEndPoint(Dns.Resolve(Host).AddressList[0], Port));

[cut]

int lBuffer = request.Length;
bRequest = new Byte[lBuffer];
int n = ASCIIEncoding.ASCII.GetBytes(request,0,request.Length,bRequest,0);
SP.Segna("\nReady to send\n------------------\n"+request+"------------------\n\n");
MySecureSocket.Send(bRequest);
SP.Segna("request sent");

***************************************************************************************************

Someone could help me?
Thnx

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2003/10/02

Could you give me something more to work with? [stack traces of the exceptions, for instance]

by Mone [onlymetal83 at hotmail dot com]
posted on 2003/10/03

Here 2 of the Stack traces of the possible errors (if i try to re-send the request the problem often disappear)
-----------------------------------------
1-"The Certificate message is invalid."
at Org.Mentalis.Security.Ssl.SecureSocket.EndSend(IAsyncResult asyncResult)
at Org.Mentalis.Security.Ssl.SecureSocket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Org.Mentalis.Security.Ssl.SecureSocket.Send(Byte[] buffer)

2-"Cannot access a disposed object named "Org.Mentalis.Security.Ssl.Shared.SocketController". Object name: "Org.Mentalis.Security.Ssl.Shared.SocketController"."
at Org.Mentalis.Security.Ssl.Shared.SocketController.BeginSend(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at Org.Mentalis.Security.Ssl.SecureSocket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at Org.Mentalis.Security.Ssl.SecureSocket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Org.Mentalis.Security.Ssl.SecureSocket.Send(Byte[] buffer)
-----------------------------------------
No other errors comes today, when i'll receive news i will sign the traces in this forum.
Thnx for the time you lose for this problem
Goodbye.

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2003/10/11

We've released a new version of the library [v1.0.13.689] that fixes a bug in the certificate processing code. We're fairly sure that this new release will fix the problem you're seeing. Can you download the new version and make sure the problem is gone? You can find the new library at http://www.mentalis.org/soft/projects/seclib/download.qpx

by Mone [Mone at tpatpc dot it]
posted on 2003/10/14

i've tried for few minutes the new library. It seems that the send function never stops, that's cute! Thank You.
But the exception go on to came out, what i can't mind is why the same request can have an ivalid certificate error in a first time and be completely correct in another time... mah!

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.