Difference between revisions of "Linux: gpg"

From RHS Wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
=== Encryption ===
 
=== Encryption ===
 
  gpg -c file.txt
 
  gpg -c file.txt
we will be prompt for a password.
+
we will be prompt for a password.<br />
 +
Or:
 +
gpg -ca file.txt
 +
If we want an ascii output
 
=== Decryption ===
 
=== Decryption ===
 
  gpg -d file.txt
 
  gpg -d file.txt

Revision as of 18:08, 17 May 2015

GnuPG

Simetric Cipher

Encryption

gpg -c file.txt

we will be prompt for a password.
Or:

gpg -ca file.txt

If we want an ascii output

Decryption

gpg -d file.txt

we will be prompt for a password.

Asimetric Cipher

Generate keys

gpg --gen-key

Export public key

To file

gpg --output <destination_file.gpg> --export <public_key_ID>

To server

gpg --send-keys --keyserver pgp.mit.edu 18384645

Import public keys

From file

gpg --import <publickeyfile.gpg>

From server

gpg --keyserver pgp.mit.edu --recv-keys 18384645

Encrypt with a public key

gpg --encrypt --recipient <key ID> <file>

Decrypt with private key

comando gpg -d <encrypted_file>