我试图配置Titanium Web代理以使用我自己的SSL证书(好的,我需要再次生成我的证书,因为我刚删除它们)。
首先:我的用例工作正常,我需要拦截
https
流量和 我在.NET Core应用程序中设置了Titanium。它生成和 配置/安装了" rootCert.pfx"文件,我可以拦截https
流量。参考:https://github.com/justcoding121/Titanium-Web-Proxy/wiki#custom-root-certificates
引用的页面说我可以使用代理服务器上的RootCertificate
属性设置自定义根证书。
所以我创建了一个证书:
openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout localhost.key -out localhost.crt
将其转换为pfx
:
openssl pkcs12 -export -out localhost.pfx -inkey localhost.key -in localhost.crt
将其复制到输出目录并将其配置为RootCertificate
。
但现在我的浏览器会说出任何https请求:
ERR_CONNECTION_CLOSED
我尝试双击并安装crt
文件,但这没有帮助..
我在这里丢失了哪些证书。为了让事情变得更复杂,GenericCertificate
类上还有ExplicitProxyEndPoint
属性...如果我在那里配置了根证书,那么我的浏览器会返回:
ERR_CERT_AUTHORITY_INVALID
非常感谢任何指导或提示!
创建 CA密钥: customCA.key
openssl genrsa -des3 -out customCA.key 2048
创建 CA根证书: customCA.pem
openssl req -x509 -new -nodes -key customCA.key -sha256 -days 1825 -out customCA.pem
信任 CA根证书:导入 customCA.pem
创建 localhost密钥: localhost.key
openssl genrsa -out localhost.key 2048
创建 localhost签名请求: localhost.csr
openssl req -new -key localhost.key -out localhost.csr
创建自定义分机选项: localhost.ext
[ req ] default_bits = 2048 default_keyfile = customCA.pem distinguished_name = req_distinguished_name req_extensions = v3_req x509_extensions = v3_ca [req_distinguished_name] C = [Press Enter to Continue] C_default = US C_min = 2 C_max = 2 O = [Press Enter to Continue] O_default = default 0.OU=[Press Enter to Continue] 0.OU_default = default 1.OU=[Press Enter to Continue] 1.OU_default = PKI 2.OU=[Press Enter to Continue] 2.OU_default = ABCD commonName = Public FQDN of server commonName_max = 64 emailAddress = [Press Enter to Continue] emailAddress_default = myEmail@email.com [ v3_req ] basicConstraints = CA:TRUE keyUsage = digitalSignature, nonRepudiation, keyEncipherment [ v3_ca ] subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:always,issuer:always subjectAltName = email:myEmail@email.com issuerAltName = issuer:copy
创建签名的本地主机证书: localhost.crt
openssl x509 -req -in localhost.csr -CA customCA.pem -CAkey customCA.key -CAcreateserial -out localhost.crt -days 1825 -sha256 -extfile localhost.ext
将签名的本地主机证书从crt
转换为pfx
: localhost.pfx
openssl pkcs12 -export -out localhost.pfx -inkey localhost.key -in localhost.crt
现在,如果我将localhost.pfx
指定为代理服务器的RootCertificate
(由于它由customCA
签名,我假设它将被信任这是一个值得信赖的权威机构)我仍然得到:
ERR_CONNECTION_CLOSED
我开始对RootCertificate
和Certificate Authority
感到困惑。似乎代理服务器需要两者兼而有之?