aiocoap.transports.tinydtls_server module

This module implements a MessageInterface that serves coaps:// using a wrapped tinydtls library.

Bear in mind that the aiocoap CoAPS support is highly experimental and incomplete.

Unlike other transports this is not enabled automatically in general, as it is limited to servers bound to a single address for implementation reasons. (Basically, because it is built on the simplesocketserver rather than the udp6 server – that can change in future, though). Until either the implementation is changed or binding arguments are (allowing different transports to bind to per-transport addresses or ports), a DTLS server will only be enabled if the AIOCOAP_DTLSSERVER_ENABLED environment variable is set, or tinydtls_server is listed explicitly in AIOCOAP_SERVER_TRANSPORT.

class aiocoap.transports.tinydtls_server.GoingThroughMessageDecryption(plaintext_interface: GenericMessageInterface)

Bases: object

Warapper around GenericMessageInterface that puts incoming data through the DTLS context stored with the address

class aiocoap.transports.tinydtls_server.SecurityStore(server_credentials)

Bases: object

Wrapper around a CredentialsMap that makes it accessible to the dict-like object DTLSSocket expects.

Not only does this convert interfaces, it also adds a back channel: As DTLSSocket wouldn’t otherwise report who authenticated, this is tracking access and storing the claims associated with the used key for later use.

Therefore, SecurityStore objects are created per connection and not per security store.

keys()
class aiocoap.transports.tinydtls_server.MessageInterfaceTinyDTLSServer(mman: MessageManager, log, loop)

Bases: MessageInterfaceSimpleServer

async classmethod create_server(bind, ctx: MessageManager, log, loop, server_credentials)
async shutdown()

Deactivate the complete transport, usually irrevertably. When the coroutine returns, the object must have made sure that it can be destructed by means of ref-counting or a garbage collector run.