ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Decryption of AES encrypted data in custom DataSource

Open KiDa-2049 opened this issue 10 years ago • 2 comments

I am writing cusom DataSource for decryption of AES encrypted data. Help me rectify the error.

have initialized FileInputeStream and then wrapped it in CipherInputStream @Override public long open(DataSpec dataSpec) throws IOException { .... cipherInputStream = new CipherInputStream(inputStream, cipher); .... }

and in

@Override public int read(byte[] buffer, int offset, int readLength) throws IOException { ... bytesRead = cipherInputStream.read(buffer, offset, bytesToRead); ... }

I get error IllegalStateException: Top bit not zero: -1136244354

is this a right approach?

KiDa-2049 avatar Jun 09 '16 07:06 KiDa-2049

That error means your DataSource is either returning invalid media, or violating the contract of the DataSource interface. I can't see anything obviously wrong with your approach, but since this is a custom component we're unfortunately unable to provide direct assistance.

ojw28 avatar Jun 09 '16 22:06 ojw28

after adding cipherInputStream.skip(dataSpec.position);

in open(...){...}

works good

KiDa-2049 avatar Jun 10 '16 12:06 KiDa-2049