charles 证书在 andriod 7 及更高版本手机上的安装

一 下载好证书

   导出charles .pem证书 :help --> SSL Proxying --> Save Charles Root Certificate…
image.png

二 电脑上安装 openssl

sudo apt-get install openssl
sudo apt-get install libssl-dev

三 执行命令

openssl x509 -subject_hash_old -in charles.pem # charles.pem 证书名称

返回结果

3fc3c81b
-----BEGIN CERTIFICATE-----
MIIFVDCCBDygAwIBAgIGAXaDt1ejMA0GCSqGSIb3DQEBCwUAMIGtMT4wPAYDVQQD
DDVDaGFybGVzIFByb3h5IENBICgyMSDljYHkuozmnIggMjAyMCwgREVTS1RPUC1W
UTNRRzdGKTElMCMGA1UECwwcaHR0cHM6Ly9jaGFybGVzcHJveHkuY29tL3NzbDER
MA8GA1UECgwIWEs3MiBMdGQxETAPBgNVBAcMCEF1Y2tsYW5kMREwDwYDVQQIDAhB
dWNrbGFuZDELMAkGA1UEBhMCTlowIBcNMDAwMTAxMDAwMDAwWhgPMjA1MDAyMTcw
NTEzMTlaMIGtMT4wPAYDVQQDDDVDaGFybGVzIFByb3h5IENBICgyMSDljYHkuozm
nIggMjAyMCwgREVTS1RPUC1WUTNRRzdGKTElMCMGA1UECwwcaHR0cHM6Ly9jaGFy
bGVzcHJveHkuY29tL3NzbDERMA8GA1UECgwIWEs3MiBMdGQxETAPBgNVBAcMCEF1
Y2tsYW5kMREwDwYDVQQIDAhBdWNrbGFuZDELMAkGA1UEBhMCTlowggEiMA0GCSqG
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCKspbctZr6eJtj4oL+MEb0ZLqJqH6byshW
YgVhmkX7g4qgwsBi/OD0c3YYg4bCcPkgrwsCQd/39/ef1ngNRAcJ3nAXsCjKLd1K
MMRwUaFHFPfrJW08T+KZiMJDVWtOFGP+Yw75tbwmC94nFmkoyrFZkZw4DMgC0M9V
p2622HxlfL/FVuh009hgKvZFL19ifDRaxZCKcK2YeDg4x/mrwZFbFNYV2MXztXcT
f/3Pds5+BvQcHCRi9/XSx7QvJOGHxiLeelwamxbNxbfja6/QKK6iroqyOgF4fIO6
rB0IYY2BaMcufa2IKC0KK2M3bQEyEGdTvs/xrpCJvBOW/IzfN7lVAgMBAAGjggF0
MIIBcDAPBgNVHRMBAf8EBTADAQH/MIIBLAYJYIZIAYb4QgENBIIBHROCARlUaGlz
IFJvb3QgY2VydGlmaWNhdGUgd2FzIGdlbmVyYXRlZCBieSBDaGFybGVzIFByb3h5
IGZvciBTU0wgUHJveHlpbmcuIElmIHRoaXMgY2VydGlmaWNhdGUgaXMgcGFydCBv
ZiBhIGNlcnRpZmljYXRlIGNoYWluLCB0aGlzIG1lYW5zIHRoYXQgeW91J3JlIGJy
b3dzaW5nIHRocm91Z2ggQ2hhcmxlcyBQcm94eSB3aXRoIFNTTCBQcm94eWluZyBl
bmFibGVkIGZvciB0aGlzIHdlYnNpdGUuIFBsZWFzZSBzZWUgaHR0cDovL2NoYXJs
ZXNwcm94eS5jb20vc3NsIGZvciBtb3JlIGluZm9ybWF0aW9uLjAOBgNVHQ8BAf8E
BAMCAgQwHQYDVR0OBBYEFIM6eRnkArOUvy4XNJStpCnAJ9EcMA0GCSqGSIb3DQEB
CwUAA4IBAQAqy0MHlQigCwKW4zz3/1QSh7SEqLEfUhasUS3eqmdF7cJCjsr7/Q+M
cPj4krRvsV/9SMXTp6sfCJInNwWw8gZx0wPnSnmq41XtcaAE2qjJ1HAghmsfxwXd
Fj+Ws1qIqA8cnlCrV6fkBsfoM4G45djDc2lKKW5dzU6jjzIp4firYIPB/zZbc9y2
98evRXGEOlScoAA3Vf12YJbq/J6ZYN2GMJuapifO9SStJ8eoP/pz7nzkdJieGG6f
mW39pTgwSo99jlpQQX+v+Rp5rw1ahfhld2noEgSzORoTIvZYEpsAJWMehlM4FS0v
/fZoA46w8U44rk8GA8e3UxRpR1cfQTpu
-----END CERTIFICATE-----

然后把你的证书重命名以签证后的 3fc3c81b 命名且以".0结尾" 3fc3c81b.0

四 传到手机 /system/etc/security/cacerts/ 目录下

adb shell 
su

输入下面两个步骤:

mount -o rw,remount -t auto /
chmod 777 /system

然后 把刚刚签证后的证书 3fc3c81b.0 cp 到 /system/etc/security/cacerts/

我用adb 直接push到 /system/etc/security/cacerts/ 会有权限问题, 后来我先存到了/data/local/tmp 目录下,然后在move过去。

adb push /Users/wz_mac/Desktop/3575b71a.0   /data/local/tmp/

/data/local/tmp   # 当前目录下 执行

mv  3fc3c81b.0   /system/etc/security/cacerts/ 

最后

chmod 777 3fc3c81b.0

你可能感兴趣的:(charles 证书在 andriod 7 及更高版本手机上的安装)