Step 1:
Generate a GnuPG key pair.
gpg --gen-keys
There are a number of options that can be specified when generating a key pair. For this example, the following values will be used:
Type of key: RSA and RSA (default) Keysize: 4096 Valid for: Never expires
Real name: Test User Email address: test@user.com Comment: A test user.
Verify the key pair has been generated with:
gpg --list-keys
Step 2:
Send your public key, or make your public key available, to the party you want to send you digitally signed file to. It is a good idea to also send the fingerprint of the public key through another means of communication, for example, over the phone.
To export the public key, execute:
gpg --armor --export "Test User"
To get the fingerprint of the public key, execute:
gpg --fingerprint "Test User"
Step 3:
Import the public key. Once the public key has been sent and verified, the receiver needs to import the public key.
gpg --import publickey.key
Step 4:
Encrypt and sign the file.
gpg --sign --symmetric --cipher-algo AES256 secret.txt
Step 5:
Decrypt the file. Decrypting the file will automatically verify the digital signature.
gpg -d secret.txt.gpg ...gpg: Good signature from "Test User (A test user.)"...
No comments:
Post a Comment