Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
# 1  

I just started playing around with Unix's OpenSSL utility. I can't seem to get the hang of it, and the man page isn't helping much. I wanted to experiment with file encryption, so I created a dummy text file with one line of text and tried to encrypt it using DES. I used the following command:

openssl des -in Encrypt.txt -out Encrypted.txt

As expected, this produced an encrypted file whose contents were illegible. Then I tried to decrypt the file. I figured since most of these encryption algorithms are based on XORing the key with the message, I would be able to apply the same command to get the original plaintext. So I used a variation of the same command.

openssl des -in Encrypted.txt -out Decrypted.txt

I opened the file Decrypted.txt and found that it was still illegible. I hadn't gotten the original plaintext back. "Okay," I thought, "I guess I don't know much about how to use DES, since it's a block cypher. Maybe I'll try a stream cypher, since I'm more familiar with how they work, and I know for a fact that for a stream cypher, encryption and decryption use the same algorithm."

I used the following commands:

openssl rc4 -in Encrypt.txt -out Encrypted.txt
openssl rc4 -in Encrypted.txt -out Decrypted.txt

Still doesn't work.

Then I noticed something strange when looking at the files. The encryption algorithm had added a human-readable prefix to the encrypted file, reading "Salted__". So it looks like what happened was the encryption algorithm added that prefix, when meant that when the same algorithm was applied again, it had a different starting point, so when it started decrypting the original message, after XORing the first eight bytes of the key with the prefix, it would be XORing a completely different part of the key with the same characters, resulting in a gibberish result.

So my question is, what is the proper way to encrypt and decrypt files using OpenSSL? Can anyone point me to any good tutorials? Because, as I said, the man page isn't providing much help.
# 2  
How about using the -d option? (-e is the default)
This User Gave Thanks to RudiC For This Post:
# 3  
Thank you. That works.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

9 More Discussions You Might Find Interesting

1. Red Hat

Openssl vulnerabilities

Hi there, The following openssl package are installed on the machine (openssl-1.0.0-27.el6_4.2.x86_64). It isn't the last version but I need to known if this content Vulnerabilities... How to check that on RedHat? Could you please tell me how to find this information?? Thankx (3 Replies)
Discussion started by: hiero_nymus
3 Replies

2. UNIX for Advanced & Expert Users

Compression with openssl

Hi , 1-I need to know please if it's possible to compress using openssl? Here is the version used: openssl version -a OpenSSL 0.9.7d 17 Mar 2004 (+ security fixes for: CVE-2005-2969 CVE-2006-2937 CVE-2006-2940 CVE2006-3738 CVE-2006-4339 CVE-2006-4343 CVE-2007-5135 CVE-2008-5077... (3 Replies)
Discussion started by: Eman_in_forum
3 Replies

3. Shell Programming and Scripting

Openssl issue

Hi, I am using openssl as below for encryption of a string ( foo) and I have to pass the password twice for the same. echo 'foo' | openssl aes-256-cbc -a -salt enter aes-256-cbc encryption password: Verifying - enter aes-256-cbc encryption password:... (2 Replies)
Discussion started by: 46019
2 Replies

4. Shell Programming and Scripting

openSSL command help

I am running a openssl command like this: openssl s_client -showcerts -connect $fqdn:$portand the result is some ridiculous amount of stuff but i only want to cut out part of the certificate chain. How do i do that? (2 Replies)
Discussion started by: shade917
2 Replies

5. Solaris

Openssl 0.9.8r

Hi Peeps, Having trouble compiling openssl 0.9.8r on Solaris 10 x86. The make test fails when running the shatests (segmentation faults). There is a PROBLEM file that references a file called values.c. Anyone know whereabouts in the source tree you put this file as the file doesn't tell you... (2 Replies)
Discussion started by: callmebob
2 Replies

6. UNIX for Advanced & Expert Users

Using openssl

All, I am new to openssl and I have not been able to figure out exactly how to use it. What I need to do is to create a shell script which FTPS's (SFTP is not allowed on my project) a file to a mainframe. The mainframe will not initiate a session with my server. Question. Are the packages... (7 Replies)
Discussion started by: MichaelInDC
7 Replies

7. Solaris


ERROR OpenSSL version mismatch. Built against 908070, you have 9080bf^M 2009.11.20 15:23:25 ERROR Connection closed^M i am new in solaris,i not have great know in this operative system Help me how i can fixed this, in the machine has installed Solaris Machine hardware: ... (1 Reply)
Discussion started by: saurio
1 Replies

8. UNIX for Dummies Questions & Answers

openssl ca ke issue

Hi everybody: here is my tale: I need to create some ssl certificates, so I did it with my Linux; I created de CA key and all the other stuff, and of course the certificates needed. The thing is I had to replace mi hard drive and I backed up all the info but I forgot to backup the /etc/ssl. Of... (0 Replies)
Discussion started by: piltrafa
0 Replies

9. UNIX for Advanced & Expert Users

openssl help

I ungraded my openssl on sun solaris 8 from openssl 0.9.6c to openssl 0.9.6g the ungrade went fine but when I tried to ssh in to server, I received the following error message " ./sshd: fatal: relocation error: file /usr/local/ssl/lib/ symbol main: referenced symbol... (2 Replies)
Discussion started by: hassan2
2 Replies

Featured Tech Videos