Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GPG commands
- This is a summary of GPG commands that I've found useful.
- Listing keys
- # List public keys:
- gpg --list-keys
- # List private keys:
- gpg --list-secret-keys
- Exporting keys
- USERNAME="User name"
- PUBKEY=public.key
- PRIKEY=private.key
- # Export public keys:
- gpg --export -a $USERNAME > $PUBKEY
- # Export private key:
- gpg --export-secret-key -a $USERNAME > $PRIKEY
- Importing keys
- USERNAME="User name"
- PUBKEY=public.key
- PRIKEY=private.key
- FINGERPRINT=fingerprint.txt
- # Importing public key:
- gpg --import $PUBKEY
- # Importing private key:
- gpg --allow-secret-key-import --import $PRIKEY
- # Generate the fingerprint:
- gpg --fingerprint > $FINGERPRINT
- Encrypting and decrypting
- FILEIN=file.txt
- FILEOUT=$FILEIN.gpg
- # Encrypt a file (symmetric cipher using a passphrase):
- gpg -c $FILEIN
- # Decrypt a file:
- gpg $FILEOUT
- Encrypting and decrypting (using openssl)
- DIRECTORYIN=directory
- FILEIN=file.txt
- FILEOUT=directory.tar.gz.aes
- FILEIN=directory.tar.gz.aes
- # Encrypt a zipped directory using ssl
- tar -zcf - $DIRECTORYIN | openssl aes-256-cbc -salt -out $FILEOUT
- # Decrypt a zipped directory using ssl
- openssl aes-256-cbc -d -salt -in $FILEIN | tar -xz -f -
- # Generate password
- gpg --gen-random 2 16 | base64
- Links
- http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement