RFC 5280允许哪些字符在DN中?

问题描述:

我一直在分析几个RFC 5280的角落案例时遇到了一些麻烦(我的ASN.1不太符合规范)。RFC 5280允许哪些字符在DN中?

首先,作为RDN字段的一部分,允许使用单独的逗号吗?逗号是共同的,即

CN=Wingdings, Inc

但就像

CN=,有效的名字吗?

其次,RFC允许空字段名称,如CN=

+0

你有没有考虑......阅读RFC? –

+0

那么,正如我所说,我的ASN.1并不那么热。是的。 – mikek

+0

什么RFC告诉你这个? –

的RFC说,这(。第4.1.2.4)

Name ::= CHOICE { -- only one possibility for now -- 
    rdnSequence RDNSequence } 

    RDNSequence ::= SEQUENCE OF RelativeDistinguishedName 

    RelativeDistinguishedName ::= 
    SET SIZE (1..MAX) OF AttributeTypeAndValue 

    AttributeTypeAndValue ::= SEQUENCE { 
    type  AttributeType, 
    value AttributeValue } 

    AttributeType ::= OBJECT IDENTIFIER 

    AttributeValue ::= ANY -- DEFINED BY AttributeType 

再后来(附录A)

-- Naming attributes of type X520CommonName 

id-at-commonName  AttributeType ::= { id-at 3 } 

-- Naming attributes of type X520CommonName: 
-- X520CommonName ::= DirectoryName (SIZE (1..ub-common-name)) 
-- 
-- Expanded to avoid parameterized type: 
X520CommonName ::= CHOICE { 
     teletexString  TeletexString (SIZE (1..ub-common-name)), 
     printableString PrintableString (SIZE (1..ub-common-name)), 
     universalString UniversalString (SIZE (1..ub-common-name)), 
     utf8String  UTF8String  (SIZE (1..ub-common-name)), 
     bmpString   BMPString  (SIZE (1..ub-common-name)) } 

从此我推断:

  1. 一个CN值必须至少有一个字符。

  2. 几乎任何字符在CN中都是有效的。

因此,不允许使用“CN =”,但允许使用“CN =”。

(无论你想考虑“”作为一个接受共同的名字是一个不同的问题,但至少它不是由语法规则禁止的)

警告:以上是基于粗略阅读RFC和一些侧面研究作为完整性检查。我不是X.500/520或ASN.1专家。