Operating System - HP-UX
1837787 Members
3503 Online
110120 Solutions
New Discussion

Re: compress and encrypt the file

 
Wang Xueyan
Advisor

compress and encrypt the file

Is there any command can both compress and encrypt the file in HP-UX?
4 REPLIES 4
Karthik S S
Honored Contributor

Re: compress and encrypt the file

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=243432

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=508689

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Mark Grant
Honored Contributor

Re: compress and encrypt the file

I'm not sure of the point here. If I understand compression and encryption technology correctly (which I may well not), you can not usefully compress random data (Otherwise you could compress compressed files ending up with all files compressable to 1 character). Encrypted files are pretty much random data. Therefore, there doesn't seem much point in compressing an encrypted file.
Never preceed any demonstration with anything more predictive than "watch this"
Laurent Menase
Honored Contributor

Re: compress and encrypt the file

# gzip -c vm.gz.cr
^^^^ my passwd

to gunzip:
crypt toto vm

Do not do:
crypt toto
vm.cr.gz ,
the gzip has no use there, because of the pseudo randomisation of the crypt.
# ll /stand/vmunix vm.*cr*
-rwxr-xr-x 1 root sys 24779560 Jan 29 08:41 /stand/vmunix
-rw-rw-rw- 1 root sys 24783358 Mar 19 10:36 vm.cr.gz
-rw-rw-rw- 1 root sys 9328259 Mar 19 10:37 vm.gz.cr
#
Elmar P. Kolkman
Honored Contributor

Re: compress and encrypt the file

It totally depends on your encryption if compression still has any effect. But mind: you're better off encrypting the compressed data then the other way around... Compression tools might put a 'readable' header on a file...

So: gzip -c input | crypt 'passwd' >output

To unpack again, it's off course:
crypt 'passwd' input

Mind that you might need to put the path when calling crypt!
Every problem has at least one solution. Only some solutions are harder to find.