I've been given a certificate, key, and chain file (.crt, .key, and .pem) that I'm supposed to use to connect to a server. I've tried using openssl to create a .pfx file and used it with a TcpClient / SslStream / authenticate as client. It didn't work. What I understand now is that if the server uses openssl, the client must also (or painfully learn how openssl does its thing and write a lot of code). I've included the available openssl C# wrapper in a project but have no clue how to connect to the server using it. The openssl command line that works is...
openssl s_client -key provided.key -cert provided.crt -CAfile providedChain.pem -connect 127.0.0.1:12345
This statement works but how do I use the wrapper to do the same thing in C#?
What I have tried:
I've tried the standard TcpClient and in the connection callback, created the SslStream and attempted to authenticate as client. The call takes a certificate but from what I understand, it is one file that contains certificate information as well as the key. I've used openssl to combine the two but that didn't work. The server kicks me out because the initial handshake doesn't event work (don't get to the authentication part).