Unity-Technologies / Addressables-Sample

Demo project using Addressables package
1.29k stars 299 forks source link

Request for basic encryption example #40

Open VR-Architect opened 4 years ago

VR-Architect commented 4 years ago

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

ChetRippo commented 4 years ago

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

renatoi commented 4 years ago

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?

kirstenpilla commented 2 years ago

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.

ghost commented 2 years ago

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).

kirstenpilla commented 2 years ago

@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.

fabiolamin commented 1 year ago

@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!