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
 
SSL POP3 client problem  
by Caerwent [caerwent at ifrance dot com]
posted on 2004/10/01

Hello,

I am trying to implement a POP3 client adapted from your SMTP sample.
I set
options.Protocol = SecureProtocol.Ssl3|SecureProtocol.Tls1;

The connection succeeds, I call Receive just after the connection, code looks about like this :

Connection.Connect(new IPEndPoint(Dns.Resolve(server).AddressList[0], int.Parse(port)));
string str = Receive();

the server certificate verification succeeds (ValidCertificate), but I get an Exception :

An error occurred while waiting for the hello message[An error occurs while comm
unicating with the remote host.
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at Org.Mentalis.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult a
r) in c:\csmail\popclient\seclib\security\ssl\shared\socketcontroller.cs:lin
e 105]
Org.Mentalis.Security.SecurityException: An error occurs while communicating wit
h the remote host.
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at Org.Mentalis.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult a
r) in c:\csmail\popclient\seclib\security\ssl\shared\socketcontroller.cs:lin
e 105 ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at Org.Mentalis.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult a
r) in c:\csmail\popclient\seclib\security\ssl\shared\socketcontroller.cs:lin
e 105
--- Fin de la trace de la pile d'exception interne ---
at Org.Mentalis.Security.Ssl.SecureSocket.EndReceive(IAsyncResult asyncResult
) in c:\CsMail\POPClient\SecLib\Security\Ssl\SecureSocket.cs:line 499
at Org.Mentalis.Security.Ssl.SecureSocket.Receive(Byte[] buffer, Int32 offset
, Int32 size, SocketFlags socketFlags) in c:\CsMail\POPClient\SecLib\Securit
y\Ssl\SecureSocket.cs:line 446
at Org.Mentalis.Security.Ssl.SecureSocket.Receive(Byte[] buffer) in c:\Cs
Mail\POPClient\SecLib\Security\Ssl\SecureSocket.cs:line 395
at Pop3Client.Receive() in c:\csmail\popclient\popclient.cs:line 147
at Pop3Client.Start() in c:\csmail\popclient\popclient.cs:line 68

I don't understand why the server would close the connection in the middle of the authentication without issuing an error code or anything ???

Could anybody help me, please ? Explanation ? Sample code ?


(version = 1.0.13.709)

by Caerwent
posted on 2004/10/04

Hello,

I think I have found what my first problem was, it seems as if I took to much time debugging so I suppose it was just a timeout... (?)

Now, I have an alert sent by the pop3s server which says "BadCertificate". I don't see what certificate it is talking about since as far as I know, I am not supposed to send a certificate and the one the server sends is alright (ValidCertificate)???

I feel completely lost, could any one help, please ?

I don't know if it can help but here is the stack trace:

An error occurred [An error occurs while communicating with the remote host.
Org.Mentalis.Security.Ssl.Shared.SslException: The other side has sent a failure
alert : BadCertificate
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessAlert(RecordMessage
message) in c:\csmail\popclient\seclib\security\ssl\shared\handshakelayer.c
s:line 252
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessMessages(RecordMess
age message) in c:\csmail\popclient\seclib\security\ssl\shared\handshakelaye
r.cs:line 142
at Org.Mentalis.Security.Ssl.Shared.RecordLayer.ProcessBytes(Byte[] buffer, I
nt32 offset, Int32 size) in c:\csmail\popclient\seclib\security\ssl\shared\r
ecordlayer.cs:line 374
at Org.Mentalis.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult a
r) in c:\csmail\popclient\seclib\security\ssl\shared\socketcontroller.cs:lin
e 88]
Org.Mentalis.Security.SecurityException: An error occurs while communicating wit
h the remote host.
Org.Mentalis.Security.Ssl.Shared.SslException: The other side has sent a failure
alert : BadCertificate
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessAlert(RecordMessage
message) in c:\csmail\popclient\seclib\security\ssl\shared\handshakelayer.c
s:line 252
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessMessages(RecordMess
age message) in c:\csmail\popclient\seclib\security\ssl\shared\handshakelaye
r.cs:line 142
at Org.Mentalis.Security.Ssl.Shared.RecordLayer.ProcessBytes(Byte[] buffer, I
nt32 offset, Int32 size) in c:\csmail\popclient\seclib\security\ssl\shared\r
ecordlayer.cs:line 374
at Org.Mentalis.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult a
r) in c:\csmail\popclient\seclib\security\ssl\shared\socketcontroller.cs:lin
e 88 ---> Org.Mentalis.Security.Ssl.Shared.SslException: The other side has sent
a failure alert : BadCertificate
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessAlert(RecordMessage
message) in c:\csmail\popclient\seclib\security\ssl\shared\handshakelayer.c
s:line 252
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessMessages(RecordMess
age message) in c:\csmail\popclient\seclib\security\ssl\shared\handshakelaye
r.cs:line 142
at Org.Mentalis.Security.Ssl.Shared.RecordLayer.ProcessBytes(Byte[] buffer, I
nt32 offset, Int32 size) in c:\csmail\popclient\seclib\security\ssl\shared\r
ecordlayer.cs:line 374
at Org.Mentalis.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult a
r) in c:\csmail\popclient\seclib\security\ssl\shared\socketcontroller.cs:lin
e 88
--- Fin de la trace de la pile d'exception interne ---
at Org.Mentalis.Security.Ssl.SecureSocket.EndReceive(IAsyncResult asyncResult
) in c:\csmail\popclient\seclib\security\ssl\securesocket.cs:line 499
at Org.Mentalis.Security.Ssl.SecureSocket.Receive(Byte[] buffer, Int32 offset
, Int32 size, SocketFlags socketFlags) in c:\csmail\popclient\seclib\securit
y\ssl\securesocket.cs:line 446
at Org.Mentalis.Security.Ssl.SecureSocket.Receive(Byte[] buffer) in c:\cs
mail\popclient\seclib\security\ssl\securesocket.cs:line 395
at Pop3Client.Receive() in c:\csmail\popclient\popclient.cs:line 131
at Pop3Client.Start() in c:\csmail\popclient\popclient.cs:line 59

 

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