smtp4dev

How to create a X509 certificate that prevents “server mode SSL must use certificate with associated private key” exception?

江枫思渺然 提交于 2020-01-17 06:48:46
问题 I'm trying to create an X.509 certificate file that will work with the following code as found in the smtp4dev project: var certificate = new X509Certificate(Settings.Default.SSLCertificatePath); var clientCertificateRequired = false; var protocols = SslProtocols.Ssl2 | SslProtocols.Ssl3 | SslProtocols.Tls; var checkRevocation = false; var stream = new SslStream(stream); stream.AuthenticateAsServer(certificate, clientCertificateRequired, protocols, checkRevocation); Settings.Default