ph4r05 / Whitebox-crypto-AES

Whitebox AES implementation in C++. Chow, Karroumi.
https://is.muni.cz/th/325219/fi_m/
337 stars 112 forks source link

External encodings don't work with serialization #6

Closed doegox closed 8 years ago

doegox commented 8 years ago

External encodings are not serialized when saving tables and are regenerated randomly whenever tables are loaded. So currently --extEnc=1 and --create-table/--load-tables are incompatible options. It would be nice to support serialization with external encodings. Thanks. Phil

ph4r05 commented 8 years ago

Thanks for reporting! I will take a look.

ph4r05 commented 8 years ago

Thanks for suggestion, you are right, it would be nice.

This is my reasoning: ExtEncoding can be serialized to a file together with WBAES. WBAES was generated with ExtEncoding embedded and it expects input data to be already processed by ExtEncoding. To keep things separated, WBAES should not "know" about ExtEncoding that it used with it, so the serialization should not be done by WBAES object itself, to keep it simple, to abstract from generator logic and so on.

So I've added serialization to the WBAESGenerator, which serializes WBAES and ExtEncoding to the same file. When using main, it uses now this new way of serialization.