Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / January 2006

Tip: Looking for answers? Try searching our database.

SslStream object for IMAP

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
asnowfall@gmail.com - 27 Jan 2006 21:09 GMT
I am trying to connect & exchange data with IMAP server using SSL.
IMAP has command for logging in. Ex:
A100 LOGIN "abc" "agc"

I am using following code to do this...

m_pSocket.Connect(  m_pobjIMapServerIPAddress, 993);
m_pNetworkStream = new System.Net.Sockets.NetworkStream(    m_pSocket
);

System.Net.Security.RemoteCertificateValidationCallback
objRemoteCertificateValidationCallback =
                 new
System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
System.Net.Security.LocalCertificateSelectionCallback
objLocalCertificateSelectionCallback =
               new
System.Net.Security.LocalCertificateSelectionCallback(SelectLocalCertificate);

System.Net.Security.SslStream m_objSllStream = new
System.Net.Security.SslStream(m_pNetworkStream, true,
objRemoteCertificateValidationCallback,
objLocalCertificateSelectionCallback);

sCmd = "A123" + " LOGIN " + "username" + " " + "Password";
m_objSllStream.Write(System.Text.Encoding.ASCII.GetBytes(sCmd.ToCharArray()),
0,    sCmd.Length); /// I get crash here

My questions are..
I think, when the server sends security certificate to client, I should
get callback.
But none of my callbacks are getting called.
Pls let me know which objects to use & how to use.

Thanks
Ramesh
Dominick Baier [DevelopMentor] - 28 Jan 2006 00:36 GMT
Hi,

before you can exchange data you have to call SslStream.AuthenticateAsClient.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

> I am trying to connect & exchange data with IMAP server using SSL.
> IMAP has command for logging in. Ex:
[quoted text clipped - 31 lines]
> Thanks
> Ramesh
asnowfall@gmail.com - 30 Jan 2006 20:26 GMT
Thank you. AuthenticateAsClient() helped me progress a bit; still I
have a problem because password is NOT getting encrypted.
Here are the details...

if(m_objSllStream.IsEncrypted == true)
{
  m_objSllStream.Write("A100 LOGIN "abc" "agc"");
  //This is LOGIN command to IMAP with
  //clear text Username & Password.
  //LOGIN command fails with error "NO Clear text passwords
  //have been disabled for this protocol"
}

My doubts are..
Does not SSlStream::Write(data) encrypt the 'data'?
Am I supposed to do some more settings.

Thanks
Ramesh

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.