[openssl-users] encrypt a file using openSSL in C

Jakob Bohm jb-openssl at wisemo.com
Mon Jun 20 14:07:46 UTC 2016


On 17/06/2016 17:54, fterm wrote:
> Hi,
> i've got a question for my study stuff: I have to decrypt a file using C. I
> have a corrupt key corrupt-src-key.bin (an initial vector is at the end of
> the file - dont know if i should usw them - maybe dont have to). decrypted
> file is *.pdf and it was encrypted with Camellia-192-OFB (openssl
> EVP_camellia_192_ofb() ). Byte number 23(start counting from 0) was set to
> 0. Now i have to write a small C app which decrypts this file. At least ive
> got 2 more files(src-cipher.bin and dest-key.bin)). Thanks very much for
> help. If someone is interested, i can send the files. Thx
OFB modes use the key and IV to generate a data independent key stream 
which
is then xored with the raw data to encrypt or decrypt.

Thus you definitely need the IV value to do the decryption, and 
corrupting a
byte in the encrypted file (other than the IV) will simply corrupt the same
byte in the decrypted file with no other side effect (that is why real
crypto designs also incorporate a MAC or signature of the data, because
decryption itself would not detect deliberate tampering).

Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded



More information about the openssl-users mailing list