Connect with Expertise | Find Experts, Get Answers, Share Insights

C# SSL certificate

 
Join Date: Sep 2008
Posts: 30
#1: May 22 '09
Hi all,

I am trying to establish a ssl socket using C#. I am fresh on this area and just trying to run the sample code on the msdn: http://msdn.microsoft.com/en-us/libr...sslstream.aspx.

First, i create my certificate, i got MyKey.cer, MyKey.pvk, MyKey.pfx, I use MyKey.cer to run the server in commond like:
Expand|Select|Wrap|Line Numbers
  1. sslserver.exe MyKey.cer
, server runs successfully. Then I run the client like
Expand|Select|Wrap|Line Numbers
  1. sslclient.exe localhost MyKey.pfx 
, connection wil be built, but throw a System.NotSupportedException on the server side.

I am not sure that I should use
Expand|Select|Wrap|Line Numbers
  1. sslclient.exe localhost MyKey.pfx 
to run the sslclient, I mean, probably I should use something to replace MyKey.pfx as the second parameter.

I also generate a pair of *.pem files to run my ssl program, there is the same problem that my server side can run but client side sucks, throwing the same exception.

Any suggestion on that? (Would be more helpful if someone can tell me how to use *.pem file to run the ssl program here)
Thank you and many thanks for the reading.

 
Join Date: Sep 2008
Posts: 30
#2: May 22 '09

re: C# SSL certificate


Some more details on the question:
The exception also says my certificate is not associated with a private key, but I use "-pe" in my certificate generation command:
Expand|Select|Wrap|Line Numbers
  1. makecert -r -pe -n "CN=DS" -b 01/01/2008 -e 01/01/2010 -sr localMachine DSKey.cer
, it still doesn't work
 
Join Date: Aug 2009
Posts: 5
#3: Aug 9 '09

re: C# SSL certificate


Probably the problem is that your certificate has not the private key inside.
Try to use standard X509 certificate.
You can generate it on-line at this link

http://www.we-coffee.com/x509builder.aspx
Reply

Tags
c# ssl