Class IPAddressName

java.lang.Object
org.mozilla.jss.netscape.security.x509.IPAddressName
All Implemented Interfaces:
Serializable, GeneralNameInterface

public class IPAddressName extends Object implements GeneralNameInterface
This class implements the IPAddressName as required by the GeneralNames ASN.1 object.
See Also:
  • Field Details

  • Constructor Details

    • IPAddressName

      public IPAddressName(DerValue derValue) throws IOException
      Create the IPAddressName object from the passed encoded Der value.
      Parameters:
      derValue - the encoded DER IPAddressName.
      Throws:
      IOException - on error.
    • IPAddressName

      public IPAddressName(byte[] address)
      Create the IPAddressName object with the specified name.
      Parameters:
      address - the IPAddressName.
    • IPAddressName

      public IPAddressName(String s, String netmask)
      Create the IPAddressName object with a string representing the ip address and a string representing the netmask, with encoding having ip address encoding followed by the netmask encoding. This form is needed for name constraints extension.
      Parameters:
      s - the ip address in the format: n.n.n.n or x:x:x:x:x:x:x:x (RFC 1884)
      netmask - the netmask address in the format: n.n.n.n or x:x:x:x:x:x:x:x (RFC 1884)
    • IPAddressName

      public IPAddressName(String s, CIDRNetmask mask)
      IP address with CIDR netmask
      Parameters:
      s - a single IPv4 or IPv6 address
      mask - a CIDR netmask
    • IPAddressName

      public IPAddressName(String s)
      Create the IPAddressName object with a string representing the ip address.
      Parameters:
      s - the ip address in the format: n.n.n.n or x:x:x:x:x:x:x:x
  • Method Details

    • getType

      public int getType()
      Return the type of the GeneralName.
      Specified by:
      getType in interface GeneralNameInterface
    • validSingle

      public boolean validSingle()
      Description copied from interface: GeneralNameInterface
      Whether the name is valid as a single name (e.g. for use in Subject Alternative Name extension).
      Specified by:
      validSingle in interface GeneralNameInterface
    • validSubtree

      public boolean validSubtree()
      Description copied from interface: GeneralNameInterface
      Whether the name is valid as a subtree name (e.g. for use in Name Constraints extension)
      Specified by:
      validSubtree in interface GeneralNameInterface
    • encode

      public void encode(DerOutputStream out) throws IOException
      Encode the IPAddress name into the DerOutputStream.
      Specified by:
      encode in interface GeneralNameInterface
      Parameters:
      out - the DER stream to encode the IPAddressName to.
      Throws:
      IOException - on encoding errors.
    • toString

      public String toString()
      Return a printable string of IPaddress
      Overrides:
      toString in class Object
    • fillIPv4Address

      public static int fillIPv4Address(String s, byte[] address, int start)
      Gets an IP v4 address in the form n.n.n.n.
    • fillIPv6Address

      public static int fillIPv6Address(String s, byte[] address, int start)
      Gets an IP address in the forms as defined in RFC1884:
      • x:x:x:x:x:x:x:x
      • ...::xxx (using :: shorthand)
      • ...:n.n.n.n (with n.n.n.n at the end)