I use a dongle to protect my executable. The dongle protects the software in two ways:
- inside the code with calls to read/write the dongle memory (for example to store functional data), to encrypt/decrypt data with an algorithm resident in the dongle. The encryption key is writable only.
- Encrypting the EXE file and using a loader that decrypts it through the dongle. If any debugger like softice is running, the software either terminates or does not start.
It would work well and make cheaper to buy the license than to crack my software and this is my only goal.
The problem is that I cannot serialize anymore! If I try, I get the following exception:
SerializationException
Source = mscorlib
Message = Unable to find assembly 'MyApp, Version=1.0.0.3, Culture=neutral, PublicKeyToken=null'.
TargetSite = System.Reflection.Assembly GetAssembly()
Stack =
System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
I must use Binary Serialization due to the nature of the data to be persistent.
How can a solve this problem?