Signing, Encryption, Decryption and Verification with GnuPG

  1. Create a sample message file.

# echo "Welcome to Utimaco" > message.txt 
  1. Sign the file using the key name.

# gpg --output message.txt.signed --sign --default-key test@utimaco.com message.txt

Provide slot PIN when prompted. This will generate a signed file message.txt.signed.

image-20260520-071831.png

Signing the file

  1. Verify the file message.txt.signed.

# gpg --verify message.txt.signed 
image-20260520-071855.png

Verifying the signed file

  1. Encrypt the file. Provide recipient user ID when prompted.

# gpg --output message.txt.enc --encrypt  message.txt 
image-20260520-071928.png

Encrypting the file

This will generate an encrypted file message.txt.enc.

  1. Decrypt the encrypted file.

# gpg --output message.txt.dec --decrypt  message.txt.enc 

Provide slot PIN when prompted. This will generate a decrypted file message.txt.dec.

image-20260520-072138.png


Decrypting the file

  1. Verify the content of the original file.

# cat message.txt.dec 
image-20260520-072226.png


Original content of the file