我有包含兩個項目的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