【问题标题】:Putting extensions in a certificate in OpenSSL在 OpenSSL 中将扩展放入证书中
【发布时间】:2017-01-17 23:05:06
【问题描述】:

我需要在图片中这样的证书中添加扩展名,我尝试了很多方法,但我不能。

我在跑步:

"#openssl req -new  -keyout $nomerepre.key -out $nomerepre.csr -passin pass:$senha -config myconfig.cnf"

"#openssl x509 -req  -days 365  -in $nomerepre.csr -CA ca.crt -CAkey ca.key -set_serial 10102014 -out $nomerepre.crt -passin pass:$senha -extfile myconfig.cnf  -extensions v3_req"

因此我的配置文件在下面
myconfigssl.conf

oid_section = OIDs

[ req ]
default_bits = 2048
prompt = no
encrypt_key = no
default_md = sha1
distinguished_name = dn
req_extensions = v3_req

[ OIDs ]
MyOID=2.16.76.1.3.4



    [ dn ]
    CN = John Smith
    emailAddress = john.smith@quovadisglobal.com
    O = QuoVadis Group
    C = US



[v3_req]
1.2.3.4.5.6.7.8=ASN1:UTF8String:Something
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
#subjectAltName = @alt_names

[alt_names]
MyOID = 00000000111111111112222222222233333333333444444
2.16.76.1.3.4 = 00000000111111111112222222222233333333333444444

不幸的是,结果是这样的:

【问题讨论】:

    标签: linux ssl certificate ssl-certificate


    【解决方案1】:

    我不明白为什么您没有如 EG2Oa.jpg 中所示的扩展名。你应该在那里有扩展名1.2.3.4.5.6.7.8。 SubjectAltName 已被注释,因此它不应出现在证书中。

    我尝试使用xca,它使用 OpenSSL 1.0.2d,如图所示

    我使用了这个配置

    # if it should be a separate extension
    2.16.76.1.3.4=ASN1:UTF8String:Some random data
    
    #if it should be a part of subjectAltName
    subjectAltName=@subject_alt_section
    
    [subject_alt_section]
    otherName=2.16.76.1.3.4;UTF8:Some random data
    

    我得到了这个证书


    现在一些理论。我不知道这个扩展应该放在哪里。如果它是一个单独的扩展或者它应该是 SubjectAltName 的一部分。我不知道扩展名是否应该是 UTF8String 或 OctetString 或序列。

    如果你想要一个单独的扩展,你可以使用2.16.76.1.3.4=ASN1:UTF8String:Some random data,就像你已经尝试过的那样。更多关于任意扩展的信息请见here

    根据oid 的the description,这个扩展可以是subjectAltName 的一部分。 otherName 的定义见RFC5280 in section 4.2.1.6。如果是这样,那么这个配置对我有用

    subjectAltName=@subject_alt_section
    
    [subject_alt_section]
    otherName=2.16.76.1.3.4;UTF8:Some random data
    

    使用上面提到的配置,我得到了证书的结构,如下图所示。 ASN1Editor 用于显示结构。

    【讨论】:

      猜你喜欢
      • 2012-04-18
      • 2016-06-07
      • 2021-11-11
      • 1970-01-01
      • 2012-07-16
      • 2014-06-08
      • 2016-12-28
      • 1970-01-01
      • 2012-06-03
      相关资源
      最近更新 更多