Class IPAddressName
java.lang.Object
org.mozilla.jss.netscape.security.x509.IPAddressName
- All Implemented Interfaces:
Serializable
,GeneralNameInterface
This class implements the IPAddressName as required by the GeneralNames
ASN.1 object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final char
protected static final char
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
ConstructorsConstructorDescriptionIPAddressName
(byte[] address) Create the IPAddressName object with the specified name.Create the IPAddressName object with a string representing the ip address.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.IPAddressName
(String s, CIDRNetmask mask) IP address with CIDR netmaskIPAddressName
(DerValue derValue) Create the IPAddressName object from the passed encoded Der value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
encode
(DerOutputStream out) Encode the IPAddress name into the DerOutputStream.static int
fillIPv4Address
(String s, byte[] address, int start) Gets an IP v4 address in the form n.n.n.n.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 ...int
getType()
Return the type of the GeneralName.toString()
Return a printable string of IPaddressboolean
Whether the name is valid as a single name (e.g. for use in Subject Alternative Name extension).boolean
Whether the name is valid as a subtree name (e.g. for use in Name Constraints extension)
-
Field Details
-
IPv4_LEN
protected static final char IPv4_LEN- See Also:
-
IPv6_LEN
protected static final char IPv6_LEN- See Also:
-
-
Constructor Details
-
IPAddressName
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
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
IP address with CIDR netmask- Parameters:
s
- a single IPv4 or IPv6 addressmask
- a CIDR netmask
-
IPAddressName
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 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
Encode the IPAddress name into the DerOutputStream.- Specified by:
encode
in interfaceGeneralNameInterface
- Parameters:
out
- the DER stream to encode the IPAddressName to.- Throws:
IOException
- on encoding errors.
-
toString
Return a printable string of IPaddress -
fillIPv4Address
Gets an IP v4 address in the form n.n.n.n. -
fillIPv6Address
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)
-