sslstream and certificates

From: Jakob Nielsen (a_at_b.c)
Date: 05/26/05


Date: Thu, 26 May 2005 16:23:30 +0200

Using net 2.0

I try creating a sslStream from a regular networkstream as folows

Socket clientSocket = serverSocket.EndAccept(result);
clientSocket.Blocking = true;
Stream clientStream = new NetworkStream(clientSocket);
SslStream sslStream = new SslStream(clientStream);
X509Certificate cert =
X509Certificate.CreateFromCertFile(@"c:\mycertificate.crt");
sslStream.AuthenticateAsServer(cert);

The call to AuthenticateAsServer fails with "The server mode SSL must use a
certificate with the associated private key"

What exactly should I put into that message? It needs another kind of
certificate with the private key embedded?
I do have a keyfile on the side with one of my certificates, but I can not
specify it anywhere.
Another certificate , I am testing with, is from rapidSSL a CA so I assume
it should be "right".

Has someone else tried setting up a sslStream as server?

Should i somehow put my private key into my certificate? I read somewhere
that you could concatenate the two files, but that didnt resolve the
problem.



Relevant Pages

  • sslstream and certificates
    ... I try creating a sslStream from a regular networkstream as folows ... certificate with the associated private key" ... Has someone else tried setting up a sslStream as server? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: sslstream and certificates
    ... > The call to AuthenticateAsServer fails with "The server mode SSL must ... > use a certificate with the associated private key" ... > Has someone else tried setting up a sslStream as server? ...
    (microsoft.public.dotnet.security)
  • Re: Can SslStream be set to ignore invalid certificates?
    ... the certificate validation callback allows you to do your own checking. ... is much more SSL functionality in .NET 2.0, such as the SslStream, I ... If authentication succeeds, everything in the ... In IE, for instance, if you run across an "invalid" certificate, you ...
    (microsoft.public.dotnet.security)