Storing sensible data

What is the best way to store i.e. game currencies? It is not that sensible but I don’t want people manipulating it by modifying files on their phone.

I had the same requirement and have implemented a native library for Android and iOS to get the unique device identifier in order to use it as part of the encryption key. This would mean that saved files could not be moved from device to device.

I haven’t actually implemented the encryption yet though, but there is an xxtea implementation in the cocos2d/external directory.

So basically with this method I would be able to store every information on the phone ecrypted, and most people wouldn’t be able to change the files’ content so easily?

Yes. Look at the xxtea.cpp file; it shouldn’t be hard to get working.

1 Like

Thank you. I will do when I get home.

By the way, do you know anything about Soomla? Its a framework written for cocos2d-x, handling such cases. Does it really work for this?

No, I’ve never heard of it.

Soomla is all about In App Purchases - a much bigger thing than just encrypting data.

So if you are using your currency for IAP then it might be worth looking at Soomla