I want to communicate between Server and Client using sockets using bouncy castle TLS library. I went through many documentation(which was insufficient for me) but I did not get any idea how to do this,
I am using BouncyCastle v1.7.48(runtime version=v2.0.50727) binary, and I have found these info,
I have to use, Org.BouncyCastle.Crypto.Tls
namespace and TlsProtocolHandler
class.
To achieve TLS communication,
- what API I should use in server side?
what API I should use in client side?
System.IO.Stream inputStream, outputStream; TlsProtocolHandler tls = new TlsProtocolHandler(inputStream, outputStream);
What are the parameters
inputStream
andoutputStream
?
public virtual void Connect(TlsClient tlsClient);
where, TlsClient
is an interface, and that contains many interfaces inside.
4. How to use the above API? I have to declare new classes and implement methods inside that to all?
Please help me with this Bouncy Castle.
EDIT 1:
I created one class which inherits from an abstract class called DefaultTlsClient
.
Then I could create an instance of my class and pass it for interface reference.
So I could send the parameter like this. tls.Connect(tlsClient);
I am not initializing any parameters except I mentioned above. (Sockets are connected before these operation on 2055) But I am not sure handshake is complete or not. My program will go to reading state.