public class IPAddressName extends java.lang.Object implements GeneralNameInterface
[RFC 5280 4.2.1.6 Subject Alternative Name] When the subjectAltName extension contains an iPAddress, the address MUST be stored in the octet string in "network byte order", as specified in [RFC791]. The least significant bit (LSB) of each octet is the LSB of the corresponding byte in the network address. For IP version 4, as specified in [RFC791], the octet string MUST contain exactly four octets. For IP version 6, as specified in [RFC 2460], the octet string MUST contain exactly sixteen octets.
[RFC 5280 4.2.1.10 Name Constraints] The syntax of iPAddress MUST be as described in Section 4.2.1.6 with the following additions specifically for name constraints. For IPv4 addresses, the iPAddress field of GeneralName MUST contain eight (8) octets, encoded in the style of RFC 4632 (CIDR) to represent an address range [RFC 4632]. For IPv6 addresses, the iPAddress field MUST contain 32 octets similarly encoded. For example, a name constraint for "class C" subnet 192.0.2.0 is represented as the octets C0 00 02 00 FF FF FF 00, representing the CIDR notation 192.0.2.0/24 (mask 255.255.255.0).
GeneralName,
GeneralNameInterface,
GeneralNamesNAME_ANY, NAME_DIFF_TYPE, NAME_DIRECTORY, NAME_DNS, NAME_EDI, NAME_IP, NAME_MATCH, NAME_NARROWS, NAME_OID, NAME_RFC822, NAME_SAME_TYPE, NAME_URI, NAME_WIDENS, NAME_X400| Constructor and Description |
|---|
IPAddressName(byte[] address)
Create the IPAddressName object with the specified octets.
|
IPAddressName(com.tencent.kona.sun.security.util.DerValue derValue)
Create the IPAddressName object from the passed encoded Der value.
|
IPAddressName(java.lang.String name)
Create an IPAddressName from a String.
|
| Modifier and Type | Method and Description |
|---|---|
int |
constrains(GeneralNameInterface inputName)
Return type of constraint inputName places on this name:
NAME_DIFF_TYPE = -1: input name is different type from name
(i.e.
|
void |
encode(com.tencent.kona.sun.security.util.DerOutputStream out)
Encode the IPAddress name into the DerOutputStream.
|
boolean |
equals(java.lang.Object obj)
Compares this name with another, for equality.
|
byte[] |
getBytes()
Returns this IPAddress name as a byte array.
|
java.lang.String |
getName()
Return a standard String representation of IPAddress.
|
int |
getType()
Return the type of the GeneralName.
|
int |
hashCode()
Returns the hash code value for this object.
|
int |
subtreeDepth()
Return subtree depth of this name for purposes of determining
NameConstraints minimum and maximum bounds and for calculating
path lengths in name subtrees.
|
java.lang.String |
toString()
Return a printable string of IPaddress
|
public IPAddressName(com.tencent.kona.sun.security.util.DerValue derValue)
throws java.io.IOException
derValue - the encoded DER IPAddressName.java.io.IOException - on error.public IPAddressName(byte[] address)
throws java.io.IOException
address - the IP addressjava.io.IOException - if address is not a valid IPv4 or IPv6 addresspublic IPAddressName(java.lang.String name)
throws java.io.IOException
[IETF RFC2373 IP Version 6 Addressing Architecture] For IPv6 addresses, the forms are "a1:a2:...:a8" or "a1:a2:...:a8/n", where a1-a8 are hexadecimal values representing the eight 16-bit pieces of the address. If /n is used, n is a decimal number indicating how many of the leftmost contiguous bits of the address comprise the prefix for this subnet. Internally, a mask value is created using the prefix length.
name - String form of IPAddressNamejava.io.IOException - if name can not be converted to a valid IPv4 or IPv6
addresspublic int getType()
getType in interface GeneralNameInterfacepublic void encode(com.tencent.kona.sun.security.util.DerOutputStream out)
encode in interface com.tencent.kona.sun.security.util.DerEncoderout - the DER stream to encode the IPAddressName to.public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getName()
throws java.io.IOException
java.io.IOException - if the IPAddress cannot be converted to a Stringpublic byte[] getBytes()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int constrains(GeneralNameInterface inputName) throws java.lang.UnsupportedOperationException
[RFC 5280 4.2.1.10 Name Constraints] The syntax of iPAddress MUST be as described in Section 4.2.1.6 with the following additions specifically for name constraints. For IPv4 addresses, the iPAddress field of GeneralName MUST contain eight (8) octets, encoded in the style of RFC 4632 (CIDR) to represent an address range [RFC 4632]. For IPv6 addresses, the iPAddress field MUST contain 32 octets similarly encoded. For example, a name constraint for "class C" subnet 192.0.2.0 is represented as the octets C0 00 02 00 FF FF FF 00, representing the CIDR notation 192.0.2.0/24 (mask 255.255.255.0).
constrains in interface GeneralNameInterfaceinputName - to be checked for being constrainedjava.lang.UnsupportedOperationException - if name is not exact match, but
narrowing and widening are not supported for this name type.public int subtreeDepth()
throws java.lang.UnsupportedOperationException
subtreeDepth in interface GeneralNameInterfacejava.lang.UnsupportedOperationException - if not supported for this name type