This article focuses on the encryption process for U3D games under windows
Main steps:
①: Compile and replace encrypted libmono.so
②: Export Android Project
③: Encrypt and replace Assembly-csharp.dll
④: Export apk with tools such as Eclipse
first of all, please refer to my " compilation libmono.so record "
Then the project is exported Cheer Zhuo Project, found under the Xxx/assets/bin/data/managed Assembly-csharp.dll, and then write a file read-write program to destroy the C # assembly structure, so as to achieve the purpose of the Assembly is not open
The sample program code is as follows:
1#include <stdio.h>2 3 #defineMaxLen 10244 5 voidMain ()6 {7 8FILE * outfile, *infile;9 Teninfile = fopen ("Assembly-csharp.dll","RB"); One Aoutfile = fopen ("Assembly-csharp-tmp.dll","WB" ); - -UnsignedCharBuf[maxlen]; the - if(outfile = = NULL | | infile = =NULL) - { - return; + } - + intRC; A int_index =0; at while(rc = Fread (BUF,sizeof(unsignedChar), maxlen,infile)! =0 ) - { - if(_index = =0) -buf[0] +=1; -Fwrite (BUF,sizeof(unsignedChar), RC, outfile); -_index++; in } - to fclose (infile); + - fclose (outfile); the * return; $}
By running the encryption program, you will get an output file Assembly-csharp-tmp.dll, this is the encrypted file, is no longer a C # assembly. Replace the original Assembly-csharp.dll, you can achieve the effect of encryption, with the decryption of the libmono.so packaged apk will be able to achieve the general Code encryption effect.
But we may also think of, so cumbersome replacement process, can be replaced with a key function, the answer is yes, Linux and Mac have the SH automatic packaging tutorial, then refer to my next article
One-time u3d DLL encryption record (II)
, you can get the next key package in Windows.
One-time u3d DLL encryption record (i)