为 android 创建 .crt

问题描述 投票:0回答:2

我想创建一个 .crt 文件,当我在手机上使用 fiddler 时,该文件将信任 https。我发现很少有网站,但它们生成 .cert 而不是 .crt。

内容是这样的

-----BEGIN CERTIFICATE-----
MIICzzCCAbegAwIBAgIJALgjZQpOGGEAMA0GCSqGSIb3DQEBBQUAMBgxFjAUBgNV
BAMTDTE5Mi4xNjguMi4xMTcwHhcNMjAxMjAzMDEwOTU1WhcNMzAxMjAxMDEwOTU1
WjAYMRYwFAYDVQQDEw0xOTIuMTY4LjIuMTE3MIIBIjANBgkqhkiG9w0BAQEFAAOC
AQ8AMIIBCgKCAQEA1qpC9Ofh1nS2/l/4g1AFCjR5KmIknL0lsOFCitOqxybCQzwP
x8Xe0Vp+/rRiwoGBkhi06RBUsDftvomZwIfCUvrYgDef4RiJeVsKX347uTl3SVxO
fCkWQm+/nV0eXLLApGRp5O1/vbqGvfs0o5ct2SBvdooQaIPcY/RFiwpydtYnep5V
9zZkyU1J6K5MnYowsBCxcx+BmA5bxroPTLl31/8TRdzW6Pye3o46Qkfj5Vut3v4M
AG3ZTqMvuAJ+eJl+4C+Oy0nT91ZDw7Kaw/FzaeAmpGAQY9Em9zZ3as1QRYoqY8eK
C8rXkx6iJH0pSgXGbug/f7zH/G/SYeUUwMQNZwIDAQABoxwwGjAYBgNVHREEETAP
gg0xOTIuMTY4LjIuMTE3MA0GCSqGSIb3DQEBBQUAA4IBAQCs+a+IKVyBAoaCz002
7lX02WAUo+QXgmTTUudw8fGOIKLpd1si4IT6+YHgiCFUx0scFsIYfvAgbXP9zbDa
/lWjHBnp98KkxCoP4tMnfQOmLMX5chc+EP+frg/uQOoQ8gaLAxONJGKYOmCbfb+2
TB+5jrZO3TmSUICgI99L8UMyfRy5kM2LbCo4ONteRpTHyIoB807n2eEiKdD9nWLq
sx4fwhY5ypqCyalCmd98iKJgV6P5jp0Hu4hAYyhckSlmvV98A6LJ0m3RECCwfxS7
O2s1+I+7o4ywCXR6pGs/rp6jKyq8JSk/iuSBHDfg70sgl9cyyyZLE0JItPVgDxVE
zucV
-----END CERTIFICATE-----

但是这种格式不起作用。我需要一个类似于 this

的 .crt

谢谢

certificate ssl-certificate
2个回答
1
投票

这是 pem(base64) 编码的证书,您需要的只是 der(二进制) 编码。 您可以使用 openssl 来转换它:

     openssl x509 -outform der -in <yourcert.crt> -out <out.crt>

与扩展无关。您可以根据需要使用 .cer .der .pem 或 .crt 重命名。


0
投票

-----开始证书----- MIIDBDCCAqmgAwIBAgIUFCvW1CIKJIt3Tn7VZlUIcu25/yQwCgYIKoZIzj0EAwIweDELMAkGA1UE BhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCVBhbG8gQWx0bzEVMBMGA1UECgwM U2hhZG93cm9ja2V0MSkwJwYDVQQDDCBTaGFkb3dyb2NrZXQgMjAyNC0wNC0xNSAyMTo1NToyMzAe Fw0yNDA0MTUxNDU1MjNaFw0zNDA0MTMxNDU1MjNaMHgxCzAJBgNVBAYTALVTMRMwEQYDVQQIDApD YWxpZm9ybmlhMRIweAYDVQQHDAlQYWxVIEFsdG8xFTATBgNVBAoMDFNoYWRvd3JvY2tldDEpMCcG A1UEAwwgU2hhZG93cm9ja2V0IDIwMjQtMDQtMTUgMjE6NTU6MjMwWTATBgcqhkjOPQIBBggqhkjO PQMBBwNCAAQUB458RJHyCACNWW8KaRgnjEXspsNM2NsRrVWlGxQzjpN5dPAp5tWKn+2wPD41Zfn5 胡+ir7J3UjlSniMRuQFEo4IBDzCCAQswDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYw HQYDVR0OBBYEFIkpuC3pnpe/Yfn51DfSYLuaasSnMIG1BgNVHSMEga0wgaqAFIkpuC3pnpe/Yfn5 1DfSYLuaasSnoXykejB4MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTESMBAGA1UE BwwJUGFsbyBBbHRvMRUwEwYDVQQKDAxTaGFkb3dyb2NrZXQxKTAn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