How to use the open-source encryption tool GPG

Source: Internet
Author: User
Tags gnupg

Comments: GPG and PGP are two types of encryption software. You can use the public key to securely spread your own files on the Internet. I used GPG a few days ago, which was very convenient and encountered some problems. Therefore, I wrote my usage in order to avoid detours for the first time using GPG. Let's talk about how to obtain GPG. GPG is an open source software and is completely free of charge. You can use GPG and PGP as two types of encryption software, you can use the public key to securely spread your own files on the Internet. I used GPG a few days ago, which was very convenient and encountered some problems. Therefore, I wrote my usage in order to avoid detours for the first time using GPG.
Let's talk about how to obtain GPG. GPG is an open source software and is completely free of charge. You can download it at www.gnupg.org. If you use the Mandrakelinux or Debian release, you can download it directly. I am using Mandrakelinux. You only need to input urpmi gpgp in the terminal to download and install it.
After installation, enter gpg -- help at the terminal to view the version information and help of GPG. This indicates that the GPG has been installed.
Next we will generate the key, and enter: gpg -- gen-key. Several options will appear, which need to be selected:
Gpg (GnuPG) 1.4.0; Copyright (C) 2004 Free Software Foundation, Inc.
This program comes with absolutely no warranty.
This is free software, and you are welcome to redistribute it
Under certain conditions. See the file COPYING for details.
Select the key type you want to use:
(1) DSA and ElGamal (default)
(2) DSA (for signatures only)
(5) RSA (for signature only)
Your choice? In this case, we generally select 1, and the default gpg is also 1.
SA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) This is the length of the key. Generally, 1024 is entered.
Set the validity period of the key.
0 = the key never expires
<N> = the key expires in n days
<N> w = Key expired after n weeks
<N> m = Key expired after n months
<N> y = the key expires after n years
What is the key validity period? (0) This is the validity period of the specified key. You can choose one by yourself.
You need a user ID to identify your key. This software uses a combination of real names, comments, and email addresses.
As follows:
"Heinrich Heine (Der Dichter) Real name:
Email Address:
Note:
This is a user ID. You can enter your usual email address.
Enter the password:
This requires you to specify a password for your private key, which must be well protected. Otherwise, your encrypted file will be easily unlocked by others.
Now, GPG has generated your public key and private key.
Now let's talk about what GPG can do for us. If you want to send a paper to your friends, you don't want a third person to see it. You can do this.
Enter gpg -- encrypt-r Bob [file name] Bob on the terminal to sign the recipient and encrypt the [file name] As the file name to be encrypted.
Then you can send your public key to your friends. The public key export method is gpg -- export> name. asc.
Your friend just needs to import your public key to his GPG, and then he can decrypt the file you sent to him:
The decryption method is gpg -- decrypt [encrypted file]> [decrypted file]> As A redirection character, it means to save the result of gpg -- decrypt [encrypted file] to the [decrypted file] file. You can see the original text you sent.

Related Article

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.