gpt4 book ai didi

android - 生成和安装 SSL 证书

转载 作者:可可西里 更新时间:2023-11-01 18:49:08 25 4
gpt4 key购买 nike

当我成功将我的自定义 SSL 证书添加到 Android 6 模拟器时,我觉得我破解了原子(我对 system.img 文件进行了持续更改)。但是浏览器无法以任何方式识别它。我关注了这个很棒的 tutorial ,而且我认为我在散列方面做错了什么。以下是我所做工作的完整步骤,以及到目前为止我得到的结果。

我的系统

Windows 10、64 位
预建模拟器

  • 姓名:Nexus_64
  • API:23
  • 目标:Android 6(Android API)
  • CPU/ABI x86/64
  • 磁盘大小 3 GB

高级模拟器设置

  • 内存:512MB
  • VM 堆:128 MB
  • 内部存储空间 2 GB(从右侧的下拉菜单中选择)
  • SD 卡:工作室管理的 2 GB

系统文件

  • 从教程中获取证书文件:890c6016.0
  • c:\device_tmp 中创建用于存储系统文件的空文件夹

实用程序:

  • 模拟器 来自 /android_sdk/tools/emulator.exe
  • adb 来自 /android_sdk/platform-tools/adb.exe

我做了什么

启动模拟器:

 emulator -avd Nexus_64 -no-snapshot-load

现在它开始了,我打开命令行窗口

查找外部存储名称为 sdcard 没有足够的存储空间用于图像文件。

adb shell df 

在我的例子中 /storage/13E4-1F02/ 有 2GB 空间

安装证书

adb shell "rm /sdcard/"
adb push 890c6016.0 /sdcard/
adb shell "mount -o remount,rw /system"
adb shell "cp /sdcard/890c6016.0 /system/etc/security/cacerts/"
adb shell "chmod 644 /system/etc/security/cacerts/890c6016.0"
adb shell "dd if=/dev/block/vda of=/storage/13E4-1F02/system.img"
adb pull /storage/13E4-1F02/system.img c:/device_tmp

最后一行每行大约需要 5 分钟。之后,我通过关闭所有 shell 窗口并从 system.img 文件启动它来终止设备

emulator -http-proxy my.ip:8888 -system c:/device_tmp/system.img

当设备启动时,它的系统中就有该证书。

构建证书文件

这就是我构建证书文件的方式。我正在使用 Charlesopenssl,所以我从help->SSL-Proxing->export Charles root certificate下载了Charles证书:go.p12

制作crt

openssl pkcs12 -in go.p12 -clcerts -nokeys -out go.crt 

制作PEM

openssl pkcs12 -in go.p12 -out go.pem

获取哈希码以用作扩展名为 .0 的文件名

openssl x509 -inform PEM -subject_hash_old -in go.crt

复制go.crt并修改它的名字为我们刚刚得到的hash(890c6016.0)

type go.crt > 890c6016.0

*typecat(Mac)

的 Windows 命令

将所有签名信息附加到文件

openssl x509 -inform PEM -text -fingerprint -in go.crt -out /dev/null >> 890c6016.0

完成!

证书结果890c6016.0

成绩单内容如下:890c6016.0这也是你在运行时会得到什么:
openssl x509 -in 890c6016.0 -text -noout

890c6016.0:

