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​(OID oid,
                                                  boolean isCritical,
                                                  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.
      • GeneralAlternativeNameExtension

        protected GeneralAlternativeNameExtension​(X509CertificateExtension extension)
                                           throws CertException
        Creates a new general alternative name extension from the provided generic extension.
        Parameters:
        extension - The extension to decode as a general alternative name extension.
        Throws:
        CertException - If the provided extension cannot be decoded as a general alternative name extension.
    • Method Detail

      • getGeneralNames

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

        public final java.util.List<ObjectPair<OID,​ASN1Element>> getOtherNames()
        Retrieves the otherName elements from the extension.
        Returns:
        The otherName elements from the extension.
      • getRFC822Names

        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

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

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

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

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

        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

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

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

        protected void toString​(java.lang.String extensionName,
                                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.