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
 
Error in the SecureSocket constructor  
by Steve [smcgrath12 at hotmail dot com]
posted on 2004/06/08

I have a cer file called "Test.cer". I am doing the following in my code..

Certificate mycer = null;
mycer = Certificate.CreateFromCerFile(@"Test.cer");

SecurityOptions sc = new SecurityOptions(SecureProtocol.Tls1,mycer,ConnectionEnd.Client);

m_Socket = new SecureSocket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp,sc);

....
....

Now, the error I am getting when I run the above console app is "If a certificate is specified, it must have a private key."

Any ideas will be appreciated.

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2004/06/14

Certificates are not always associated with a private key. Keep in mind that a certificate only says something about a public key.

CER files typically do not contain the private key that is associated with a certificate. Try using PFX files instead.

 

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