LoginSignup
46
35

More than 5 years have passed since last update.

Android7からcharlesでssl通信が見れなくなった件

Last updated at Posted at 2017-05-11

問題

Charlesを使用して通信デバッグをしていたが、Android7以上の端末でssl通信が見れなくなった。

原因

どうやらネットワークセキュリティーの仕様が変わったらしい
Changes to Trusted Certificate Authorities in Android Nougat

3行まとめ

  • より安全なデフォルトを提供するためにAndroidが信頼できる認証局(CA)の仕様を変更したよ
  • Apiレベル24(Android 7)以上からだよ
  • CAを明示的に有効にしないと通信はみれないよ

対応方法

信頼できるCAを追加しましょう
https://developer.android.com/training/articles/security-config.html?hl=ja#CustomTrust

カンタン導入

デバッグだけ通信を見れる様にする

1. AndroidManifestの<application>に下記を追加

android:networkSecurityConfig="@xml/network_security_config"

2. network_security_config.xmlres/xml/に追加

<network-security-config>
    <base-config>
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
    <debug-overrides>
        <trust-anchors>
            <certificates src="user" />
        </trust-anchors>
    </debug-overrides>
</network-security-config>

なにか間違いがあればコメントお願いします

46
35
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
46
35