Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Howto display or view encrypted data in encrypted form?

In the Wikipedia Article on Block Cipher Modes they have a neat little diagram of an unencrypted image, the same image encrypted using ECB mode and another version of the same image encrypted using another method.

UnencryptedECB ModeCBC Mode

At university I have developed my own implementation of DES (you can find it here) and we must demo our implementation in a presentation.

I would like to display a similar example as shown above using our implementation. However most image files have header blocks associated with them, which when encrypting the file with our implementation, also get encrypted. So when you go to open them in an image viewer, they are assumed to be corrupted and can't be viewed.

I was wondering if anybody new of a simple header-less image format which we could use to display these? Or if anyone had any idea's as to how the original creator of the images above achieved the above result?

Any help would be appreciated,

Thanks

Note: I realise rolling your own cryptography library is stupid, and DES is considered broken, and ECB mode is very flawed for any useful cryptography, this was purely an academic exercise for school. So please, no lectures, I know the drill.

like image 281
Brian Gianforcaro Avatar asked May 02 '10 21:05

Brian Gianforcaro


People also ask

How do I view encrypted files?

If you have used EFS or a third-party software to encrypt a file, you may be able to unlock it using its file properties. Right-click the file in File Explorer, select Advanced and then clear the Encrypt Contents to Secure Data check box. If this does not work, contact the software provider.

How do I view encrypted field data in Salesforce?

To view encrypted data unmasked in the debug log, the user must also have the View Encrypted Data in the service that Apex requests originate from. These requests can include Apex Web services, triggers, workflows, inline Visualforce pages (a page embedded in a page layout), and Visualforce email templates.

Can you read encrypted data?

Encrypted files and folders can also be decrypted without the use of a password or encryption key, but it requires the use of high-end, sophisticated decryption software.

How do I extract encrypted data?

Right-click on the encrypted file and select Properties. In the General tab, select Advanced. Now, uncheck the Encrypt contents to secure data radio box and click on OK. You'll see another dialog box asking if you want to Apply changes to this folder or Apply changes to this folder, subfolders and files.


1 Answers

If you are using a high-level language, like Java, python, etc, one thing you could do is load an image and read the pixel data into an array in memory. Then perform the encryption on those raw bytes, then save the image when you are done. Let all of the header data be handled by the libraries of whatever language you are using. In other words, don't treat the file as a raw sequence of bytes. Hope that helps.

like image 168
YGL Avatar answered Sep 28 '22 05:09

YGL