-----Original Message----- From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] On Behalf Of Erwann ABALEA Sent: 20 March 2009 10:58 To: openssl-users@openssl.org Subject: Re: [openssl-users] Re: Blowfish output using openssl is too long
> Hi, > > Hodie XIII Kal. Apr. MMIX, carlyo...@keycomm.co.uk scripsit: > > I would suspect that an 8 byte IV has been appended/prefixed > > > > Carl > > > > On Thu 19/03/09 9:16 PM , Dick Hollenbeck d...@softplc.com sent: > > > > I am using on Ubuntu Hardy: > > > > $ openssl enc -bf-cbc -K 012221222F2D9E4555559E41001291222 \ > > -iv 5522777779BBB1A9 -in file.raw -out file.enc > > > > and the output file is 8 bytes longer than the input file! > > > > The input file is 144 bytes long and the output file is 152 bytes > > > > Doing this in pycrypto, I do not get this result, the output file is the > > same length. > > The added bytes are padding ones. Padding is necessary, since a block cipher operates > on fixed-size blocks of bytes (here, 8 bytes or 64 bits). It is therefore quasi mandatory, > since a generic decryption operation doesn't know in advance the size of the decrypted > data, so the padding is also used to indicate how many bytes should be removed at the end. > > In your case, you're encrypting a 144 bytes long file, multiple of 8 bytes, so the padding > consists of 8 bytes, each one being 0x08. > > Test the encryption of a 145 bytes long file, you'll also end with e > 152 bytes encrypted file. There will be 7 padding bytes, each one being 0x07. If you need to suppress the padding, and your source data is already a multiple of the block size, you can try adding the -nopad option to your invocation of openssl. Alistair. Please help Logica to respect the environment by not printing this email / Merci d'aider Logica à préserver l'environnement en évitant d'imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei die Umwelt zu schuetzen / Por favor ajude a Logica a respeitar o ambiente não imprimindo este correio electrónico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org