使用 SubjectAltName 'OtherName' 在 openSSL 中创建 CSR 时出错



我在尝试创建使用v3_req扩展的CSR时收到错误

我收到的错误是:

Error Loading request extension section v3_req
37232:error:0D06407A:asn1 encoding routines:a2d_ASN1_OBJECT:first num too large:./crypto/asn1/a_object.c:109:
37232:error:22075093:X509 V3 routines:v2i_GENERAL_NAME_ex:othername error:./crypto/x509v3/v3_alt.c:502:
37232:error:22098080:X509 V3 routines:X509V3_EXT_nconf:error in extension:./crypto/x509v3/v3_conf.c:93:name=subjectAltName, value=otherName:Principal Name;UTF8:1999999999123456@test

我的openSSL cnf部分看起来像:

[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = otherName:UTF8:Principal Name = 1999999999123456@test

我试图完成的是创建一个csr(我的脚本和cnf的其他一切都很好,只是在添加SAN部分时(,它有一个其他名称的SAN和"主体名称",在查看证书字段时会是这样

Other Name: Principal Name = 1999999999123456@test

我认为v3_req和otherName设置部分不正确,但我找不到有关SAN/otherName自定义字段使用的正确文档。如果我将其与DNS或IP一起使用,它会像你所期望的那样工作。

在查看Steffen Ullrich提到的文档并检查格式后,添加alt名称的正确格式是:

[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = otherName:1.3.6.1.4.1.311.20.2.3;UTF8:1999999999123456@TEST

我在配置文件中有unicode空格和其他东西,这当然把一切都搞砸了。为了防止有人怀疑类似的事情,这个命令找到了他们:

pcregrep --color='auto' -n "[x80-xFF]"从这里。

最新更新