Unity-Technologies/Addressables-Sample

Request for basic encryption example

VR-Architect opened this issue · 6 comments

Please provide a basic example of implementing some basic level of encryption. Thanks.

i agree, this would be very useful to have. Would like to not have to worry about assets being flipped right after launch.

In multiple Unite talks the dev mentioned that an encryption example would be available on Github. Yet, I couldn't find them. Has this been abandoned?

Hi all apologies for the delay! Unfortunately there are no plans to provide an example project demonstrating encryption. There are some limitations such as bundle caching and memory increases that make it not feasible, especially for projects with lots of AssetBundles.

Hi all apologies for the delay! Unfortunately there are no plans to provide an example project demonstrating encryption. There are some limitations such as bundle caching and memory increases that make it not feasible, especially for projects with lots of AssetBundles.

Can you elaborate a bit more so we can find a solution? Specifically is it NOT possible or does the team not have the bandwidth to provide the sample given some quick prototyping issues being encountered (caching/mem increase you mention).

@thomasftg Hi, yes the latter. It is possible to do for projects with a small number of AssetBundles. Due the issues mentioned we are not able to provide an official sample project at this time.

You could create a custom AssetBundleProvider class that extends that base class, and additionally handles the encryption and decryption steps. One way to approach this is to use LZ4 Decryption. An AssetBundle that uses LZ4 compression consists of 256KB chunks that can be encrypted. The bundle can be loaded from a seekable stream (AssetBundle.LoadFromStreamAsync) and individual chunks can be decrypted as they are loaded.

@thomasftg Hi, yes the latter. It is possible to do for projects with a small number of AssetBundles. Due the issues mentioned we are not able to provide an official sample project at this time.

You could create a custom AssetBundleProvider class that extends that base class, and additionally handles the encryption and decryption steps. One way to approach this is to use LZ4 Decryption. An AssetBundle that uses LZ4 compression consists of 256KB chunks that can be encrypted. The bundle can be loaded from a seekable stream (AssetBundle.LoadFromStreamAsync) and individual chunks can be decrypted as they are loaded.

Hello, thank you for the tips! Which methods can I use to do the encryption and decryption? Can you guide me how the AssetBundleProvider works in order that I can make a cryptography implementation, please? Best regards!