Hi all,
I ported a open source implementation of the ed25519 algorithm into a AR library (to be precise, less ported then just used and built AS function block wrappers around
).
This algorithm is a digital signature scheme based on the Edwards-curve Digital Signature Algorithm (EdDSA) using Curve25519.
The library contains function blocks for:
- the possibility to sign and verify “memory content” (e.g. the content of a string or an array or a structure),
- or to sign and verify the content of a file - which is more or less the same procedure as a memory content, but needs additionally the file handling
- a helper function block for the file handling + helper functions to convert hex-ascii coded keys to binary and vice versa (as it’s needed by the core code)
To create the secret and public keys, AI created a small python script for me, which is also able to sign and verify a file (and is also included in the package below). I did not implement the key creation inside the PLC on purpose for security reasons!
When working with files, the files need to follow a strict layout where and how the checksum for verification is placed in the file (the Python script knows that layout).
If there’s the need that the verification checksum is not part of the file content but for example of a 2nd file, this is also possible but not directly encapsulated via the function blocks → in such a case, use the “memory content” function blocks together with the FileHandling helper (or your own file handling).
Please note: signing is not encrypting
The algorithm is able to verify if a content wasn’t changed by just needing the public key of the signer.
Please note: as implementations of such algorithms are computing-intensive and synchronous, it’s not intended for signing / verifying a high amount of content, I needed it for “just a few kilobytes”.
So it’s useful to check the integrity of small parameter files, recipes, and so on, but not for (very) hugh data.
As always, I published it in my Github repository, where additional information and documentation can be found.
Here’s the direct link to the ED25519 pack in the repo:
Have a nice weekend!