TimK
TimK

Reputation: 7747

How do I set up a test cert for an SSL connection in .NET?

I would like to create an SSL connection for generic TCP communication. I think I figured out how to do it in the code, using the info here: http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx What I'm having trouble with is creating a cert so I can test this out. I tried makecert.exe testCert, and that created a cert, but apparently it doesn't have a private key associated with it. So what I'm looking for is the simplest procedure to create a cert and get the connection to work.

Upvotes: 5

Views: 442

Answers (3)

sipsorcery
sipsorcery

Reputation: 30714

For anybody else attempting this the pkcs12 certificate created as detailed here openssl question and using the X509Certificate2.CreateFromCertFile method gets past the private key problem. Note I used openssl with cygwin on Windows.

Upvotes: 0

Bill the Lizard
Bill the Lizard

Reputation: 405985

I haven't found a simple way to do this yet, but I found this site helpful a few months back.

O'Reilly also published a book called Network Security Hacks (available on Safari) that has a section starting at Hack #45 on creating your own certificate authority.

Upvotes: 2

ScArcher2
ScArcher2

Reputation: 87237

I asked a similar question referencing apache, but someone linked to a microsoft howto on the response. It may be helpful.

Here

Upvotes: 1

Related Questions