Search Unity

AssetBundle Encryption

Discussion in 'Addressables' started by bdavis1000, Sep 14, 2019.

  1. bdavis1000

    bdavis1000

    Joined:
    Oct 4, 2013
    Posts:
    18
    I'd like to implement an encryption layer on my asset bundles. I have an idea of how to decrypt them (assuming they are stored as TextAssets, I can decrypt and run AssetBundle::LoadFromMemoryAsync), however I cannot figure out where to hook into the build system to perform the encryption. Currently I have Cloud Build calling AddressableAssetSettings::BuildPlayerContent(), ideally there is some post build function run per bundle I can override. Any help would be appreciated.

    Sidenote, in UE4 you can easily encrypt your pakfile via some checkboxes in the settings. A feature like this would be really useful for the new addressables system imo.

    Also, as most posts about this seem to result in people claiming that encryption is useless, I fully understand it is not foolproof. The goal here is to make it inconvenient enough to rip the assets that they won't be flipped onto the marketplace or other games. It is currently very easy to download a program that opens and exports files from bundles.
     
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    Let's focus on tech then. The feature may be included in the sample project (but not yet).

    Here's another thread, stretch out the basic idea. Basically I'm repeating @5argon:
    • For decrypting, make an variant of AssetBundleProvider (don't mess up with BundledAssetProvider, read the difference here).
    • For encrypting, however the system is lacking an extendable point to hook up. What you need look into is the BuildScriptPackedMode.RuntimeDataBuildTasks. You probably shall do something after ArchiveAndCompressBundles. Noticed the commented out line - PostProcessBundlesTask, it seems something related, but lacking documentation.Please share if you find a clue.
    upload_2019-9-16_1-33-1.png
     
  3. zkiZK

    zkiZK

    Joined:
    Oct 11, 2017
    Posts:
    6
    • Do you have any good solutions