Signing and Verifying a Message

  1. Create a sample text file with any content inside it.

›_ Console

echo "Sample message" > message.txt
  1. Sign the message file.

›_ Console

openssl pkeyutl -sign -in message.txt  -inkey "pkcs11:token=<token_label>;object=<key_label>" -out signature.sig

The result will be the signature of the message in binary format.

  1. Verify the signature of the message.

›_ Console

openssl pkeyutl -verify -in message.txt -certin -inkey mldsa.cert -sigfile signature.sig
Signature Verified Successfully

The best approach to sign a message would be to use the openssl cms command but, unfortunately, this command is still not compatible with PQC algorithms like MLDSA.