3

I'm trying to write a simple DTLS client in C# using Bouncy Castle.

I've found only one example use of the API I think I need in the library's own tests: crypto/test/src/crypto/tls/test/DtlsProtocolTest.cs. The network layer in the test is mocked by MockDatagramAssociation, which contains a MockDatagramTransport. This transport class implements DatagramTransport, which is the parameter type required by DtlsClientProtocol.Connect(). Finally, DtlsTransport returned by .Connect() exposes the Send()/Receive() API familiar from plain UDP.

The tricky thing is that I can't find any other implementation of DatagramTransport other than the mock. It's even more strange, as the Java Bouncy Castle does indeed have a UDPTransport implementing DatagramTransport.

I admit .Net and C# are not among my strong skills, therefore I might be missing something that's obvious to anyone knowing the ecosystem better.

Where do I find a DatagramTransport implementation for UDP? Is the library user expected to provide a project-specific implementation on their own? Is there any external library implementing it or is it a part of .Net itself?

erszcz
  • 1,630
  • 10
  • 16
  • 1
    `DtlsRecordLayer` implements `DatagramTransport`. But I think the answer is yes, you provide your own implementation of DatagramTransport for the transport. It seems to be trivial to implement for UDP. – President James K. Polk Aug 21 '17 at 17:18

0 Answers0