Archived Forum Post

Index of archived forum posts


Duplicate OpenSSL Connection Command In C#

Aug 23 '17 at 09:02

I've been given a key file (.key), a certificate (.crt), and a chain file (.pem) along with a server application I'm supposed to connect to. The following openssl command works...

openssl s_client -key provided.key -cert provided.crt -CAfile provided.pem -connect

I'm asked for a pass phrase for the key and then I connect. I'm trying to duplicate this in a C# application. I've used TcpClient with an SslStream but that requires a .pfx file. I've created the file using openssl but that didn't work (used the key and certificate file).

Is there a way to simulate the openssl s_client command using C#? And can I register a callback for the entry of a pass phrase?