Download project

Crypto Example

"Crypto Example" shows which cryptographic functions are available in CODESYS and how to use them.

Product 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 any 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 libraries CmpCrypto.library and CmpX509Cert.library are provided for this purpose.
The sample project CryptoDemo.project demonstrates how to use both libraries for different use cases.

More 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 of data
      • Validation
  • Pay by use

The functionality of the sample project CryptoDemo.project is described in the document CryptoDemo.pdf.
The project CryptoCertDemo.project shows how a message can be encrypted by a sender and decrypted by a recipient using certificates.

System requirements and restrictions

System requirements and restrictions Info
Programming System CODESYS Development System Version or higher
Runtime System CODESYS Control Version
Required Accessories -

Screenshot thumbnail
Screenshot of Visualization