Sponsored Content
Special Forums Cybersecurity How to encrypt / password protect big Linux file? Post 302882869 by Corona688 on Thursday 9th of January 2014 12:31:42 PM
Old 01-09-2014
It would be better to encrypt them right when they're made, and decrypt them 'on the fly' when you use them, than to encrypt and decrypt them in a giant file operation.

Code:
$ tar -zcf - folder | openssl enc -aes-256-cbc -salt -out file.tar.gz.aes

enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:

$ openssl enc -d -aes-256-cbc -in file.tar.gz.aes | tar -ztf -

folder/file1
folder/file2
...

$

You will still need to convert files that already exist of course:

Code:
openssl enc -aes-256-cbc -salt -in file.tar.gz -out file.tar.gz.aes

If 'aes-256' isn't fast enough for you, try 'blowfish'.
These 2 Users Gave Thanks to Corona688 For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Protect a tar file with a password!!

Hi there, I just want to know if there's anyway to protect any tar file with a password that requierd when somebody want to extract that tar. thanks in advance regards, Abdulkarim (1 Reply)
Discussion started by: geoquest
1 Replies

2. UNIX for Dummies Questions & Answers

Password protect a file

I have created a PHP page that I use to clean files on my machine. I would like to leave the file there but I want to password protect it so that I am the only one that can run it from the shell. Does anyone know how to do this? Thanks. -Cam (2 Replies)
Discussion started by: perryl7
2 Replies

3. Shell Programming and Scripting

tar with password protect

Hello All, i work with backup, The below script runs and tar the user specified dir and put it in a backup machine. can any one help me to modify this in such a was that the tar file generated can be given a users specific password so that it can have high security. KINDLY LET ME... (2 Replies)
Discussion started by: pradeepmacha
2 Replies

4. Shell Programming and Scripting

Password protect a zip file

Hi, I'm working on Solaris 9 and i need to unzip a password protected zip, which i can do using zip -Ppassword filename however when i have done what i need to do with the file is to zip the file back up with a password. Zip on my system is version 2.3 and does not support this? How can... (0 Replies)
Discussion started by: Pablo_beezo
0 Replies

5. UNIX for Advanced & Expert Users

Is it possible to password protect directories in linux?

Hi, I am using Red Hat OS 5.0, is there any way that i can password protect directories. I know i can change permission so that no other user can access the content, but sometimes in my office environment i need to share vnc terminal with other people from my login itself. So i want that if user... (1 Reply)
Discussion started by: sarbjit
1 Replies

6. UNIX for Dummies Questions & Answers

password protect a CSV file: better solution than ZIP password?

Hi We send *.csv with sensitive data to our customers. Our customers open those files with Excel. A new requirement is that we password protect those CSV files. I thought to pack them with ZIP and assign a password to the archive. But Solaris 10 can't encrypt ZIP files. $ zip -P... (12 Replies)
Discussion started by: slashdotweenie
12 Replies

7. Shell Programming and Scripting

Encrypt Password file and decrypt in a shell script

Hi All, I have stored Oracle database passwords in a hidden file - .pass_file. My shell script reads the hidden file, gets the password and then logs in to the Oracle database and runs some SQL script. My requirement is: I need to provide the shell script to be executed by someone else. So,... (1 Reply)
Discussion started by: sunpraveen
1 Replies

8. Shell Programming and Scripting

Password protect script

Is there a way to have a user be prompted for a password to open a file? I am trying to protect a bash script from being changed. Thank you :). (3 Replies)
Discussion started by: cmccabe
3 Replies

9. UNIX for Beginners Questions & Answers

Encrypt and Decrypt a File with Password

Hello, I have few files on unix which are payroll related and I need them to encrypt with password so others wouldn't see the data. I use ETL tool and would like to know the unix command that does encryption/decryption to use in the ETL. Thank you, Sri (3 Replies)
Discussion started by: eskay
3 Replies
aes(n)							Advanced Encryption Standard (AES)						    aes(n)

__________________________________________________________________________________________________________________________________________________

