I need to find a way to encrypt/decrypt an images in Android.I'm new in Android programming and never been encrypt/decrypt on any other platform,so please provide me a good example,because I need to learn how to do it.I'm working on a project which needs to encrypt/decrypt images.I'll be really happy if you can help me about this. Thanks anyway!
1 Answers
You can take a look at this Stackoverflow Encryption Accepted Answer
Keep in mind that this is probably going to take a lot of time to encrypt/decrypt images. You also have not set any security standards (how secure must this be) so it's hard to give an authoritative answer
Update
After your comment here are a few more things to think about. Typically faster = less secure. Are you really trying to secure the images or just make them unavailable to unauthorized users.
For instance do you only want the images to be viewable on an authorized device or are you worried about them falling into the wrong hands?
I had a problem where the images should only be shown on a device that was an authorized account, that was fairly easy to solve, a unique ID associated with the users account was used to encrypt the data, so each user had their own (unique) key on the device and on the server, encryption was done on the fly on the server side. I also only needed to encrypt part of the data (header - first 4096 bytes) to make it unusable, I wasn't trying to keep the NSA from decrypting the images, just keep them from being easily decrypted and passed around.
So that was fast and secure enough, this is why I am suggesting you figure out what you are trying to do and protect against before picking a implementation plan.
-
The web server will encrypt the images with a specific key value and after that I should be able to decrypt the images with the specific key value on my application.That's all that i need to find out.Thanks a lot for the answer! – hardartcore Jul 24 '11 at 17:33
-
What encryption mechanism does the server use seems important then since they will have to match. How is the key going to be passed in a secure way is another question. – Idistic Jul 24 '11 at 17:36
-
The server side will be done after I make some tests which algorithm is the best and the fastest way to endrypt/decrypt the images.And about the key,I'm really not sure, I should to talk with my friend for it..For now I just need to make tests with AES to find out how long it will take to me on different devices to encrypt/decrypt the images so I can show the results to my friend which needs that app. – hardartcore Jul 24 '11 at 17:39
-
Ok well if "fastest" is your requirement then that means you don't need much security, if you are just trying to keep people from using the image, vs. actually securing it you might think about my revised answer above – Idistic Jul 24 '11 at 17:43
-
Yeah,it's more important to be faster than the security.The thing that I need right now is just an example how to encrypt/decrypt an image with aes,with a key value which i define in the application code. – hardartcore Jul 24 '11 at 17:58
-
Basically I have very similar situation to yours.Every user will have an specific ID for it's device,so he cannot use two devices from same account.Encryption will be done on the server side so I need only to decrypt the images on the device with a specific key value.But for now, I just need to build a simple test app which I need to test the speed of encrypting/decrypting an image with AES.This is my to do list for now.So I will be really appreciate if you can show me how to do that.I need an sample of code where I can define an image for decryption and make a log file with info about process – hardartcore Jul 25 '11 at 06:16
-
@Android-Developer i have done with encryption part but getting erros in decryption part ... here is the link i m following http://stackoverflow.com/questions/23249905/android-image-encryption-decryption-bufferedimage-and-imageio-not-resolved#23266933 – Erum Dec 23 '14 at 08:02