「[[.NET 開発基盤部会 Wiki>http://dotnetdevelopmentinfrastructure.osscons.jp]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。

-[[戻る>スマホネイティブ]]

*目次 [#c8815fff]
#contents

*概要 [#k715b052]
出来ないと開発時に困るヤツ。

-基本的に、公開サーバとして配置するか、
--[[Lets’s Encrypt]]
--[[Dynamic DO!.jp]]

>(上記の組合せだと、プライベートIPがダメ)

-スマホ側で証明書の検証を無効化するしかない。

*詳細 [#s6fd8b4b]
スマホ側で証明書の検証を無効化する方法。

**iOS [#mfff7efd]

**Android [#w73a6acb]
-ネットワーク セキュリティ構成(Network Security Configuration)で設定可能。

-以下、「@」はsrc/main or debug/resフォルダ以下であることを表している模様。
-以下、「@」はsrc/(main or debug)/resフォルダ以下であることを表している模様。

-AndroidManifest.xml から network_security_config.xmlを参照する。~
(この際、拡張子があっても、定義に拡張子は含めない)
 <application
   android:name=".MyApp"
   android:networkSecurityConfig="@xml/network_security_config">

-res/xml/network_security_config.xmlファイルに以下を設定する。~
(配置するファイルに、拡張子はあっても良い)

--main~
特定ドメインに対して証明書を許可。
 <?xml version="1.0" encoding="utf-8"?>
 <network-security-config>
   <domain-config>
     <domain includeSubdomains="true">example.com</domain>
     <trust-anchors>
       <certificates src="@raw/my_ca"/>
     </trust-anchors>
   </domain-config>
 </network-security-config>

--debug~
debugなBuild Variantsで証明書を許可。

---main側~
空の設定を置いておく。
 <?xml version="1.0" encoding="utf-8"?>
 <network-security-config>
 </network-security-config>

---debug側~
 <?xml version="1.0" encoding="utf-8"?>
 <network-security-config>
   <debug-overrides>
     <trust-anchors>
       <certificates src="@raw/my_ca"/>
     </trust-anchors>
   </debug-overrides>
 </network-security-config>

-res/raw/my_ca にPEM または DER 形式の~
自己署名証明書または非パブリック CA 証明書を追加。
--通常時はsrc/main/res/raw/my_ca
--debug時はdebug/res/raw/my_ca
--同様に、証明書に拡張子があっても定義に拡張子を含めない。
--実際に配置するファイルに拡張子はあっても良い。

-証明書以外に、system、userの文字列を設定可能。
--system:プリインストールされたシステムの CA 証明書。
--user:/system/etc/security/cacerts以下に追加した証明書

*参考 [#x73ca562]

**iOS [#r7d65f74]

**Android [#ub3d826a]
-Google Developers Japan: Android Nougat における認証局の変更~
https://developers-jp.googleblog.com/2016/08/android-nougat-ca-change.html
--ネットワーク セキュリティ構成 | Android デベロッパー | Android Developers~
https://developer.android.com/training/articles/security-config?hl=ja

-Network Security Configurationについて - Android N - リスクファインダーブログ~
https://blog.riskfinder.co.jp/2016/03/network-security-configuration-android-n.html

-AndroidのプレインストールされたCAにCAを追加する - 試運転ブログ~
https://otameshi61.hatenablog.com/entry/2017/12/03/151706

-独自証明書のインストールが許可されていないAndroid端末で、~
アプリデバッグ時にCharlesによるHTTPSトラフィック解析をする方法 - Qiita~
https://qiita.com/katz/items/d1beaeb69683948dc947

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS