Hi I'm new in swift and XCode and have a question
I want to create an application for OS X that show some movies,images,HTML5 and...
My issue is that each files has big space(for example 200Mg) and i want to protect them from coping by others so i think that i can encrypt it and when i want to show to user, i decrypt them in temporary directory and bind them to UI but in that situation, hackers would listen to Harddisk to find my decrypted files and copy them.
I want to ask two question:
Do you have any other solution?
Is there any way to protect
temporary directory that only my application can access it?
Thanks a lot
Generally, no. Screen recording software is included with OS X. If you play video, any user can easily save it.
Related
I have an iOS application, which stores all downloaded *.pdf files in its cache. Is there a way to prevent this data from extracting? Encryption or something else? Thanks in advance.
There are quite a few ways to encrypt files, and I'm sure everyone will have an opinion on the best way to do so.
In a project I've recently been working on, we've been using CommonCrypto (https://github.com/AlanQuatermain/aqtoolkit). Just take any NSData, encrypt it, and save it to a file, and vice versa. You can even write an easy Transformer by subclassing NSValueTransformer, which abstracts all of the encryption to one spot and you will never have to worry about it again.
You can protect PDF files with a password. I assume you create the PDF files not within the application but externally. For example you can use Preview.app in Mac OS X to secure existing PDF files with a password (Hit Cmd-P, then select PDF in the print menu and there you can set security options. Or even more simple: in the menu choose Export...).
In iOS you can then open the PDF files like this:
CGPDFDocumentRef documentRef = CGPDFDocumentCreateWithURL((__bridge CFURLRef)[NSURL fileURLWithPath:filePath]);
if (!CGPDFDocumentIsUnlocked(documentRef))
CGPDFDocumentUnlockWithPassword(documentRef, password);
...
There are actually 2 Documents folders in which your app can store content. One can be extracted, and one is private. Check the accepted answer in this ticket.
Access files in "private Documents" folder transferred with iTunes
Assuming you want the PDF files from getting extracted on jailbroken devices, the most straight forward approach would be along the following lines:
generate a random string during the first launch of the app
save the random string either in NSUserDefaults in state file inside your own app's sandbox
using this random string create a secret key using a deterministic but hard to figure out algorithm
use this secret key, which you don't store anywhere but always generate on demand, symmetrically encrypt your buffer with AES or something similar
You would probably find the source code here very helpful.
I find many similar question but i didn't get solution for this.
Is it possible to upload some file like image, document, zip file to upload on iCloud programmatically?
See table 4-1 in the documentation:
How do you manage the data? Manage files and directores using the
NSFileManager class. Open, close, read, and write files using standard
file system routines.
So if you can create a file, you can store it in iCloud. But remember there's a finite, relatively small amount of space available.
iCloud can handle all kinds of files. So if you want rot use an obscure file format or invent your own, go for it. It only can to be converted into a byte stream/NSData, but then again, what isn't?
Check this tutorial walkthrough app. It shows how to create, modify and delete files for iCloud.
http://github.com/lichtschlag/iCloudPlayground
Um, I working on a dictionary app and currently trying to add narration for each article. I have about 97000 AAC-files. They are tiny - about 3-5 kilobytes each, but there are so many of them! I don't need SQL DB for access management because filenames are identical to the primary keys, so given the key I will be able to pick a proper sound file from disk and play it (I expect so).
The thing I worry about are issues related to huge number of files. I don't really want to mess up with CoreData.
Will there be any problems if I just add all these files to the application bundle? Will Xcode be angry at me? Will iOS be OK with that?
If not what should I use then? How to handle huge (~100'000) number of files properly?
There is no restriction on the number of files that can be added to your application bundle.
It would be better for you if you can put the files on a folder(say audio) in the app bundle.
this is a follow on from this question and the link given it seems that when an app is updated all of the files in the documents directory are copied into the updated apps documents directory and also anything in Library/Preferences. Whats the best way to simulate this for testing purposes?
Just copy the files in ApplicationSupport/iPhone Simulator etc? or has anyone developped any funky techniques for testing this.
I have created .sqlite file in my application's documents folder and created some dummy entries in my database table.
Now just change you code build new application without changing any of the certificate and profile information load the new application.
Now check for the old database table records. It will be definitely preserve under your Document directory in .sqlite file.
This is what i followed when i want to check it for same thing.
If anyone know better way then please feel free to suggest new things.
Jim.
i need to copy this database file and save it in someother location or i can take backup of the db file. is there a way to do this programmatically.
Thanks
Satish
Unless you've jailbroken your iPhone, there's no way of accessing the sqlite3 database directly on the phone.
If you're talking about getting access to the database from your computer, you can do it by grabbing the database files out of the iPhone backup files. To do that, you'll need to grab a copy of Erica Sadun's mdhelper (binary file) command line utility, and run it from the PC you sync your laptop with like so:
mdhelper -files "AddressBook.sqlitedb" -extract -glob
This will create a "~/Desktop/Recovered iPhone Files" directory containing a file called AddressBook.sqlitedb, which you can access directly or query using your programming language of choice.
If you don't trust downloading and running binary files without knowing what they do, you can look at the source on Github and compile it yourself.
the SQL database can be extracted from an iphone backup. I used this software to grab mine and the SMS database.
If you have lots of images/videos in camera roll it can take a while to run.
http://www.supercrazyawesome.com/
Yeah sorry abt that. ok thanks probably i will create a new database using AddressBook Apis
-Satish
You can also take a backup of your iphone and than use one of tools discribed here to identify the file you need.