The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to use PGP File Encryption sandeepb Security 2 10-04-2007 06:47 AM
PGP encryption/decryption solaris 9 frustrated1 SUN Solaris 0 09-30-2006 04:45 PM
File encryption/Key encryption ???? hugow UNIX for Dummies Questions & Answers 1 03-18-2006 01:29 PM
Password encryption/decryption in flat-text files domivv High Level Programming 2 03-04-2005 07:38 AM
encryption of text file for ftp dchalavadi UNIX for Advanced & Expert Users 3 05-16-2002 08:09 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-27-2002
Registered User
 

Join Date: Aug 2002
Location: North Carolina, USA
Posts: 25
File Encryption and Decryption in UNIX.

Hello guys !

I have used "crypt <first> second" command to encrypt "first" to "second" file. i have assign a key for that of course.

Now when i try to look content of "seocnd" file through "cat second" command, the file is encrypted and cannot be read which is according to plan.

But when i decrypt the same file ("crypt <first> second") and gave the same key and try to see contents of file "second", it is still encrypted why ?

after decryption, you should not be able to see the contents of file in plain text ?

Please help me in this regad.

Thanks and Regards
Abid Malik
Forum Sponsor
  #2  
Old 08-27-2002
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
To decrypt, the input must the encrypted file. You are just running the encyption step twice.

crypt < plain > encrypted ## encrypt file
crypt < encrypted ## view the file
  #3  
Old 08-27-2002
Kelam_Magnus's Avatar
Registered User
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
look at your syntax...

Oops! I guess Perderabo was editing when I was!!

Anyway, you have a few issues here.


First, you can't use cat. If you want to view an encrypted file, you must use the [b]vi -x <filename> command. Usually the crypted file ends in *.x]/B]

Next, when you decrypt the file, you are extracting the file from the encrypted file. I believe that you must give a filename for it to extract to.

It appears that you didn't reverse the order of first second to second first when you were decrypting.

to encrypt:
crypt <file1 >file2.x

to decrypt:
crypt <file2.x >file1

Of course, you will have to cleanup any unencrypted files that you create or clear the screen to erase what went to std out.


This should fix your problem.
__________________
My brain is your brain
  #4  
Old 08-27-2002
Registered User
 

Join Date: Aug 2002
Location: North Carolina, USA
Posts: 25
Wink

Hello there !

First of let me Thank "Kelam_magnus" and "Perderabo" for solving my problem and helping to understand that encryption issue.

I got it very well. You both are right. i tried both ways and it did work fine.

this is what i did.

----------------- for encryption of "first" to "second"------------

$> crypt <first> second
$> enter Key: test
$>
----------------- for decryption----------------------------
$> crypt < second
$> enter Key: test

and it shows me the content of file.

then i tried in vi.. Kelam_magnus is right about -x option of vi. it uses for cryption and decryption.

vi -x second
enter key: test

and here is contents of file.

one thing i notice that the encryption file donot have to be end with .x or anything. i am not positive but it worked fine without it.

Thanks again and see you in my next question.

Abid Malik
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:27 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0