NAME
aes - Implementation of the AES block cipher SYNOPSIS
package require Tcl 8.2 package require aes ?1.0.1? ::aes::aes ?-mode [ecb|cbc]? ?-dir [encrypt|decrypt]? -key keydata ?-iv vector? ?-hex? ?-out channel? ?-chunksize size? [ -in channel | data ] ::aes::Init mode keydata iv ::aes::Encrypt Key data ::aes::Decrypt Key data ::aes::Reset Key iv ::aes::Final Key _________________________________________________________________ DESCRIPTION
This is an implementation in Tcl of the Advanced Encryption Standard (AES) as published by the U.S. National Institute of Standards and Technology [1]. AES is a 128-bit block cipher with a variable key size of 128, 192 or 256 bits. This implementation supports ECB and CBC modes. COMMANDS
::aes::aes ?-mode [ecb|cbc]? ?-dir [encrypt|decrypt]? -key keydata ?-iv vector? ?-hex? ?-out channel? ?-chunksize size? [ -in channel | data ] Perform the aes algorithm on either the data provided by the argument or on the data read from the -in channel. If an -out channel is given then the result will be written to this channel. The -key option must be given. This parameter takes a binary string of either 16, 24 or 32 bytes in length and is used to generate the key schedule. The -mode and -dir options are optional and default to cbc mode and encrypt respectively. The initialization vector -iv takes a 16 byte binary argument which defaults to all zeros. See MODES OF OPERATION for more about available modes and their uses. AES is a 128-bit block cipher. This means that the data must be provided in units that are a multiple of 16 bytes. PROGRAMMING INTERFACE
Internal state is maintained in an opaque structure that is returned from the Init function. In ECB mode the state is not affected by the input but for CBC mode some input dependent state is maintained and may be reset by calling the Reset function with a new initialization vector value. ::aes::Init mode keydata iv Construct a new AES key schedule using the specified key data and the given initialization vector. The initialization vector is not used with ECB mode but is important for CBC mode. See MODES OF OPERATION for details about cipher modes. ::aes::Encrypt Key data Use a prepared key acquired by calling Init to encrypt the provided data. The data argument should be a binary array that is a mul- tiple of the AES block size of 16 bytes. The result is a binary array the same size as the input of encrypted data. ::aes::Decrypt Key data Decipher data using the key. Note that the same key may be used to encrypt and decrypt data provided that the initialization vector is reset appropriately for CBC mode. ::aes::Reset Key iv Reset the initialization vector. This permits the programmer to re-use a key and avoid the cost of re-generating the key schedule where the same key data is being used multiple times. ::aes::Final Key This should be called to clean up resources associated with Key. Once this function has been called the key may not be used again. MODES OF OPERATION
Electronic Code Book (ECB) ECB is the basic mode of all block ciphers. Each block is encrypted independently and so identical plain text will produce identical output when encrypted with the same key. Any encryption errors will only affect a single block however this is vulnerable to known plaintext attacks. Cipher Block Chaining (CBC) CBC mode uses the output of the last block encryption to affect the current block. An initialization vector of the same size as the cipher block size is used to handle the first block. The initialization vector should be chosen randomly and transmitted as the first block of the output. Errors in encryption affect the current block and the next block after which the cipher will correct itself. CBC is the most commonly used mode in software encryption. EXAMPLES
% set nil_block [string repeat \0 16] % aes::aes -hex -mode cbc -dir encrypt -key $nil_block $nil_block 66e94bd4ef8a2c3b884cfa59ca342b2e set Key [aes::Init cbc $sixteen_bytes_key_data $sixteen_byte_iv] append ciphertext [aes::Encrypt $Key $plaintext] append ciphertext [aes::Encrypt $Key $additional_plaintext] aes::Final $Key REFERENCES
[1] "Advanced Encryption Standard", Federal Information Processing Standards Publication 197, 2001 (http://csrc.nist.gov/publica- tions/fips/fips197/fips-197.pdf) AUTHORS
Thorsten Schloermann, Pat Thoyts BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category aes of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. SEE ALSO
blowfish(n), des(n), md5(n), sha1(n) KEYWORDS
aes, block cipher, data integrity, encryption, security COPYRIGHT
Copyright (c) 2005, Pat Thoyts <patthoyts@users.sourceforge.net> aes 1.0.1 aes(n)
All times are GMT -4. The time now is 07:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy