De-serialization of data seralized before obfuscation
smuda
Posts: 24
Hi!
We have an object that we create in a software (which isn't obfuscated), serialize and save to disk. This is then distributed to the clients and is supposed to be de-serialized.
When there is no obfuscation (for example when only embedding the assembly handling this) it works fine.
However, adding the two assemblies involved to merging, even without obfuscation and flow control, it breaks the deserialization function since it cannot find the assembly referenced in the file.
What would be "best practices" to handle this scenario?
Best Regards,
John
We have an object that we create in a software (which isn't obfuscated), serialize and save to disk. This is then distributed to the clients and is supposed to be de-serialized.
When there is no obfuscation (for example when only embedding the assembly handling this) it works fine.
However, adding the two assemblies involved to merging, even without obfuscation and flow control, it breaks the deserialization function since it cannot find the assembly referenced in the file.
What would be "best practices" to handle this scenario?
Best Regards,
John
Comments
The normal procedure is to work out which classes need to be serialized, then mark them with the Serializable attribute. If you mark the type [Serializable], then SmartAssembly will not rename it or make it private. If the type gets renamed or access modifier changes to private, then this will break the serialization process.
All classes serialized are marked with the Serializable attribute already and when we created the serialized data the assemblies were strong signed.
When I use reflector on the merged assembly I can see all the classes with the Serializable attribute. When I'm testing they are unobfuscated and there is no control flow obfuscation.
Is there a "redirection functionality" which is supposed to handle redirection from the original filename and public key to the new assembly?
Best Regards,
John
In your case, the solution would be to create a SerializationBinder to map between the two assemblies in the merged assembly.
Just wanted to say that using a SerializationBinder worked perfectly.
Thank you for your help!
Best Regards,
John