私は、Visual Studio 2015 Update 3でDotfuscator CEを使用して、.NETアセンブリを難読化しています。 パブリックタイプとメンバーはデフォルトでは難読化されていません。 Friend Classes in Exclusionリストをどのように追加して難読化するべきでないかを知りたいのですが、興味がありますか?難読化の除外リストにフレンドクラスを追加
私のDLLを難読化するために使用している設定ファイルファイルは次のとおりです。
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.3.dtd">
<dotfuscator version="2.3">
<propertylist>
<property name="SourceDirectory" value="This Path Will Be Replaced By Visual Studio" />
<property name="SourceFile" value="This Filename Will Be Replaced By Visual Studio" />
</propertylist>
<global>
<option>quiet</option>
</global>
<input>
<asmlist>
<inputassembly refid="e4ca1ab5-26cb-4ab7-9621-87063f75a38f">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${SourceDirectory}" name="${SourceFile}" />
</inputassembly>
</asmlist>
</input>
<output>
<file dir="${SourceDirectory}" />
</output>
<renaming>
<option>xmlserialization</option>
<mapping>
<mapoutput overwrite="true">
<file dir="${SourceDirectory}\Dotfuscated" name="Map.xml" />
</mapoutput>
</mapping>
<referencerulelist>
<referencerule rulekey="{6655B10A-FD58-462d-8D4F-5B1316DFF0FF}" />
<referencerule rulekey="{7D9C8B02-2383-420f-8740-A9760394C2C1}" />
<referencerule rulekey="{229FD6F8-5BCC-427b-8F72-A7A413ECDF1A}" />
<referencerule rulekey="{2B7E7C8C-A39A-4db8-9DFC-6AFD38509061}" />
<referencerule rulekey="{494EA3BA-B947-44B5-BEE8-A11CC85AAF9B}" />
<referencerule rulekey="{89769974-93E9-4e71-8D92-BE70E855ACFC}" />
<referencerule rulekey="{4D81E604-A545-4631-8B6D-C3735F793F80}" />
</referencerulelist>
</renaming>
<sos mergeruntime="true">
<option>version:v4</option>
<option>sendanalytics</option>
<option>dontsendtamper</option>
</sos>
<smartobfuscation>
<smartobfuscationreport verbosity="all" overwrite="false" />
</smartobfuscation>
</dotfuscator>
実際に私はFriendアクセス指定子を持つModelクラスを持っています。私はそのオブジェクトをPostAsJsonAsyncメソッド経由で投稿します。ここで
Dim result As HttpResponseMessage = client.PostAsJsonAsync(APIEndPoints.LOGIN, _LoginModel).Result
友達クラスです:要求とモデルを受け取る
Friend Class LoginModel
Public AccessKey As String
Public Password As String
End Class
API方法:APIがあまりにも要求してLoginModelを受信すると
[HttpPost]
[Route("authenticate")]
public async Task<JsonResult> Authenticate([FromBody] LoginViewModel lvm)
// Here lvm.Accesskey is null
、そのフィールドはNULLです。 LoginModelをpublicにすると、それが動作します。 注:これは私のDLLを難読化するときにのみ起こります。そうでなければ、実装はフレンドクラスでも機能します。
注:フレンドクラスはVB.Netで一般的です。アセンブリ内でアクセスされるとパブリッククラスのように機能しますが、アセンブリの外ではプライベートクラスです。
詳細は@Joeに感謝しますが、解決策は機能しませんでした。私は詳細を提供するために私の質問を更新しています。つまり、あなたの答えに記載されている除外ルールは、Friend Classesが難読化されることを排除しませんでした。 –
Idasmで難読化されたDLLを見ると、フレンドクラスのパブリックデータメンバーが名前aとbに難読化されていることがわかります。 –
@AzazulHaq私はあなたの説明を踏まえて別の回答を掲載しました。 –