android 安裝CA證書
提取證書
計算證書的hash值
C:\Users\czl\Downloads>"C:\Program Files\Git\usr\bin\openssl.exe" x509 -inform PEM -subject_hash_old -in charles.pem
b682a732
-----BEGIN CERTIFICATE-----
MIIFRjCCBC6gAwIBAgIGAY1GZhqIMA0GCSqGSIb3DQEBCwUAMIGnMTgwNgYDVQQD
DC9DaGFybGVzIFByb3h5IENBICgyNiBKYW4gMjAyNCwgREVTS1RPUC0zNDVKRUQ4
KTElMCMGA1UECwwcaHR0cHM6Ly9jaGFybGVzcHJveHkuY29tL3NzbDERMA8GA1UE
CgwIWEs3MiBMdGQxETAPBgNVBAcMCEF1Y2tsYW5kMREwDwYDVQQIDAhBdWNrbGFu
ZDELMAkGA1UEBhMCTlowHhcNMjQwMTI1MTUzMTUzWhcNMjUwMTI0MTUzMTUzWjCB
pzE4MDYGA1UEAwwvQ2hhcmxlcyBQcm94eSBDQSAoMjYgSmFuIDIwMjQsIERFU0tU
T1AtMzQ1SkVEOCkxJTAjBgNVBAsMHGh0dHBzOi8vY2hhcmxlc3Byb3h5LmNvbS9z
c2wxETAPBgNVBAoMCFhLNzIgTHRkMREwDwYDVQQHDAhBdWNrbGFuZDERMA8GA1UE
CAwIQXVja2xhbmQxCzAJBgNVBAYTAk5aMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
MIIBCgKCAQEAk5kXflCQy6iftia65hiJ3C5ReqDgcNTZSzLSuPejzLRg6lQv+FTp
f93DkYNHj/SmG0O4wFQweL0aH0umMHRT7YhdEZ/N6aTJheTKSQVkdp0Ob888WgSm
CbEF3LpuZUfdsyOD8wUjk4n1eQbvskWea949MK2k4Za0HtFdlhGsulQc2v0Pusn4
7qPfDq3jH9b0k49UaM1uD0Us0erATeXn1d6gqKMDeKS5yqrqOzhXHJgVtNg2pTkO
nl2OkAzuQCI477McVN43hKMf8oJiJTdIegrYA2q/OS63PuMz0cXSbUqSvqfHl12J
2yIA/Lquwsg2d794Jk9t43Ol4aut3XPkwwIDAQABo4IBdDCCAXAwDwYDVR0TAQH/
BAUwAwEB/zCCASwGCWCGSAGG+EIBDQSCAR0TggEZVGhpcyBSb290IGNlcnRpZmlj
YXRlIHdhcyBnZW5lcmF0ZWQgYnkgQ2hhcmxlcyBQcm94eSBmb3IgU1NMIFByb3h5
aW5nLiBJZiB0aGlzIGNlcnRpZmljYXRlIGlzIHBhcnQgb2YgYSBjZXJ0aWZpY2F0
ZSBjaGFpbiwgdGhpcyBtZWFucyB0aGF0IHlvdSdyZSBicm93c2luZyB0aHJvdWdo
IENoYXJsZXMgUHJveHkgd2l0aCBTU0wgUHJveHlpbmcgZW5hYmxlZCBmb3IgdGhp
cyB3ZWJzaXRlLiBQbGVhc2Ugc2VlIGh0dHA6Ly9jaGFybGVzcHJveHkuY29tL3Nz
bCBmb3IgbW9yZSBpbmZvcm1hdGlvbi4wDgYDVR0PAQH/BAQDAgIEMB0GA1UdDgQW
BBSBU1dnL8b3SUBAvu9/rSFZqE+3WTANBgkqhkiG9w0BAQsFAAOCAQEATZsxibox
9vO0TO6fSo3sJ5/l4T2+eXihWaVARkRpK3MaHO9DHThete9rlZPfk3AnatM4DM6D
COE/HZl1dSjN2vRbVSvLxIliqCm7ZkHoHxdyKhsLpGdthBiDgc7Vsr4xieIYEmjO
NCFpOqzkcQTK7ORShQPWiPEX//AL9NzamgFicmFbsvUYi3+GPJ4778Rh88w3Sd5i
yd33LWyYiKPl1pdeSOYfPxsH8XqBznqSmY+7AQqxQPh171ztZwslaOjKl3BYScD4
2MkwZD+xjx+d4Vqy4E+rx5SNpmR5USV+GKXHcNImliYb1VYDSsEyeG4qt5KPfbRz
dS6MJobm1XNlDQ==
-----END CERTIFICATE-----
將charles.pem重新命名為b682a732.0
使用adb上傳證書至android裝置
adb push b682a732.0 /sdcard/
以讀寫方式(rw)重新掛載/分割槽
adb.exe shell
mount -o remount -o rw /
使用這條命令可以臨時掛載上/system資料夾,直到下一次重啟。
將證書複製到系統安全目錄
cp /sdcard/b682a732.0 /system/etc/security/cacerts/
此命令在adb shell執行