gpg


gpg.exe is to encrypt and sign message, not compatible with ssh.exe and openssl.exe
gpg-agent is the server.

key generation:
$ gpg –gen-key this create both private and public key
output: userID:”Rio Wing <RioCnC@gmail.com> KeyID: key 7A4BC790635E0469
view keys:
$ gpg –list-keys –keyid-format LONG
output public keys, like rsa3072/7A4BC790635E0469 is keyID, /home/rio/.gnupg/pubring.kbx
$ gpg –list-secret-keys
output private key, secring.gpg holds private keys
export keys
$ gpg –export -a “Rio Wing” > RioWingGpg.pub
PEM encoded like: BEGIN PGP PUBLIC KEY BLOCK
$ gpg –export-secret-keys -a “Rio Wing” > RioWingGpg.priv
PEM encoded like: BEGIN PGP PRIVATE KEY BLOCK
upload public key
$ gpg –keyserver hkps://pgp.mit.edu –send-keys 7A4BC790635E0469
verify the key is there by going to https://pgp.mit.edu
Search riocncn and web returns: 3072R/635E0469 2020-02-14 Rio Wing
use the keys
encrypt message:
$ echo riowingwxc |gpg –armor –encrypt –recipient RioCnC@gmail.com
copy output to MsgEnc.txt, which is PEM encoded like: BEGIN PGP MESSAGE
decrypt:
$ gpg –output MsgDec.txt –no-tty MsgEnc.txt
sign:
$ gpg –clearsign MsgDec.txt
output MsgDec.txt.asc PEM encoded like BEGIN PGP SIGNED MESSAGE
verify signature:
$ gpg –verify MsgDec.txt.asc
output: Good signature from Rio Wing

Previous Post
Next Post
Comments are closed.
%d bloggers like this: