• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Protocols - MQTT I/O
  • TLS-PSK Key Setup
  • 5.0.0

TLS Certificate Setup MQTT Tutorials

TLS-PSK Key Setup

TLS-PSK Key Setup

PSK (Pre-Shared Keys)

If just transmission encryption is needed, symmetrical key encryption with PSK (Pre-Shared Key) is somewhat easier to set up than TLS certificate setup.

For TLS-PSK, only one Pre-Shared Key (some random hexadecimal number) needs to be generated and set up for use both on broker and client side.

Generating PSK Key

Any hexadecimal string (i.e. string that consist only of numbers 0–9, and characters A, B, C, D, E, F) can be used for PSK key.

Strong and highly random (32 byte = 256 bit) key can be generated with OpenSSL command like this

> openssl rand -hex 32

Setting Up PSK Key Usage

After PSK key is generated, broker and client has to be set up to use it.

In the MQTTClient configuration, choose a unique client id (i.e. any string, like "Client") and register it with PSK key in MQTTClient configuration properties (properties TLSPSKIdentity and TLSPSKKey).

On broker side, create a text file containing all the PSK files different clients are using. The file has to be structured line-by line, each line must be in the format

client-id:psk-key

Set up MQTTBroker to use the PSK file:

  • Put the PSK file (named for example "keys.psk") into the CDP application folder
  • add it to application project in CDP Studio right-clicking in Code mode on application name and choosing "Add existing files...".
  • configure MQTTBroker to use the PSK file (property TLSKeyFile).

TLS Certificate Setup MQTT Tutorials

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top