Class IPAddressName
- java.lang.Object
-
- org.mozilla.jss.netscape.security.x509.IPAddressName
-
- All Implemented Interfaces:
java.io.Serializable
,GeneralNameInterface
public class IPAddressName extends java.lang.Object implements GeneralNameInterface
This class implements the IPAddressName as required by the GeneralNames ASN.1 object.- See Also:
GeneralName
,GeneralNameInterface
,GeneralNames
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static char
IPv4_LEN
protected static char
IPv6_LEN
-
Fields inherited from interface org.mozilla.jss.netscape.security.x509.GeneralNameInterface
NAME_ANY, NAME_DIRECTORY, NAME_DNS, NAME_EDI, NAME_IP, NAME_OID, NAME_RFC822, NAME_URI, NAME_X400
-
-
Constructor Summary
Constructors Constructor Description IPAddressName(byte[] address)
Create the IPAddressName object with the specified name.IPAddressName(java.lang.String s)
Create the IPAddressName object with a string representing the ip address.IPAddressName(java.lang.String s, java.lang.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.IPAddressName(java.lang.String s, CIDRNetmask mask)
IP address with CIDR netmaskIPAddressName(DerValue derValue)
Create the IPAddressName object from the passed encoded Der value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
encode(DerOutputStream out)
Encode the IPAddress name into the DerOutputStream.static int
fillIPv4Address(java.lang.String s, byte[] address, int start)
Gets an IP v4 address in the form n.n.n.n.static int
fillIPv6Address(java.lang.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 ...int
getType()
Return the type of the GeneralName.java.lang.String
toString()
Return a printable string of IPaddressboolean
validSingle()
Whether the name is valid as a single name (e.g. for use in Subject Alternative Name extension).boolean
validSubtree()
Whether the name is valid as a subtree name (e.g. for use in Name Constraints extension)
-
-
-
Field Detail
-
IPv4_LEN
protected static final char IPv4_LEN
- See Also:
- Constant Field Values
-
IPv6_LEN
protected static final char IPv6_LEN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IPAddressName
public IPAddressName(DerValue derValue) throws java.io.IOException
Create the IPAddressName object from the passed encoded Der value.- Parameters:
derValue
- the encoded DER IPAddressName.- Throws:
java.io.IOException
- on error.
-
IPAddressName
public IPAddressName(byte[] address)
Create the IPAddressName object with the specified name.- Parameters:
address
- the IPAddressName.
-
IPAddressName
public IPAddressName(java.lang.String s, java.lang.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(java.lang.String s, CIDRNetmask mask)
IP address with CIDR netmask- Parameters:
s
- a single IPv4 or IPv6 addressmask
- a CIDR netmask
-
IPAddressName
public IPAddressName(java.lang.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 Detail
-
getType
public int getType()
Return the type of the GeneralName.- Specified by:
getType
in interfaceGeneralNameInterface
-
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 interfaceGeneralNameInterface
-
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 interfaceGeneralNameInterface
-
encode
public void encode(DerOutputStream out) throws java.io.IOException
Encode the IPAddress name into the DerOutputStream.- Specified by:
encode
in interfaceGeneralNameInterface
- Parameters:
out
- the DER stream to encode the IPAddressName to.- Throws:
java.io.IOException
- on encoding errors.
-
toString
public java.lang.String toString()
Return a printable string of IPaddress- Overrides:
toString
in classjava.lang.Object
-
fillIPv4Address
public static int fillIPv4Address(java.lang.String s, byte[] address, int start)
Gets an IP v4 address in the form n.n.n.n.
-
fillIPv6Address
public static int fillIPv6Address(java.lang.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)
-
-