Create encrypted compressed files under Linux

Source: Internet
Author: User
Tags builtin gnupg gpg italic font locale uncompress password protection

Create encrypted compressed files under Linux

    • Method One:
      * 1. Create an encrypted zip file using the zip command:
      * 2. When extracting encrypted files, you will be prompted to enter your password:
    • Method Two:
      * 1. Create a ZIP file using 7z:
      * 2. Unzip the encrypted file:
    • Method Three:
      * 1.To Create a encrypted compressed tar archive with GnuPG:
      * 2.To uncompress A archive file encrypted with GnuPG:

Suppose you want to create a zip archive and have password protection so that whoever tries to unzip the zip file must know the correct password. On Linux, there are several ways to encrypt a zip file, or to password-protect a zip file.

Let's introduce 3 commonly used encryption methods:

Method One:

The zip command-line tool provides an encryption option.
The zip command uses the PKZIP encryption algorithm.
The PKZIP algorithm is known to be unsafe.
In addition, the password that is set is displayed in plain text, making it more vulnerable.

1. Create an encrypted zip file using the zip command:
$ zip --password mypasscode all.zip 1.txt 2.txt  adding: 1.txt (stored 0%)  adding: 2.txt (stored 0%)
2. When extracting encrypted files, you will be prompted to enter your password:
$unzip all.zip Archive:  all.zip [all.zip] 1.txt password:
Method Two:

Using 7z for file archiving, you can create a more secure encrypted zip file, 7z uses the AES-256 encryption algorithm, and the SHA-256 hash algorithm generates the key.

1. Create a ZIP file using 7z:
$ 7z a -t7z -p doc_folder.7z doc_folder7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)ScanningCreating archive doc_folder.7zEnter password (will not be echoed) :Verify password (will not be echoed) :Compressing  doc_folder/.7z      Compressing  doc_folder/test.txt      Everything is Ok
2. Unzip the encrypted file:
$ 7z x doc_folder.7z7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)Processing archive: doc_folder.7zEnter password (will not be echoed) :Extracting  doc_folder/.7zExtracting  doc_folder/test.txtExtracting  doc_folderEverything is OkFolders: 1Files: 2Size:       37Compressed: 252
Method Three:

Another way to create a cryptographic package is to use GnuPG's symmetric key encryption

1.To Create a encrypted compressed tar archive with GnuPG:
$ tar czvpf – doc.pdf doc2.pdf doc3.pdf | gpg --symmetric --cipher-algo aes256 -o secure.tar.gz.gpg
2.To uncompress A archive file encrypted with GnuPG:
$ gpg -d secure.tar.gz.gpg | tar xzvf -

Create encrypted compressed files under Linux

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.