Linux Archive password managment!

View previous topic View next topic Go down

Linux Archive password managment!

Post by jamied_uk on 10th August 2014, 09:21

Quick way to encrypt file(s)

http://crunchbang.org/forums/viewtopic.php?id=17576
Code:
zip --encrypt mysecret.zip secret.txt
it will ask for password!


the text file is the original unencrypted file and
the mysecret.zip file is the output file

unzip mysecret.zip



Another way of encrypting files with linux


http://xmodulo.com/2013/09/how-to-create-encrypted-zip-file-on-linux.html


In this tutorial, I will describe how to create an encrypted zip file on Linux.

Method One

The zip command line tool provides an encryption option. The encryption algorithm used by zip command is PKZIP stream cipher. The PKZIP algorithm is known to be insecure. Also, the fact that the password is typed and shown in plain text makes it even more vulnerable.

To create an encrypted zip file with zip:

Code:
zip --password MY_SECRET secure.zip doc.pdf doc2.pdf doc3.pdf


To uncompress a zip file that is encrypted with zip command:

Code:
 unzip secure.zip


Archive:  secure.zip
[secure.zip] doc.pdf password:

Method Two

7z file archiver can produce zip-format archives with more secure encryption scheme. According to the official description, 7z archiver supports AES-256 encryption algorithm with SHA-256 hash algorithm based key generation.

To create an encrypted zip file with 7z archiver:

Code:
7za a -tzip -pMY_SECRET -mem=AES256 secure.zip doc.pdf doc2.pdf doc3.pdf


To uncompress a zip file that is encrypted with 7za command:

Code:
7za e secure.zip


7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)

Processing archive: secure.zip

Extracting  doc.pdf
Enter password (will not be echoed) :

Method Three

Another way to create a secure zip archive is to use GnuPG's symmetric key encryption.

To create an encrypted compressed tar archive with GnuPG:

Code:
tar czvpf - doc.pdf doc2.pdf doc3.pdf | gpg --symmetric --cipher-algo aes256 -o secure.tar.gz.gpg


To uncompress an archive file encrypted with GnuPG:

Code:
gpg -d secure.tar.gz.gpg | tar xzvf -



Method Four

If you use Nautilus file manager on your Linux desktop, you can use Nautilus GUI to create a password-protected zip file easily.

First, highlight a set of files to include in the archive. Then right-click them, and choose "Compression" option.





Another way is mcrypt


http://www.cyberciti.biz/tips/linux-or-unix-password-protecting-files.html

Code:
$ mcrypt data.txt

Output:
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase:
Enter passphrase:
A new file is created with the extension .nc i.e. data.txt.nc:
Code:
$ ls data.txt.nc
 $ cat data.txt.nc
 

Decrypt the data.txt.nc file:

Code:
$ mcrypt -d data.txt.nc

Output:
Enter passphrase:
File data.txt.nc was decrypted.
Verify that file was decrypted:
Code:
$ ls data.txt
 $ cat data.txt
For mcrypt to be compatible with the Solaris des, the following parameters are needed:

Code:
$ mcrypt  -a des --keymode pkdes --bare -noiv  data.txt

Delete the input file if the whole process of encryption/decryption succeeds (pass -u option):

Code:
$ mcrypt -u data.txt

OR

Code:
$ mcrypt -u -d data.txt.nc
openssl command
OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them. You can use the openssl program which is a command line tool for using the various cryptography functions of OpenSSL's crypto library from the shell. It can be used for encrypt and decrypt files with a password:
Examples:
Encrypt file.txt to file.out using 256-bit AES in CBC mode

Code:
$ openssl enc -aes-256-cbc -salt -in file.txt -out file.out

Decrypt encrypted file file.out

Code:
$ openssl enc -d -aes-256-cbc -in file.out
avatar
jamied_uk
Admin

Posts : 2278
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum