Re: SSLStream

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Dubravko Sever" <Dubravko.SeverNOSPAM@xxxxxx> wrote in message
news:f1f3v0$ju5$1@xxxxxxxxxxxxxxxxxx
Hi,

I have problem with SSLStream. I'm using it with p12 certificate and it
works well when I running my code as console application (manully
called).
But problem starts when I tryint run it as windows service (localsystem)
and a got exception: "The server mode SSL must use a certificate with the
associated private key".
If anyone has ideas, please ..


Here is my code :
private void ProcessClient(TcpClient m_clinet) {

SslStream stream = new SslStream(m_clinet.GetStream(), false);

try

{


stream.AuthenticateAsServer(new
X509Certificate("hostcert.p12",""),false,System.Security.Authentication.SslProtocols.Tls
,true );


try {

UnicodeEncoding encoder = new UnicodeEncoding();

// GPGEncrypt encrype = new GPGEncrypt(log);

byte[] buffer = encoder.GetBytes("Some text");

stream.Write(buffer);

stream.Close();

m_clinet.Close();


}

catch (Exception eror){log.WriteLineLog(eror.Message); }


}

catch (AuthenticationException exc) { log.WriteLineLog(exc.Message); }


}



Thanks,

Solved,
Problem was with windows service account.



.



Relevant Pages

  • SSLStream
    ... I have problem with SSLStream. ... I'm using it with p12 certificate and it ... a got exception: "The server mode SSL must use a certificate with the ... private void ProcessClient{ ...
    (microsoft.public.dotnet.languages.csharp)
  • SslStream.BeginAuthenticateAsServer gives exception
    ... Does anyone know why I get an exception when I calll ... When I use AuthenticateAsServer, ... myself, so it must be the SslStream that closes the stream, assuming ... this.AuthenticateAsServerCallback, secureStream); ...
    (microsoft.public.dotnet.security)
  • .NET 2.0 and SslStream authentication
    ... Could someone point me a tutorial on using SslStream? ... (ClientAuthenticate or ServerAuthenticate), I get an exception ... Invoke one of Authenticate overload ... exception (Win32Exception: ...
    (microsoft.public.dotnet.security)
  • .NET 2.0 and SslStream authentication
    ... Could someone point me a tutorial on using SslStream? ... (ClientAuthenticate or ServerAuthenticate), I get an exception ... Invoke one of Authenticate overload ... exception (Win32Exception: ...
    (microsoft.public.dotnet.security)