Cheers,
I have a *.crt with a CERTIFICATE section and a PRIVATE KEY section I load this certificate with
X509Certificate2 serverCertificate = X509Certificate2.CreateFromCertFile("Data\\certificate.crt");
Now I want to start a secure TcpListener, but get at
SslStream sslStream = new SslStream(client.GetStream(), false);
sslStream.AuthenticateAsServer(serverCertificate, clientCertificateRequired: true, checkCertificateRevocation: true);
the error "The server mode SSL must use a certificate with the associated private key"...
Whats the problem?
This answer is for C# .NET
For HTTPS calls, the example is provided on MSDN using TCP Listner and TCP Client.
When doing sslStream.AuthenticateAsServer(serverCertificate, ..) you should load a PFX file along with password, instead of CER file, then it will not require registration on client machine. if works please tell me i have problems after this :P
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.