ios - Encrypting Plist File Method -


i have property list titled gamedata.plist. trying see if way encrypting plist correct or not. since unable manually edit main bundle files (which have been easy way see if data indeed encrypted now), , don't seem finding plist in available data through iexplorer, not sure if being encrypted.

the goal information overwritten encrypted data. im not sure if that's how works, trying prevent data in plist viewed outside app running or not running. here doing:

- (void)encryptionwithaes256 {         .         .         .     nsstring* path = [[ nsbundle mainbundle] bundlepath];     nsstring* finalpath = [ path stringbyappendingpathcomponent:@"gamedata"];     nsdictionary *plistdic = [nsdictionary dictionarywithcontentsoffile:finalpath];     nslog(@"plist: %@", plistdic);      nsdata *plistdata = [nskeyedarchiver archiveddatawithrootobject:plistdic];     nsdata *encrypteddata = [plistdata aes256encryptwithkey:@"<encryption_key>"];     [encrypteddata writetofile:finalpath atomically:yes];         .         .         . } 

note: testing purposes, gamedata.plist default plist xcode creates project, shown below:

<?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0">     <dict>         <key>test</key>         <string>gamedatatest</string>         <key>cfbundledevelopmentregion</key>         <string>en</string>         <key>cfbundleexecutable</key>         <string>$(executable_name)</string>         <key>cfbundleidentifier</key>         <string>$(product_bundle_identifier)</string>         <key>cfbundleinfodictionaryversion</key>         <string>6.0</string>         <key>cfbundlename</key>         <string>$(product_name)</string>         <key>cfbundlepackagetype</key>         <string>appl</string>         <key>cfbundleshortversionstring</key>         <string>1.0</string>         <key>cfbundlesignature</key>         <string>????</string>         <key>cfbundleversion</key>         <string>1</string>         <key>lsrequiresiphoneos</key>         <true/>         <key>uilaunchstoryboardname</key>         <string>launchscreen</string>         <key>uimainstoryboardfile</key>         <string>main</string>         <key>uirequireddevicecapabilities</key>         <array>             <string>armv7</string>         </array>         <key>uisupportedinterfaceorientations</key>         <array>             <string>uiinterfaceorientationportrait</string>             <string>uiinterfaceorientationlandscapeleft</string>             <string>uiinterfaceorientationlandscaperight</string>         </array>         <key>uisupportedinterfaceorientations~ipad</key>         <array>             <string>uiinterfaceorientationportrait</string>             <string>uiinterfaceorientationportraitupsidedown</string>             <string>uiinterfaceorientationlandscapeleft</string>             <string>uiinterfaceorientationlandscaperight</string>         </array>     </dict> </plist> 

how can check see if data being "replaced" or overwritten encrypted data? tried insert log of file contents before method gets called see if retrieve , show encrypted plist data, not. not sure if that's because reading data plist in main bundle, or writetofile not doing need. thanks!

update average user trying hold of apps data potentially able see plist mess of encryption rather of plain text plist data.

if want have encrypted data delivered application, needs encrypted during build process, not during runtime. easiest way encrypt file want , add xcode project resource. read nsdata other resource , decrypt in memory.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -