How to store private assets in an OSX application using cocoa

IOS has a private package that stores assets (3D models, plates, etc.). There is no direct access to these assets for the user, therefore they are stored in a "safe" place. But Mac osx apps are stored in a folder where access is pretty simple.

Is there a way to keep assets in a secure bundle? Something like iOS apps?

+4
source share
1 answer

Quick version: no matter what you do, a motivated user will receive the data he needs. Plus crypto is hard.

: , , , - : - ( , FYI), .

, - , AES , , .

: http://www.cs.ucdavis.edu/~rogaway/ocb/ocb-ref/rijndael-alg-fst.c ( .c .h, ). , , :

  • , :

.

#define KEYLENGTH(keybits) ((keybits)/8)
#define RKLENGTH(keybits)  ((keybits)/8+28)
#define NROUNDS(keybits)   ((keybits)/32+6)    
#define KEYBITS 256

(...)

uint32_t rijndaelKey[RKLENGTH(KEYBITS)];
unsigned char key[KEYLENGTH(KEYBITS)]; //You need to fill it with the encryption/decryption key
int nrounds = rijndaelSetupEncrypt(rijndaelKey, key, KEYBITS);
  • , 16 16 :

.

unsigned char plaintext[16], ciphertext[16];
(...)
rijndaelEncrypt(rijndaelKey, nrounds, plaintext, ciphertext);

, Encrypt by Decrypt.

, , , , C, Objective-C . , : http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Common_modes

Crypto , :/

+2

Source: https://habr.com/ru/post/1534765/


All Articles