Encrypting and decrypting on Windows systems using Gpg4win

Source: Internet
Author: User
Tags decrypt decrypt text gpg dedicated server asymmetric encryption

GPG, also known as GnuPG, is the GNU Private Guard, the GNU privacy Defender. GPG is a powerful cryptographic software that is based on the PGP algorithm. But the GPG project is a set of command-line programs, and is designed for open-source operating systems such as Linux. So how do you use GPG under the Windows platform? Don't worry, Gpg4win is a collection installation package for Windows platform GPG and graphical front end.

Briefly, Gpg4win is an asymmetric encryption software. Simply put, the file is encrypted with the public key, and the file is decrypted with the private key. If you need to send encrypted information, first obtain the receiver's public key, and then use the public key to encrypt and pass, the other side with the corresponding private key can be decrypted. In other words, the public key is a lock and the private key is the key. Asymmetric encryption is a good way to solve the problem of passing confidential information.

Download and install Gpg4win

Please go to the official website to download: http://www.gpg4win.org/
Then run Setup and leave the default settings. After the installation is complete, you will be asked to set the root certificate of trust, check the root certificate defined or skip configuration below (the root certificate has been defined or skipped settings).

Create a key pair
  1. Run Kleopatra, click File–new Certificate, the Certificate Creation wizard will pop up (Certificate Creation Wizard)
  2. Select the first item Create a personal OpenPGP key pair.
  3. Fill in the name (name), email (e-mail address) and comment (additional information).
  4. With advanced Settings, you can set up a higher level of security by selecting the longest 4096 bits and maintaining the default settings for the rest.
  5. Click Create Key, then enter passphrase and click OK. please keep in mind Passphrase, because you need to enter Passphrasewhen using your own private key.
  6. During the creation process, you can type or move the window in the text box shown, and the computer will generate random numbers using IO.
  7. Once created, there are three options below: Back up the key pair, send the public key via email, and upload the public key to the server. If you do not need to do this, click Finish.

Import and Export secret key

Public key encryption, private key decryption. If you want someone to send you an encrypted message, someone else will need to know your public key. The public key is called the public key because it is public. Next, we need to publish our public key and upload it to a dedicated server. Here is an example of the PGP public key server uploaded to MIT.

    1. In the Kleopatra main interface right click on the key to export, click Export Certificates, enter the saved path and file name, click Save will get an ASC file.
    2. Use a text editor to open the ASC file you just generated and copy the entire content.
    3. Use your browser to access MIT's PGP Public key server http://pgp.mit.edu/, paste the content you just copied into the text box under "Submit a key", and click the submit this key to the key server!. Once the upload is successful, someone else searches your mailbox to get your public key.

Conversely, if you want to send encrypted information to someone, you need to get his public key. If I want to send it to [email protected], I need to get the corresponding public key by the following steps.

    1. To access MIT's PGP public key server http://pgp.mit.edu/using a browser, enter [email protected] in the text box under "Extract a key" as shown in. Then click Do the search!.
    2. Clicking on the corresponding keyID in the search results page will enter a page with a long list of garbled characters. Copy the entire contents of the page.
    3. Open the text editor, paste the content you just copied, save it. The file name is arbitrary, such as "NEO.ASC".
    4. In the Kleopatra main interface Click Import Certificates, select the file you just saved, click Open. This succeeds in importing a public key.

Encrypt text

The following example shows how to encrypt a piece of text and send it to someone by mail.

  1. Open the Text editor and enter the text you want to encrypt (that is, the original) and save it. The file name is arbitrary, such as "Send.txt".
  2. In the Kleopatra main interface, click File–sign/encrypt files and select the file you just saved.
  3. There are 3 options in the middle of the pop-up window, which are signed and encrypted (sign and Encrypt), encryption (Encrypt), signature (sign), respectively. Here we choose the default option-- encryption (Encrypt).
  4. Because we want to send plain text by mail, tick text output (ASCII armor). Click Next.
  5. Then select the recipient's public key from the list above (provided you have imported the recipient's public key), click Add to the list below. Click Ecrypt to start generating the ciphertext.
  6. After Milvensen , click Finish.
  7. Locate the newly generated ciphertext "send. TXT.ASC" under the same path as the original. Open with a text editor and copy the entire content.
  8. Send the ciphertext you just copied to the receiver, just as you would normally send an email.

Decrypt text

The following example shows how to decrypt a received cipher.

  1. Copy the ciphertext you received. Open a text editor, paste, save. The file name is arbitrary, such as "Receive.txt".
  2. In the Kleopatra main interface, click File–decrypt/verify files and select the file you just saved.
  3. Select the path of output, default is the same path as ciphertext, click decrypt/verify.
  4. You will then be asked to enter passphrase, which is the one we entered when we created the key. Click OK.
  5. When the decryption is complete, click OK.
  6. Find the decrypted file "receive.txt.out" in the output path and open it with a text editor to see the original.


Note: See my blog in the original "encryption and decryption using Gpg4win in Windows System"

Encrypting and decrypting on Windows systems using Gpg4win

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.