-----BEGIN CERTIFICATE-----
MIIFhjCCBG6gAwIBAgIGAVThome6MA0GCSqGSIb3DQEBCwUAMIHHMVkwVwYDVQQD
DFBDaGFybGVzIFByb3h5IEN1c3RvbSBSb290IENlcnRpZmljYXRlIChidWlsdCBv
biBERVNLVE9QLTU1U01DOTMsIDI0INee15DXmSAyMDE2KTEkMCIGA1UECwwbaHR0
cDovL2NoYXJsZXNwcm94eS5jb20vc3NsMREwDwYDVQQKDAhYSzcyIEx0ZDERMA8G
A1UEBwwIQXVja2xhbmQxETAPBgNVBAgMCEF1Y2tsYW5kMQswCQYDVQQGEwJOWjAe
Fw0wMDAxMDEwMDAwMDBaFw00NTA3MjEwNzE5NTdaMIHHMVkwVwYDVQQDDFBDaGFy
bGVzIFByb3h5IEN1c3RvbSBSb290IENlcnRpZmljYXRlIChidWlsdCBvbiBERVNL
VE9QLTU1U01DOTMsIDI0INee15DXmSAyMDE2KTEkMCIGA1UECwwbaHR0cDovL2No
YXJsZXNwcm94eS5jb20vc3NsMREwDwYDVQQKDAhYSzcyIEx0ZDERMA8GA1UEBwwI
QXVja2xhbmQxETAPBgNVBAgMCEF1Y2tsYW5kMQswCQYDVQQGEwJOWjCCASIwDQYJ
KoZIhvcNAQEBBQADggEPADCCAQoCggEBALzSQjJpi+WVtoWNjFZh/jArpBMoXNfa
Y5MMuRvnMhMmt+hGnL6v5C5gSmDBwU5YZOhudbAs30J46i2Pft1CZW94AbIwCClu
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35rLMSPFWsj0pa3tZtouk7SxbiIbO/6kk6o/pZdkHf
N2RX07Snk+cQepwiBIpI8YFs9hvxf4V+yLc=
-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
01:54:e1:a2:67:ba
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN=Charles Proxy Custom Root Certificate (built on DESKTOP-55SMC93, 24 \xD7\x9E\xD7\x90\xD7\x99 2016), OU=http://charlesproxy.com/ssl, O=XK72 Ltd, L=Auckland, ST=Auckland, C=NZ
Validity
Not Before: Jan 1 00:00:00 2000 GMT
Not After : Jul 21 07:19:57 2045 GMT
Subject: CN=Charles Proxy Custom Root Certificate (built on DESKTOP-55SMC93, 24 \xD7\x9E\xD7\x90\xD7\x99 2016), OU=http://charlesproxy.com/ssl, O=XK72 Ltd, L=Auckland, ST=Auckland, C=NZ
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:bc:d2:42:32:69:8b:e5:95:b6:85:8d:8c:56:61:
fe:30:2b:a4:13:28:5c:d7:da:63:93:0c:b9:1b:e7:
32:13:26:b7:e8:46:9c:be:af:e4:2e:60:4a:60:c1:
c1:4e:58:64:e8:6e:75:b0:2c:df:42:78:ea:2d:8f:
7e:dd:42:65:6f:78:01:b2:30:08:29:6e:3f:5c:01:
8d:42:99:56:9b:7f:8b:36:3c:1d:fb:ae:88:b7:ad:
d0:cb:a9:fa:65:3f:c7:c8:96:c2:ab:38:32:12:7f:
0c:9e:2c:af:38:68:eb:02:92:07:f8:e1:66:a7:6d:
1d:b1:c7:76:ee:fe:23:b5:d5:92:4f:e5:3f:79:cc:
8a:49:a1:93:14:00:77:aa:3e:ce:bf:dd:b9:d1:d3:
a8:16:96:eb:43:e1:be:c3:b8:b5:b5:9e:73:8a:d2:
66:8b:7b:41:7c:30:69:45:40:71:40:f4:74:d0:e8:
2d:e2:ba:89:a8:90:e6:3a:59:0d:22:fe:ff:45:53:
45:71:fa:df:d3:0c:2f:36:58:97:eb:2b:d2:a9:bb:
cb:90:6d:f9:17:d7:79:85:77:94:8f:3f:1f:d3:bd:
75:f7:64:b1:e6:34:9d:b1:7c:18:be:78:74:0f:81:
cd:66:68:93:35:2f:6f:d4:ad:6f:c7:8c:11:1c:c2:
59:6d
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints: critical
CA:TRUE
Netscape Comment:
....This Root certificate was generated by Charles Proxy for SSL Proxying. If this certificate is part of a certificate chain, this means that you're browsing through Charles Proxy with SSL Proxying enabled for this website. Please see http://charlesproxy.com/ssl for more information.
X509v3 Key Usage: critical
Certificate Sign
X509v3 Subject Key Identifier:
D2:B3:4F:89:B9:22:4B:82:57:47:28:98:4A:23:DF:00:80:8C:52:0F
Signature Algorithm: sha256WithRSAEncryption
43:d4:8b:c7:83:c8:d1:98:97:f7:b6:d2:df:12:70:f7:8c:33:
75:37:e4:54:98:bf:ba:a7:1b:61:9a:73:66:cb:86:48:7a:0b:
5e:1e:b9:cc:b4:d7:54:da:9e:3f:71:d6:47:37:31:70:13:67:
c3:fd:7c:bc:c2:59:0a:2d:8c:d9:43:52:37:d2:5c:2a:10:66:
cd:b0:02:da:be:57:9f:12:d0:85:32:5a:79:ef:e3:fb:09:2c:
e2:3a:a8:25:43:a0:bb:04:f0:1e:a6:d5:8c:e7:6f:be:d5:fb:
86:ea:d4:0d:f5:1b:5e:27:1c:39:2c:ef:73:16:3c:f6:39:7c:
a1:3a:42:15:c5:8d:1a:08:4f:37:b1:f7:08:e4:42:81:eb:f3:
2c:b0:c0:49:93:12:69:a8:52:f5:ea:4f:c4:51:cb:67:32:f7:
a2:34:9a:ca:74:4d:45:82:14:76:f6:fb:47:98:8b:1e:c2:ed:
46:f0:98:72:e3:38:0e:35:31:9f:41:36:56:49:04:43:d2:ec:
6d:f9:ac:b3:12:3c:55:ac:8f:4a:5a:de:d6:6d:a2:e9:3b:4b:
16:e2:21:b3:bf:ea:49:3a:a3:fa:59:76:41:df:37:64:57:d3:
b4:a7:93:e7:10:7a:9c:22:04:8a:48:f1:81:6c:f6:1b:f1:7f:
85:7e:c8:b7

我的问题

当我从模拟器运行默认的 android 浏览器时,它说它不能信任 SSL 和类似的问题,当我运行我的应用程序时。这表明代理正在运行,但我构建的证书未被接受。我还检查了文件系统以确保。它在那里!
那么我在这里错过了什么?

编辑

我在 Genymotion 上测试了这种方法模拟器并且它工作!!!为什么 Android 模拟器不同?

最佳答案

因此,您拥有的证书是自签名证书,即证书的Issue toIssued by 具有相同的值。预计客户端会抛出它不信任证书的错误,因为在这种情况下它不知道颁发者。我不确定为什么它适用于 Genymotion。 :)

我建议您引用这个:https://android.stackexchange.com/questions/61540/self-signed-certificate-install-claims-success-but-android-acts-as-if-cert-isn

关于android - 生成和安装 SSL 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37641013/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com