Skip to main content

Example: Crypto

Product: CODESYS Development System

The example shows which cryptographic functions are available in CODESYS and how to use them.

_example_img_crypto.png

Description

Cryptographic techniques are important in order to achieve the following objectives when processing data:

  • Integrity of data guarantees that the recipient can be sure that changes to the data do not go unnoticed.

  • Authenticity means that the recipient can be reasonably sure that a data set has actually been created by its alleged author.

  • Confidentiality aims to prevent unauthorized access to the relevant data under all circumstances.

In CODESYS, the CmpCrypto.library and CmpX509Cert.library libraries are provided for this purpose. The CryptoDemo.project sample project shows how to use both libraries for different use cases.

Additional information

. This example covers the following topics:
  • Random number generation

  • Hashing

  • Hash-based message authentication code (HMAC)

  • Encryption

    • Symmetric encryption

      • Example: AES-256 in CBC mode

      • Combination of signing and encryption

    • Asymmetric encryption

      • Key pair generation

      • Access to certificates

      • Encryption

      • Decryption

      • Signing data

      • Validation

  • Pay per use

The functionality of the CryptoDemo.project sample project is described in the document CryptoDemo.pdf. You can find the document in the directory %USERPROFILE%\CODESYS Examples\Crypto Example.

The CryptoCertDemo.project project shows how to use certificates to encrypt a message by a sender and decrypt the message by a recipient.

System requirements and restrictions

Programming system

CODESYS Development System (version 3.5.16.0 or higher)

Runtime system

CODESYS Control Win (version 3.5.16.0)

Add-on components

-

Note

_example_icon.png DOWNLOAD Project