login about faq

I am creating a InputStream that decrypt file on the fly. Since the android media player always send range http request, my InputStream must be able to decrypt bytes between a range requested by the player. My code for that is at the end of the email. I used AES/CTR/NoPadding and IV size of 16 bytes.

I found that when I decrypt from beginning to end, everything works nicely. However when I skip on fileInputStream, it doesn’t work. In my test I have one encrypted file and its normal file. I compare output by my own InputStream with encrypted file and FileInputStream with normal file, they should be the same.

asked Dec 24 '14 at 09:06

chilkat's gravatar image

chilkat ♦♦
11.8k316358421


Block encryption algorithms can be used in different modes of operation (counter mode, cipher-block chaining, electronic cookbook, cipher feedback, etc.) Most of these modes are such that the encryption of the next block (16 bytes in many algorithms) uses the results of the previous block. Therefore, usually the only way to decrypt is to sequentially decrypt from beginning to end.

See the article here on Block Cipher Modes of Operation: http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation On the referenced web page, see the sample image (of the Linux penguin) and how the results look when encrypted with ECB mode.

With ECB mode, you can easily skip ahead, but only in increments of the algorithms block size (such as 16-byte blocks for AES). The same is true for CTR mode, except that you need a way to also advance the counter -- and this functionality is not yet available in Chilkat (at the time of this writing). I'll consider adding this feature (assuming I haven't misunderstood anything critical), for the next week or two (given the holidays).

link

answered Dec 24 '14 at 09:16

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Thanks very much, advancing counter would be great feature :)

link

answered Dec 24 '14 at 09:56

Thomas's gravatar image

Thomas
32

Hi, just want to check if this feature is being implemented? Many thanks

link

answered Jan 12 '15 at 21:05

Thomas's gravatar image

Thomas
32

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×64
×2
×1
×1

Asked: Dec 24 '14 at 09:06

Seen: 944 times

Last updated: Jan 12 '15 at 21:05

powered by OSQA