For the complete documentation index, see llms.txt. This page is also available as Markdown.

DTLS Device Client Certificates

This guide walks through generating a Custom Device Certificate Authority (CA) and individual Device Client Certificates for your devices to achieve mutual DTLS authentication.

Prerequisites

  • openssl 3.x (Verify using openssl version)

  • A dedicated working directory for your PKI files (e.g., ~/coap-pki/)

Constraints & Requirements

  • Private Key Format: Private keys must be in PKCS#8 format (-----BEGIN PRIVATE KEY-----). OpenSSL generates PKCS#1 by default for RSA -an extra conversion step is required.

  • Device Identity: The device client certificate's Common Name (CN) is used as the device identity identifier in akenza. Set it to the exact device identifier (e.g. serial number) you want to authenticate. It must match the deviceId used to provision a device in akenza.

  • Cipher Suites: Both RSA 2048 and ECDSA P-256 are supported. ECDSA produces significantly smaller certificates and is highly recommended for constrained IoT devices.

1. Create the Device Certificate Authority (CA)

Submit the Device CA certificate file to akenza and also include the akenza device connector id(s) that are in scope for this CA.

mkdir -p ~/coap-pki && cd ~/coap-pki

# CA private key (PKCS#8 unencrypted)
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out ca.key

# Self-signed CA certificate (10-year validity)
openssl req -new -x509 -key ca.key -sha256 -days 3650 \
  -subj "/CN=akenza CoAP CA" \
  -out ca.crt

2. Create a Device Client Certificate

The CN becomes the device identifier in akenza. Repeat this block for each device.

Option B - RSA 2048

1. Create the Device Certificate Authority (CA)

Submit the Device CA certificate file to akenza and also include the akenza device connector id(s) that are in scope for this CA.

2. Create a Device Client Certificate

Test the Connection

You can verify the connection utilizing coap-client (from the libcoap package):

  • Success Response: Returns a payload structure like {"message":"ok","id":"<uuid>"}.

  • Handshake Failure: If the certificate validation or handshake fails, the client will timeout without a response, as the gateway silently drops unauthorized requests at the TLS layer.

Utility Tools

Bulk Device Client Certificate Generation

Save this automation script as gen-certs.sh to quickly issue device credentials:

Usage: ./gen-certs.sh dev-abc123 dev-def456 dev-ghi789

Inspection Commands

Last updated

Was this helpful?