openssl - 如何创建自己的扩展验证证书以显示绿色条?

标签 openssl certificate ssl-certificate x509certificate digital-certificate

我创建了一个根,一个中间证书。然后我签署了我的扩展证书,但没有。

我向浏览器和计算机的 keystore 添加了根证书和中间证书。

我看到“安全”这个词,但我想在绿色栏中看到我的名字。

使用 OpenSSL 生成一个扩展证书的策略是什么?

certificatePolicies=ia5org,1.2.3.4,1.5.6.7.8,@polsect
 [polsect] 
policyIdentifier = 1.3.5.8 
CPS.1="https://jitc.rahmican.com.tr";
userNotice.1=@notice 
[notice] 
explicitText="Explicit Text Here"
 organization="rahmican ltd sti" 
noticeNumbers=1,2,3,4

我在 openssl conf 文件中使用了以下内容,但没有。

你能帮我吗?

最佳答案

首先,您必须遵守 CA Browser EV Guidelines :

  • 您的证书需要符合 DV(域验证)规则,我们在这里知道没关系,因为您的浏览器显示“安全”,即使未显示 EV 绿色条
  • 您需要添加以下 EV 扩展名:2.23.140.1.1
  • 您需要添加证书实践声明,扩展名为 2.16.840.1.114412.2.1
  • 以及其他一些内容,在 DigiCert 的以下文档的 EV 列中得到了最好的描述:https://www.digicert.com/wp-content/uploads/2018/01/Certificate-Profiles.pdf

  • 那些其他的东西很容易遵守,因为 DV 证书已经需要它们,或者您可以更新 openssl 配置以添加那些不需要或禁止的 DV 证书。
    在这些附加的东西中,有些是可选的,但下面 3 个关于 DN 的不是,所以你必须在主题的 DN 中添加这些信息。您在创建 CSR 时使用 openssl 添加它们。例如:
    openssl req -config openssl-EV.cnf -new -days 365 -pubkey -key key.pem -subj "/businessCategory=Private/serialNumber=5157550/jurisdictionC=US/CN=fenyo.net/O=FenyoNet/C=FR" -nodes > csr.pem
    
    EV 证书的重要部分如下:/businessCategory=Private/serialNumber=5157550/jurisdictionC=US那些 3 需要 DN 中的属性(businessCategory、serialNumber 和ictionaryC)必须存在。但是openssl 可能不知道businessCategory 和辖区C 的OID。因此,像这样填写 openssl 配置文件的 new_oids 部分:
    [ new_oids ]
    businessCategory = 2.5.4.15
    jurisdictionC = 1.3.6.1.4.1.311.60.2.1.3
    
    在 CSR 中拥有这些属性是不够的,因为您拥有自己的 CA,并且 CA 根据 CA 策略过滤并删除 CN 的某些属性。您肯定会运行类似的东西来签署证书:
    openssl ca -verbose -in csr.pem -extensions v3_ca -out newcert.pem -config openssl-EV.cnf
    
    如果您的 openssl 配置文件不是专门为 EV 证书设计的,则此步骤肯定会过滤您在 CSR 中主题的 DN 中添加的其他属性。因此,您必须更改 openssl 配置文件以将这些属性保留在签名证书中。为此,在openssl配置文件的CA部分找到policy字段,例如policy_match,进入对应部分(本例中为[policy_match]),在该部分添加如下条目(不要删除此部分中已有的内容):
    [ policy_match ]
    businessCategory = optional
    serialNumber = optional
    jurisdictionC = optional
    
    如果在 CSR 中找到这些属性,这将使“openssl ca”输出这些属性。
    现在,请注意符合这些 CA Browser EV 指南是 不是 充足的。许多浏览器添加了其他需求。例如,CA 浏览器 EV 指南验证使用 CRL 而不是 OCSP 的 EV 证书(CA Brower 说:如果证书未在 authorityInformationAccess 扩展中指定 OCSP 响应者位置,则订户证书中必须存在 cRLDistribution Point 扩展。)。但相反,Firefox 添加了许多其他规则,包括 OCSP 响应程序的可用性。
    Firefox 执行多项测试以确定服务器的证书是否是有效的 EV 证书。如果证书通过这些测试,Firefox 将显示新的 EV UI 元素。具体来说,证书必须通过以下所有测试。
    这些规则,来自 https://wiki.mozilla.org/CA:EV_Revocation_Checking , 是:

    In addition to EV-specific tests, the server certificate must pass all tests required for DV certificates. The certificate verification engine used in Firefox 3 (the NSS crypto libraries) must be able to find a valid certificate chain that extends from the server certificate to one of the EV approved root certificates that ship with Firefox. The server certificate must contain exactly one EV policy extension (OID). The server certificate may contain one or more policy extensions, but it must not contain multiple EV policy extensions. Intermediate certificates must implicitly or explicitly allow the EV policy OID listed in the server certificate. Firefox 3 will test the server certificate for revocation status using the OCSP protocol. The server certificate must contain an Authority Information Access (AIA) extension that carries an OCSP URI using the HTTP protocol. Firefox must be able to complete an OCSP request and response transaction with the given OCSP server. When an OCSP server connection fails, Firefox treats the server certificate as invalid for EV. This is true for the first check for each server certificate in a Firefox session. Firefox uses volatile caching to reduce the number of OCSP transactions performed. Firefox must be able to verify the received OCSP response. The response must confirm the server certificate is not revoked. OCSP must be enabled in the application, which is the default configuration used by Firefox. The option is called security.ocsp.enabled. At this time Firefox will not download CRLs on demand. OCSP must also work for the intermediate certificates. A failed OCSP response will result in EV treatment not being given.


    因此,要获得绿色条,您必须像之前所说的那样更新您的 openssl 配置,并修改您的 CA 组织以添加 OCSP 响应程序和其他需要将您的服务器识别为 EV 站点的浏览器所期望的内容。
    对于在您的情况下拥有 CA 和 PKI 的人,Mozilla 创建了一个在线站点来检查所有这些 EV 要求:https://tls-observatory.services.mozilla.com/static/ev-checker.html
    在这个网站上:
  • 您输入服务器的名称
  • 您输入您选择的 EV 扩展名(通常为 2.23.140.1.1)
  • 您输入已签署 EV 证书的根证书,采用 PEM 格式

  • 该网站将进行测试并告诉您什么是正确的,什么是错误的。
    请注意,截至今天(2018 年 8 月 2 日),该网站速度非常慢。期待它很快就会出现。

    关于openssl - 如何创建自己的扩展验证证书以显示绿色条?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51641962/

    相关文章:

    ubuntu - 用于将 SSL 请求代理到 Sinatra 服务器的 NGINX 配置

    linux - openssl 未知选项错误

    c++ - OpenSSL 将消息拆分为两条记录

    android - apk 必须使用与之前相同的证书进行签名

    wcf - 在 Azure 托管的 WCF 服务中找不到 X.509 证书

    python-3.x - 忽略 SSL 证书验证有什么影响?

    Docker - 在构建期间可访问的配置文件

    c - 没有填充的OpenSSL RSA加密无法正确加密

    c++ - 如何在 openssl 的 BIGNUM 中使用负数?