Lee Melville wrote:
> 
> Hi,
> 
> Here's my problem, the following code encrypts a file (i think it does
> anyhow), the test file that i use starts off as 22 bytes, the encrypted
> version is 24 ( i am not sure this is relevent).  Anyhow the problem is when
> i come to decrypt the file using the openssl command line tool it complains
> about a bad magic number.  What is this?  My code is the problem
> (obviously), but i dont know where this magic number fits in and hence i
> havn't got a clue as to what to do.  Plz Help.
> 

The output buffer should be one block larger than the total amount of
data in the input buffer to avoid possible overruns. 
Though for 22 bytes that wont matter.

The growth in size is expected for a block cipher.

Now the main problem is that the 'enc' program uses salting and adds
some extra data in the output stream to allow for this. Salting is
strongly recommended otherwise dictionary attacks can be made on the
password.

However since you are initially testing you can use the -nosalt option
to 'enc' instead.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to