I am also interested in zip encryption, I plan to make it a built-in feature to CEF Python, I've been also looking at
WBEA sources some time ago, as I remember it uses
AES encryption.
It seems simple in .NET, an exmple of creating an encrypted zip:
http://www.componentace.com/zip-aes-enc ... -sharp.htmWBEA uses a very
simple and optimized library, there are only 2 files:
AES.h and
AES.cpp.
The tool for encrypting is quite simple, see source at WBEA/app/encrypt/encrypt.cpp:
- Code: Select all
... reading in_buf.....
AES aes;
aes.SetParameters(key_length);
aes.StartEncryption((unsigned char*)key);
aes.Encrypt(in_buf, out_buf, num_blocks);
FILE *out_file = fopen(argv[2], "wb");
if (out_file)
{
fwrite(out_buf, 1, size_blocks, out_file);
fclose(out_file);
}
Decrypting code can be found in WBEA/app/resource_util.cpp:
- Code: Select all
.... reading in_buf ....
AES aes;
aes.SetParameters(key_length);
aes.StartDecryption((unsigned char*)key);
aes.Decrypt(in_buf, out_buf, num_blocks);
// Remove padding from the end of the contents.
for(; out_buf[size-1] == 0xFF; --size) ;
*out_bytes = out_buf;
*out_bytes_size = size;
It uses CefZipArchive and CefStreamReader to load the archive, see WBEA/app/wbea.cpp > WbeaHandler::LoadArchive().
I don't see WBEA using CefSchemeHandler which is strange, it uses some kind of hack, it loads this url in browser:
- Code: Select all
http://__app/index.html
And then uses RequestHandler::BeforeResourceLoad to set the content of the resource.
It probably does this hack as it uses some old version of CEF that didn't have implemented SchemeHandler as of that time.