开发者

Read byte array into bitmap

I have a server which provides an encrypted image (converted to base64 for transmission) to my android app. The encrypted image will sit on the SD card until the app receives the key (via QR code scan). Then the app will decrypt the image and display it. I've compared MD5 hashes along the way which implies that the data is getting correctly decrypted (original image byte array hash matches decrypted byte array hash).

The problem is that:

Bitmap b = BitmapFactory.decodeByteArray(decrypted, 0, decrypted.length);

returns null.

The original image is PNG which should be recognized by BitmapFactory?

If the开发者_如何学运维 byte array hashes match is that confirmation that the data is being transmitted/decrypted OK?

Thanks


Well try to load the image bytes into the BitmapFactory without any encryption/decryption. If its still happening, then the problem with the creation of the bytw array and we can know the cause was not caused by encryption/decryption.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