How to protect PDF and MP4 inside iOS/Android - android

I have this requirement, to download pdf/video file into the iOS/Android phone. then user can read offline.
Since the data now rest inside the app, how to prevent people from accessing and copy the file ?
EDIT
I know we can put password protected inside the PDF, and hardcode the password when we want to open it. but, How about video ?
second way, to encrypt/decrypt it. Can someone brief on this ? how to get this done ? possible issue, performance issue, since video contain big file size.

Related

displaying pdf in xamarin android

I am trying to create an app that will be able to display a pdf file in the app itself. I'm currently using the Xamarin.Bindings.PDFView-Android by SIDOVSKY which works really nicely. I can open a file easily from the assets... what I'm struggling to do is open a file from the internet.
Just a single line of code:
FindViewById<PDFView>(Resource.Id.pdf_view).FromAsset("report.pdf").Show();
Is enough to display a PDF that can be pinched to zoom which is great. However, I now want to access a file stored on the local network. Either using a SMB share, or through the intranet. Whichever way I try I can't figure it out.
There is a .FromFile setting, but I can't get it to work by putting a smb path in here. Is there a way to convert this? Or must I download the file to the local device first?
Thanks
Andrew

Encrypt large files on flutter and access them only through in-app

I am developing a digital media app using Google's flutter framework which contains songs, movies and etc. The main focus is, these media content should be accessible only through the app and not by outside methods (eg: media players, file browsers).
Eg: A music file which was downloaded through the app should only be played within the app and not by any media player. In that case, there should be an encryption method which should be used to lock these files from outside world.
In this case, bigger files such as Movies should also be taken into consideration. The size of a file can be anywhere between few kbs to 2-3 GBs.
What should be the better approach when solving this problem?
Is it to
Store everything in a database after encrypting the bytes?
Encrypt the entire file and still keep them in the form of "file"?
The downloaded data should also be able to be consumed quickly once the user requested for it. And once the consume is done, the file should be locked again from the rest of the world.
I am not sure if this topic is too broad but somehow I would appreciate it if anyone could provide me with something to start off.
Thank you.

Protect the downloaded content from Android

Am developing an offline pdf reader, which will download pdf files from remote and store inside the directory(say Android->data->com.example.test) and it will be shown in my app and i can read both in online and offline.
My issue is, If I open any PDFViewers like Adobe,Radaee viewers I can see my PDF's.
How can i avoid this. I dont want to show them in other apps.
This is not intended behaviour. we can control. Am looking for solution.
Example : Whatsapp's media like albums,profilepictures will be stored in device. We can view it. If you open any external Imageviewers we cant see the Profile Pictures. We can see the Media files. But Profile pics will be hidden. I need the exact solution.
Any help will be much appreciated.
Thanks in advance.
Imran.
Store the PDF on internal storage. You are presently storing the PDF on external storage.

Reading encrypted files on Android device without copying them to another location?

I have encrypted fiiles in the external Storage dir / the SD card. The files are crypted
images (jpg, bmp,...)
videos (3gp, mp4,...)
Pdfs
I want to load the bitmaps, videos or pdfs to load them in my ImageView, VideoView or open them via a pdf viewer. The problem is the files are secret. I dont want the files to be stored to open them. They could be read by others during the PDFviewer shows them for example.
Is there a way to directly open an image or pdf even though it is encrypted without copying an unencrypted copy?
If you want to keep your files as secret as possible for your app, I would use
javax.crypto.CipherInputStream
or a customized subclass of it. To do that you'll have to display your content embedded in your app, which is pretty straightforward for images and video. For PDFs you'll need to add a control which can display that kind of file to prevent others from getting access to the content.
Hope it helps.
You cite three scenarios: images into an ImageView, videos into a VideoView, and PDFs to a third-party app.
Images are easy. Make sure your decryption logic can give you an InputStream of the decrypted contents, then use appropriate methods on BitmapFactory.
I am not aware of a way to reliably serve videos to VideoView from an encrypted source. I know some people have experimented with embedding an HTTP server and streaming it.
You can publish a ContentProvider that supplies the decrypted content of a PDF to a third party app. This sample app just reads in the file, but you could use the same approach to decrypt it along the way.
All of this assumes that the user is the one responsible for requesting that this content be encrypted, and that you have collected a passphrase from the user. If, instead, your vision is that you are trying a DRM solution, anyone who wants to will be able to decrypt your content by reverse-engineering your app.

android secure data storage

i am developing one android application. it download videos from server and store it in mobile.
i want to store those video in secure manner.(deny the user from copying. or deny them from viewing the video directly from sdcard)
i found two ways to solve the problem.
1)Store the video's inside the application.
2)Encrypt the entire video
but facing some problem in implementing solution
i)first solution found suitable. but i am fearing that. if we store too much video inside the application .it would become bulkier.and fore the user to uninstall.
ii)but in second solution. i did not find any correct way to do so.
so please help me to solve the problem.
This is kind of suggestion :
To store the videos you must have created some folder on SDCARD, so you can hide the folder by putting the "." in front of the name while creating it. on top of this you can encrypt the video file using AES algorithm so it can not be viewed, if copied outside the android it will not be view able. but from your application you can decry-pt the file and view it.
Definitively, you must encrypt the media and that's quite simple. What is more difficult is to play the media, because MediaPlayer only accepts clear contents. A basic way would be to convert an encrypted file to a decrypted one, just for the time of the playing session. A better approach is to build a stream from the file, decrypt that stream and feed it to the player. The hard point is to have a local http server to serve the stream.

Categories

Resources