0

I have already implemented encryption/decryption between php and android using AES/CBC.

However, when I decrypt images using android phone, it will always take more than 1 second for a 300k file. How can I speed up the decryption? Thank you very much!

PS: I am using mCrypt extension for php encryption and javax.crypto.Cipher for android decryption. I mean can I use other cryto or other mode?

Oleg Estekhin
  • 8,063
  • 5
  • 49
  • 52
vincentzhou
  • 710
  • 6
  • 18
  • Why don't you just use transport encryption (eg. HTTPS)? What's the purpose of encrypting it? – Johann Bauer Jul 09 '14 at 10:03
  • Encryption is used to ensure that users is only able to view these images in my App. There is also download function in my app, so if images are not encrypted users can use file explorer to view them. – vincentzhou Jul 09 '14 at 10:12
  • @jreuab,this question does not provide an alternative encryption way. – vincentzhou Jul 09 '14 at 10:23
  • 1
    There is no alternative way. Android encryption is simply slow, as was already discussed in http://stackoverflow.com/questions/24569286/android-file-decrytion-and-encrytion-taking-time, http://stackoverflow.com/questions/7282930/android-slow-aes-decryption, http://stackoverflow.com/questions/6257945/aes-decryption-on-android-too-slow-to-be-usable-will-ndk-be-faster-other-ideas, http://stackoverflow.com/questions/10619770/android-aes-encryption-decryption, http://stackoverflow.com/questions/7713166/speed-up-encryption-decryption. – Oleg Estekhin Jul 09 '14 at 10:27
  • @vincentzhou I don't think there is one using the Dalvik VM. – Johann Bauer Jul 09 '14 at 10:29
  • By the way: you know that decompiling your app and getting the key would be really easy? I don't think this adds any extra security. – Johann Bauer Jul 09 '14 at 10:30
  • @OlegEstekhin, It will also not help if I use RC4 instead? – vincentzhou Jul 09 '14 at 10:30
  • 1
    If you contemplate choosing speed over security you are doing it wrong. Better to do not encrypt (no security but the best speed) at all instead of using known weak cipher (weak or no security AND speed penalty). – Oleg Estekhin Jul 09 '14 at 11:27
  • http://stackoverflow.com/a/33171612/475496 This example helped me speedup encryption, maybe this helps you to. – StaticBR Feb 12 '16 at 10:19

0 Answers0