Project

tinydtls

0.0
No commit activity in last 3 years
No release in over 3 years
tinydtls provides a DTLS implementation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.11

Runtime

~> 1.9
 Project Readme

tinydtls

Ruby wrapper for tinydtls.

Status

This rubygem is far from finished and not stable at all. It currently also requires an unreleased version of the tinydtls library.

Installing

The gem can easily be installed from rubygems.org using:

$ gem install tinydtls

Before the gem can actually be used tinydtls needs to be build from the git repository using the following commands:

$ git clone https://git.eclipse.org/r/tinydtls/org.eclipse.tinydtls
$ cd org.eclipse.tinydtls
$ git checkout develop
$ autoconf && autoheader && ./configure
$ make && make install

To verify that the gem actually works as expected run the test suite. Instructions for doing so are provided in the next section.

Tests

A basic test suite is also available which can be run using:

$ ruby -Ilib:test test/test.rb

Documentation

The high-level API to interact with tinydtls provided by this gem is the TinyDTLS::UDPSocket class. This class currently extends the standard ruby UDPSocket class and the UDPSocket#recvfrom and UDPSocket#send methods should work as expected.

However, before being able to use the TinyDTLS::UDPSocket a pre-shared key needs to be configured. Thus the code for creating a socket and receiving a packet from it looks as follows:

require "tinydtls"

s = TinyDTLS::UDPSocket.new
s.add_client("client identity", "very secret key")

s.bind("localhost", 1337)
p s.recvfrom(1000)

A simple DTLS client and DTLS echo server is available in examples/.