Class GeneralAlternativeNameExtension

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    IssuerAlternativeNameExtension, SubjectAlternativeNameExtension

    @NotExtensible
    @ThreadSafety(level=COMPLETELY_THREADSAFE)
    public abstract class GeneralAlternativeNameExtension
    extends X509CertificateExtension
    This class provides support for decoding the values of the SubjectAlternativeNameExtension and IssuerAlternativeNameExtension extensions as described in RFC 5280 sections 4.2.1.6 and 4.2.1.7.

    Note that this implementation only provides complete decoding for the RFC 822 names (email addresses), DNS names, directory names, uniform resource identifiers, and IP addresses elements. The other elements will be left in their raw forms.

    The value has the following encoding:
       SubjectAltName ::= GeneralNames
    
       IssuerAltName ::= 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 }
     
    See Also:
    Serialized Form
    • Constructor Detail

      • GeneralAlternativeNameExtension

        protected GeneralAlternativeNameExtension​(@NotNull
                                                  OID oid,
                                                  boolean isCritical,
                                                  @NotNull
                                                  GeneralNames generalNames)
                                           throws CertException
        Creates a new general alternative name extension with the provided information.
        Parameters:
        oid - The OID for this extension.
        isCritical - Indicates whether this extension should be considered critical.
        generalNames - The general names for inclusion in this extension.
        Throws:
        CertException - If a problem is encountered while encoding the value for this extension.
    • Method Detail

      • getGeneralNames

        @NotNull
        public final GeneralNames getGeneralNames()
        Retrieves the GeneralNames object for this alternative name extension.
        Returns:
        The GeneralNames object for this alternative name extension.
      • getRFC822Names

        @NotNull
        public final java.util.List<java.lang.String> getRFC822Names()
        Retrieves the RFC 822 names (email addresses) from the extension.
        Returns:
        The RFC 822 names from the extension.
      • getDNSNames

        @NotNull
        public final java.util.List<java.lang.String> getDNSNames()
        Retrieves the DNS names from the extension.
        Returns:
        The DNS names from the extension.
      • getX400Addresses

        @NotNull
        public final java.util.List<ASN1ElementgetX400Addresses()
        Retrieves the x400Address elements from the extension.
        Returns:
        The x400Address elements from the extension.
      • getDirectoryNames

        @NotNull
        public final java.util.List<DNgetDirectoryNames()
        Retrieves the directory names from the extension.
        Returns:
        The directory names from the extension.
      • getEDIPartyNames

        @NotNull
        public final java.util.List<ASN1ElementgetEDIPartyNames()
        Retrieves the ediPartyName elements from the extensions.
        Returns:
        The ediPartyName elements from the extension.
      • getUniformResourceIdentifiers

        @NotNull
        public final java.util.List<java.lang.String> getUniformResourceIdentifiers()
        Retrieves the uniform resource identifiers (URIs) from the extension.
        Returns:
        The URIs from the extension.
      • getIPAddresses

        @NotNull
        public final java.util.List<java.net.InetAddress> getIPAddresses()
        Retrieves the IP addresses from the extension.
        Returns:
        The IP addresses from the extension.
      • getRegisteredIDs

        @NotNull
        public final java.util.List<OIDgetRegisteredIDs()
        Retrieves the registeredID elements from the extension.
        Returns:
        The registeredID elements from the extension.
      • toString

        protected void toString​(@NotNull
                                java.lang.String extensionName,
                                @NotNull
                                java.lang.StringBuilder buffer)
        Appends a string representation of this extension to the provided buffer.
        Parameters:
        extensionName - The name to use for this extension.
        buffer - The buffer to which the information should be appended.