>_ IzzyLab

Hands-on task

This task is step 13 of the course “TLS and certificates”

Sign a file with a key

medium~5 min

There's a private key /root/sign.key and a public one /root/sign.pub. Sign the file /root/msg.txt with the private key (SHA-256), saving the signature to /root/msg.sig, so that it can be verified with the public key.

What you'll practise:
  • digital signature
  • openssl dgst
  • sha-256
  • private key
  • authenticity

Topic breakdown

A digital signature differs from a plain checksum in that it confirms not only integrity but also authorship: the file's hash is encrypted with the private key, and the verifier unwraps the signature with the public key and compares it with the hash computed independently. Signing is always done with the private key, verification with the public one; mix up the sides and the verification fails. In openssl dgst, creating a signature and verifying it are different modes of the same subcommand, and the signature itself is binary bytes, not text.

What's checked

  1. Signature verifies with the public key

What it looks like