GPG encryption and decryption and signature

Source: Internet
Author: User
Tags gpg gpg encryption

In Ruan one peak great God's blog (http://www.ruanyifeng.com/blog/2013/07/gpg.html) goes to school gpg. Here after the practice of the record, in fact, mainly changed the layout, convenient for personal use.

The key file is saved under ~/.gunpg/

Encryption: (Requires the system to have each other's public key)

GPG--recipient [user ID]--output sec.txt--encrypt source.txt

Decryption: (determines that the encrypted file is encrypted with its own public key)

GPG Sec.txt

Signature:

Signature only not encrypted:

Signature Instructions The resulting signature file Notes Validation Directives
GPG--sign Source.txt Source.txt.gpg Binary form storage, including file content; GPG--verify SOURCE.TXT.GPG
GPG--clearsign Source.txt Source.txt.asc Text Form Storage; GPG--verify SOURCE.TXT.ASC
GPG--detach-sign Source.txt Source.txt.sig binary form storage; does not contain the content of the file; if the filename is not standard, it should be specified; GPG--verify Source.txt.sig
GPG--armor--detach-sign Source.txt Source.txt.asc Text storage, no file content, if the file name is not standard when verifying; GPG--verify SOURCE.TXT.ASC

Signature and encryption: (Decrypt the file when it is received and then obtain the decryption file and verify the signature)

GPG--local-user [Sender ID]--recipient [recipient ID]--armor--sign--encrypt source.txt
Verify:

GPG--verify SOURCE.TXT.ASC Source.txt


Lists the system's existing keys

GPG--list-keys
Delete a key

GPG--delete-key [user ID]

Find someone else's public key on a public key server (no guarantee that the public key is reliable and need to be validated by another mechanism after downloading)

GPG--keyserver hkp://subkeys.pgp.net--search-keys [user ID]

Import Key

GPG--import [key file]

Export a public/private key and display it in ASCII

GPG--armor--output public-key.txt--export [user ID] gpg--armor--output private-key.txt



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.