title: Ordering of RDN attributes in a CA's certification sign process
body: <p>I have difficulties to understand the ordering of the attributes (AttributeTypeAndValue) in the RDN (RelativeDistinguishedName).</p>
  
  <p>Here are the relevant ASN.1 definitions (taken from <a href="http://www.in2eps.com/fo-pkix/tk-fo-pkix-asn1.html#cert-struc" rel="nofollow">www.in2eps.com</a>):</p>
  
  <p><strong>TBSCertificate</strong></p>
  
  <pre><code>TBSCertificate ::= SEQUENCE {
      [...]
      subject    Name,
      [...]
  }
  </code></pre>
  
  <p><strong>Name</strong></p>
  
  <pre><code>Name ::= CHOICE {
      rdnSequence RDNSequence
  }
  </code></pre>
  
  <p><strong>RDNSequence</strong></p>
  
  <pre><code>RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
  </code></pre>
  
  <p><strong>RelativeDistinguishedName</strong></p>
  
  <pre><code>RelativeDistinguishedName ::= SET SIZE (1 .. MAX) OF AttributeTypeAndValue
  </code></pre>
  
  <p><strong>AttributeTypeAndValue</strong></p>
  
  <pre><code>AttributeTypeAndValue ::= SEQUENCE {
      type AttributeType,
      value AttributeValue
  }
  </code></pre>
  
  <p><strong>AttributeType</strong></p>
  
  <pre><code>AttributeType ::= OBJECT IDENTIFIER
  </code></pre>
  
  <p><strong>AttributeValue</strong></p>
  
  <pre><code>AttributeValue ::= ANY -- DEFINED BY AttributeType
  </code></pre>
  
  <p>If I create a CSR containing "/CN=CommonNameX/O=OrganizationX/..." (in this specific order), how does a CA constructs a certificate out of this?</p>
  
  <p>How will the certificate be constructed when setting the subject to ".../O=OrganizationX/CN=CommonNameX/" (same in reversed order)?</p>
  
  <p>As far as I know the ordering of the RDN attributes is important when verifying certificate chains. Therefore, I assume there must by some detailed specification available?</p>
  
  <p>More importantly, I would also like to know if there are different CAs using different orderings. If so, can someone point out some CAs?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>After reading the first answers, I realized that I was asking for something very different than intended. To cut it short: the intended question was, if the ordering of the elements in the <strong>sequence of RDNs</strong> is important.</p>
  
  <p>Sorry for the confusion, I will rectify the title of the question afterwards...</p>