我有包含两个项目的C#溶液未知物体,一个是主应用程序,另一个是许可项目。项目工作进展顺利。我已经使用json来序列化许可证的细节。现在我需要对我的授权项目进行模糊处理,以避免欺诈或黑客的攻击。我已经使用Dotfuscator
进行混淆。我已经使用了下面的行来反序列化应用程序收到的许可证详细信息。 xmlDocument.LoadXml(xml); details = xmlDocument.SelectSingleNode("/license/details"); licenseDetails = JsonConvert.DeserializeObject<LicenseDetails>(details.InnerText);
JsonConvert.DeserializeObject()返回时组件被混淆
此行在模糊处理后返回未知对象I
,但在混淆之前它工作正常。混淆前
返回值混淆后
licenseDetails == Shared.Licensing.Client.LicenseDetails
返回值
licenseDetails = I
我的XML文件是
<?xml version="1.0" encoding="utf-8"?> <license> <details>{"Product":"Outlook Templates","ProductVersion":"1.0.0.0","Username":"Demo","Serial":"1fKxUCJylsm+qVUccjUn8gYNVgDc4pE5OuqYs48vkaQ=","RegistrationDate":"\/Date(1326202832909+0200)\/","ExpirationDate":"\/Date(1330387200000)\/","PayloadEntries":[{"ValueType":2,"EntryName":"MaxNumProviders","Operation":1,"EntryValue":"3"},{"ValueType":2,"EntryName":"MaxNumQuick","Operation":1,"EntryValue":"5"},{"ValueType":2,"EntryName":"ExpirationDaysOffset","Operation":1,"EntryValue":"30"}]}</details> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI=""> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue>c/BK0YOhnW8cXUGxTJx3mpWQj1U=</DigestValue> </Reference> </SignedInfo> <SignatureValue>gWYcpr3OBhUoiPEFyWskgoRcDw5rO2RWNbMulXSXg2tsKWebEFqgptCUfr7JRvvSjm4kALyvU7mZviJI/peJWmJC69gs7QDMEOWLvrOa0TL1qyO5K5onCBZopJUdrPE0PJCVYRacasI3DvTOSo+IDEOSFVpEWZNcERhB6ZkOFrU=</SignatureValue> </Signature> </license>
我不知道混淆过程中会出现什么问题。
尝试此解决方案http://stackoverflow.com/questions/33062867/json-net-and-obfuscation,我希望这可以帮助! – SteBert 2015-10-11 08:19:47