X509Certificate.SubjectAlternativeNames Property

Definition

Gets an immutable collection of subject alternative names from the SubjectAltName extension, (OID = 2.

public virtual System.Collections.Generic.ICollection<System.Collections.Generic.IList<object>>? SubjectAlternativeNames { [Android.Runtime.Register("getSubjectAlternativeNames", "()Ljava/util/Collection;", "GetGetSubjectAlternativeNamesHandler")] get; }
[<get: Android.Runtime.Register("getSubjectAlternativeNames", "()Ljava/util/Collection;", "GetGetSubjectAlternativeNamesHandler")>]
member this.SubjectAlternativeNames : System.Collections.Generic.ICollection<System.Collections.Generic.IList<obj>>

Property Value

an immutable Collection of subject alternative names (or null)

Attributes

Exceptions

if decoding of the extension fails.

Remarks

Gets an immutable collection of subject alternative names from the SubjectAltName extension, (OID = 2.5.29.17).

The ASN.1 definition of the SubjectAltName extension is:

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}

If this certificate does not contain a SubjectAltName extension, null is returned. Otherwise, a Collection is returned with an entry representing each GeneralName included in the extension. Each entry is a List whose first entry is an Integer (the name type, 0-8) and whose second entry is a String or a byte array (the name, in string or ASN.1 DER encoded form, respectively).

RFC 822, DNS, and URI names are returned as Strings, using the well-established string formats for those types (subject to the restrictions included in RFC 3280). IPv4 address names are returned using dotted quad notation. IPv6 address names are returned in the form "a1:a2:...:a8", where a1-a8 are hexadecimal values representing the eight 16-bit pieces of the address. OID names are returned as Strings represented as a series of nonnegative integers separated by periods. And directory names (distinguished names) are returned in RFC 2253 string format. No standard string format is defined for otherNames, X.400 names, EDI party names, or any other type of names. They are returned as byte arrays containing the ASN.1 DER encoded form of the name.

Note that the Collection returned may contain more than one name of the same type. Also, note that the returned Collection is immutable and any entries containing byte arrays are cloned to protect against subsequent modifications.

This method was added to version 1.4 of the Java 2 Platform Standard Edition. In order to maintain backwards compatibility with existing service providers, this method is not abstract and it provides a default implementation. Subclasses should override this method with a correct implementation.

Added in 1.4.

Java documentation for java.security.cert.X509Certificate.getSubjectAlternativeNames().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to