Re: Syntax of Subject Alternative Names field in a certificate

Jeffrey Walton <[email protected]> Tue, 16 Apr 2024 08:57:45 -0400
Newsgroups gmane.ietf.x509
Message-ID <CAH8yC8nrdF0T7snPN9TXgPNzin+h1xJz3nXarP1EM1HsD-8kKA@mail.gmail.com>
On Tue, Apr 16, 2024 at 8:12 AM Andreas Maier <[email protected]> wrote:

> Hi, I am trying to understand what the syntax is for the string value of
> the Subject Alternative Names field, particularly when it contains multiple
> entries.
>
> I was hopeful to find that in https://datatracker.ietf.org/doc/html/rfc5280 which as a section 4.2.1.6 <https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.6> “Subject Alternative Name” but I could not get that out of the syntax description in there.
>
> I can find examples which seem to suggest it is a comma-separated list of items, each of which has a type indicator (e.g. “DNS”), as in:
>
> DNS:{hostname1},IP:{ip2},email:{email},URI:{uri4}
>
> Some sources for the examples:
>
>    - https://www.openssl.org/docs/man1.0.2/man5/x509v3_config.html
>    -
>    https://support.hpe.com/hpesc/public/docDisplay?docId=sf000094754en_us&docLocale=en_US&page=index.html
>    -
>    https://www.linode.com/docs/guides/using-openssls-subjectaltname-with-multiple-site-domains/
>     use:
>
> Where is the syntax of the Subject Alternative Names field documented in
> an RFC?
> Are the type indicators mandatory or optional?
>

According to RFC 5280, Section 4.2.1.6 (p. 38):

SubjectAltName ::= GeneralNames

   GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName

   GeneralName ::= CHOICE {
        otherName                       [0]     OtherName,
        rfc822Name                      [1]     IA5String,
        dNSName                         [2]     IA5String,
        x400Address                     [3]     ORAddress,
        directoryName                   [4]     Name,
        ediPartyName                    [5]     EDIPartyName,
        uniformResourceIdentifier       [6]     IA5String,
        iPAddress                       [7]     OCTET STRING,
        registeredID                    [8]     OBJECT IDENTIFIER }

   OtherName ::= SEQUENCE {
        type-id    OBJECT IDENTIFIER,
        value      [0] EXPLICIT ANY DEFINED BY type-id }

   EDIPartyName ::= SEQUENCE {
        nameAssigner            [0]     DirectoryString OPTIONAL,
        partyName               [1]     DirectoryString }

Use Peter Gutmann's dumpasn1 to inspect the octets that make up the SAN in
the certificate.

Jeff

_______________________________________________
pkix mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/pkix