ZDCCacheFileHeader

struct ZDCCacheFileHeader {}

ZeroDark.cloud uses 2 different types of encrypted files:

  • cache files
  • cloud files

A cache file is very simple, and it’s what we prefer to use when storing a file on the local device. It’s created like this:

  1. append this header to the beginning of the plaintext (non-encrypted) file
  2. encrypt the data (header + plaintext) using the encryption key

The output will be an encrypted file whose size is rounded up to the nearest kZDCNode_TweakBlockSizeInBytes. When attempting decryption, we can verify the decryption key is correct by inspecting the decrypted header.

  • This value should be kZDCCacheFileContextMagic, otherwise it’s not a valid cache file.

    Declaration

    Objective-C

    uint64_t magic

    Swift

    var magic: Int32
  • Indicates the size of the data (in cleartext). This value excludes the padding that may have been applied.

    Declaration

    Objective-C

    uint64_t dataSize

    Swift

    var dataSize: Int32
  • Reserved for future extensibility.

    Declaration

    Objective-C

    uint8_t reserved[48]

    Swift

    var reserved: (Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)