如何格式化 openssl.cnf 文件中的 OID Subject Alt Name 条目
How to format an OID Subject Alt Name entry in a openssl.cnf file
我需要将以下 SAN 添加到证书中:
oid:1.2.3.4.5.5
我正常的证书创建过程是生成一个openssl.cnf文件,然后使用这个文件生成一个csr(证书签名请求),然后使用我自己的CA从csr生成一个证书。
.cnf 文件是一个纯文本文件,其中包含描述我希望包含在 csr 和 crt 中的所有 SAN 的部分。该部分如下所示:
...
[san]
DNS.1 = foo.bar
DNS.2 = baz.foobar
IP.1 = 1.1.1.1
IP.2 = 2.2.2.2
...
我试过以 3 种不同的方式插入 OID 条目:
attempt 1) OID.1 = 1.2.3.4.5.5
attempt 2) DNS.3 = 1.2.3.4.5.5
attempt 3) IP.3 = 1.2.3.4.5.5
With 1) 尝试生成证书时出现错误,表明无法识别前缀 OID
。使用 2) 和 3) 我能够生成 crt,但是当我将其放置到位时,SAN oid:1.2.3.4.5.5 不受支持。
因此,我想知道将此类条目添加到 openssl.cnf 文件的主题备用名称部分的正确语法是什么。
干杯!
来自the documentation of the config file:
otherName can include arbitrary data associated with an OID: the value should be the OID followed by a semicolon and the content in standard ASN1_generate_nconf format.
Examples:
subjectAltName=otherName:1.2.3.4;UTF8:some other identifier
或者以你的 SAN 部分为例,它应该是
subjectAltName=@san
[san]
DNS.1=foo.example.com
DNS.2=bar.example.com
otherName.1=1.2.3.4;UTF8:some other identifier
根据 Steffen Ullrich 的回答,此版本在完整示例中正确指定了 OID 标识符:
subjectAltName=@san
[san]
DNS.1=foo.example.com
DNS.2=bar.example.com
RID.1=1.2.3.4.5.5
或者,在一行中执行:
subjectAltName=DNS:foo.example.com,DNS:bar.example.com,RID:1.2.3.4.5.5
这在与 https://security.stackexchange.com/a/91556 结合使用时特别有用,可以在不使用 .cnf 文件的情况下将 -config
选项传递给 CLI。
我需要将以下 SAN 添加到证书中:
oid:1.2.3.4.5.5
我正常的证书创建过程是生成一个openssl.cnf文件,然后使用这个文件生成一个csr(证书签名请求),然后使用我自己的CA从csr生成一个证书。
.cnf 文件是一个纯文本文件,其中包含描述我希望包含在 csr 和 crt 中的所有 SAN 的部分。该部分如下所示:
...
[san]
DNS.1 = foo.bar
DNS.2 = baz.foobar
IP.1 = 1.1.1.1
IP.2 = 2.2.2.2
...
我试过以 3 种不同的方式插入 OID 条目:
attempt 1) OID.1 = 1.2.3.4.5.5
attempt 2) DNS.3 = 1.2.3.4.5.5
attempt 3) IP.3 = 1.2.3.4.5.5
With 1) 尝试生成证书时出现错误,表明无法识别前缀 OID
。使用 2) 和 3) 我能够生成 crt,但是当我将其放置到位时,SAN oid:1.2.3.4.5.5 不受支持。
因此,我想知道将此类条目添加到 openssl.cnf 文件的主题备用名称部分的正确语法是什么。
干杯!
来自the documentation of the config file:
otherName can include arbitrary data associated with an OID: the value should be the OID followed by a semicolon and the content in standard ASN1_generate_nconf format.
Examples:
subjectAltName=otherName:1.2.3.4;UTF8:some other identifier
或者以你的 SAN 部分为例,它应该是
subjectAltName=@san
[san]
DNS.1=foo.example.com
DNS.2=bar.example.com
otherName.1=1.2.3.4;UTF8:some other identifier
根据 Steffen Ullrich 的回答,此版本在完整示例中正确指定了 OID 标识符:
subjectAltName=@san
[san]
DNS.1=foo.example.com
DNS.2=bar.example.com
RID.1=1.2.3.4.5.5
或者,在一行中执行:
subjectAltName=DNS:foo.example.com,DNS:bar.example.com,RID:1.2.3.4.5.5
这在与 https://security.stackexchange.com/a/91556 结合使用时特别有用,可以在不使用 .cnf 文件的情况下将 -config
选项传递给 CLI。