469,336 Members | 5,286 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

C# SSL certificate

30
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.
May 22 '09 #1
2 10416
anklos
30
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
May 22 '09 #2
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
Aug 9 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Matt Frame | last post: by
reply views Thread by Will | last post: by
1 post views Thread by Nelson R. | last post: by
6 posts views Thread by JIM.H. | last post: by
4 posts views Thread by =?Utf-8?B?SGVyYg==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.