D
Dubravko Sever
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,
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,