ZDCCryptoFile

@interface ZDCCryptoFile : NSObject

A CryptoFile instance encapsulates all the information you need to read an encrypted file.

The ZeroDark.cloud framework provides a plethora of tools to read crypto files:

  • To decrypt a small cryptoFile into memory, you can use +[ZDCFileConversion decryptCryptoFileIntoMemory:completionQueue:completionBlock:].
  • To decrypt a larger cryptoFile, use +[ZDCFileConversion decryptCryptoFile:completionQueue:completionBlock:].
  • To read a cryptoFile as a stream, you can use either CloudFile2CleartextInputStream or CacheFile2CleartextInputStream depending on the fileFormat.
  • To randomly access data within a cryptoFile, use the ZDCFileReader class.

    • Designated initializer

      Declaration

      Objective-C

      - (nonnull instancetype)initWithFileURL:(nonnull NSURL *)fileURL
                                   fileFormat:(ZDCCryptoFileFormat)fileFormat
                                encryptionKey:(nonnull NSData *)encryptionKey
                                  retainToken:(nullable id)retainToken;

      Swift

      init(fileURL: URL, fileFormat: ZDCCryptoFileFormat, encryptionKey: Data, retainToken: Any?)
    • The location of the file on disk.

      Declaration

      Objective-C

      @property (readonly, strong, nonatomic) NSURL *_Nonnull fileURL;

      Swift

      var fileURL: URL { get }
    • The encryption format being used to store the file.

      Declaration

      Objective-C

      @property (readonly, assign, nonatomic) ZDCCryptoFileFormat fileFormat;

      Swift

      var fileFormat: ZDCCryptoFileFormat { get }
    • The encryption key used to encrypt/decrypt the file. This is a symmetric key, typically 512 bits for use with Threefish-512.

      Declaration

      Objective-C

      @property (readonly, copy, nonatomic) NSData *_Nonnull encryptionKey;

      Swift

      var encryptionKey: Data { get }
    • If the file is being managed by the DiskManager, the retainToken may be non-nil.

      As long as the retainToken remains in memory (isn’t deallocated), the DiskManager considers the file to still be in use, and won’t delete the file from disk.

      Declaration

      Objective-C

      @property (readonly, strong, nonatomic, nullable) id retainToken;

      Swift

      var retainToken: Any? { get }