安装自签名证书不再在Android Q中运行

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

我已经生成了一个自签名证书,试图将其安装在运行Android 10的手机上,但是出现零食告诉我Private key required to install certificate

我已经在运行具有相同证书的Android 9的电话上尝试过,并且可以正常工作。

是否知道是否有任何解决方法来安装CA?

android self-signed android-10.0 self-signed-certificate
1个回答
0
投票

[我从this answer创建了可用于Android,iOS和Chrome的自签名证书的方法:

openssl命令:

openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj "/C=US/ST=Oklahoma/L=Stillwater/O=My Company/OU=Engineering/CN=test.com" -keyout ca.key -out ca.crt
openssl genrsa -out "test.key" 2048
openssl req -new -key test.key -out test.csr -config openssl.cnf
openssl x509 -req -days 3650 -in test.csr -CA ca.crt -CAkey ca.key -CAcreateserial -extensions v3_req -extfile openssl.cnf -out test.crt
openssl x509 -inform PEM -outform DER -in test.crt -out test.der.crt

openssl.cnf的内容:

[req]
default_bits = 2048
encrypt_key  = no # Change to encrypt the private key using des3 or similar
default_md   = sha256
prompt       = no
utf8         = yes

# Specify the DN here so we aren't prompted (along with prompt = no above).

distinguished_name = req_distinguished_name

# Extensions for SAN IP and SAN DNS

req_extensions = v3_req

# Be sure to update the subject to match your organization.

[req_distinguished_name]
C  = US
ST = Oklahoma
L  = Stillwater
O  = My Company
OU = Engineering
CN = test.com

# Allow client and server auth. You may want to only allow server auth.
# Link to SAN names.

[v3_req]
basicConstraints     = CA:TRUE
subjectKeyIdentifier = hash
keyUsage             = digitalSignature, keyEncipherment
extendedKeyUsage     = clientAuth, serverAuth
subjectAltName       = @alt_names

# Alternative names are specified as IP.# and DNS.# for IP addresses and
# DNS accordingly.

[alt_names]
DNS.1 = test.com

创建证书后:

  1. 将test.crt(至少在我看来不是ca.crt)安装到您的服务器并重新启动它。
  2. 将test.crt通过电子邮件发送到您的Gmail帐户,然后在您的Android设备或模拟器,然后点击以安装它。 (它将出现在设置/加密和凭据/受信任下的“用户”标签凭据。)
© www.soinside.com 2019 - 2024. All rights reserved.