處理以進行資料加密的 API

截取以進行加密及解密之應用程式 API 的相關資訊。

已截取的 API

除非另有指出,否則這些 API 在封套中加密及解密。

不能考量 C API 進行截取。 如果必須加密 C API 處理的檔案,請切換至替代 Objective-C API。

NSData
類別 方法
NSData - initWithContentsOfFile:
  - initWithContentsOfFile:options:error:
  - writeToFile:atomically:
  - writeToFile:options:error:
  + dataWithContentsOfFile:
  + dataWithContentsOfURL:
  - writeToURL:atomically:
NSString
類別 方法
NSString - initWithContentsOfFile:encoding:error:
  - initWithContentsOfFile:usedEncoding:error:
  - writeToFile:atomically:encoding:error:
  - writeToURL:atomically:encoding:error:
NSFileHandle
類別 方法
NSFileHandle + fileHandleForReadingAtPath:
  + fileHandleForReadingFromURL:error:
  + fileHandleForWritingAtPath:
  + fileHandleForWritingToURL:error:
  + fileHandleForUpdatingAtPath:
  + fileHandleForUpdatingURL:error:
  - initWithFileDescriptor:
  - initWithFileDescriptor:closeOnDealloc:
  - readDataOfLength:
  - writeData:
  - closeFile
  - readDataToEndOfFile
NSInputStream(僅限解密)
類別 方法
NSInputStream - initWithURL:
  - read:maxLength:
  - close
NSOutputStream(僅限加密)
類別 方法
NSOutputStream - initWithURL:append:
  - write:maxLength:
  - close
NSFileManager
類別 方法
NSFileManager - createFileAtPath:contents:attributes:
  - removeItemAtPath:error:
  - copyItemAtPath:toPath:error:
  - moveItemAtPath:toPath:error:
NSUserDefaults
類別 方法
NSUserDefaults - objectForKey:
  - setObject:forKey:
  - boolForKey:
  - integerForKey:
  - stringForKey:
  - persistentDomainForName:
AVPlayer(僅限解密)
類別 方法
AVPlayer - initWithPlayerItem:
MPMoviePlayerController(僅限解密。 已在 iOS 9.0 中淘汰)
類別 方法
MPMoviePlayerController - initWithContentURL:
NSPersistentStoreCoordinator
類別 方法
NSPersistentStoreCoordinator - addPersistentStoreWithType:configuration:URL:options:error:
NSDictionary(僅限解密)
類別 方法
NSDictionary + dictionaryWithContentsOfFile:
NSKeyedArchiver(僅限加密)
類別 方法
NSKeyedArchiver + archiveRootObject:toFile:
NSKeyedUnarchiver
類別 方法
NSKeyedUnarchiver + archiveRootObject:toFile:
(僅限解密)
UIImage(僅限解密)
類別 方法
UIImage + imageWithContentsOfFile:
  + imageNamed:
AVURLAsset
類別 方法
AVURLAsset - initWithURL:options:
   
(僅限解密)
sqlite3.c
類別 方法
sqlite3.c sqlite3_open

特殊案例 - 支援核心圖形 PDF

若要動態解密 PDF 檔,您必須使用 Objective-C 介面進行截取。 MaaS360® 為用來建立 PDF 參照的 C 函數提供 Objective-C 封套。

thePDFDocRef = [MaaS360AppWrapUtility CGPDFDocumentCreateWithURL:theURL];

您必須從 MaaS360 Developer Support 下載兩個檔案,並在原始碼中包含這些檔案:

  • MaaS360AppWrapUtility.m
  • MaaS360AppWrapUtility.h

將原始碼中的新 Objective-C 類別檔併入目標。 此檔案的標頭必須包括在需要變更的檔案中。

截取的非 iOS API

協力廠商 API
類別 方法 使用
MaaS360AppWrapUtility + CGPDFDocumentCreateWithURL: 解密
MFDocumentManager - initWithFileUrl: 解密
ReaderDocument + isPDF: 解密
SSZipArchive + unzipFileAtPath:toDestination: 解密/加密
ZipArchive - addFileToZip:newName: 解密/加密