1. 程式人生 > 其它 >charles 證書在 andriod 7 及更高版本手機上的安裝

charles 證書在 andriod 7 及更高版本手機上的安裝

一 下載好證書

二 電腦上安裝 openssl

三 執行命令

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