APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.x509

public Class URIName

extends Object
implements GeneralNameInterface
Class Inheritance
All Implemented Interfaces
sun.security.x509.GeneralNameInterface, sun.security.util.DerEncoder
Imports
java.io.IOException, java.net.URI, .URISyntaxException, sun.security.util.*

This class implements the URIName as required by the GeneralNames ASN.1 object.

[RFC5280] When the subjectAltName extension contains a URI, the name MUST be stored in the uniformResourceIdentifier (an IA5String). The name MUST be a non-relative URL, and MUST follow the URL syntax and encoding rules specified in [RFC 3986]. The name must include both a scheme (e.g., "http" or "ftp") and a scheme-specific-part. The scheme- specific-part must include a fully qualified domain name or IP address as the host.

As specified in [RFC 3986], the scheme name is not case-sensitive (e.g., "http" is equivalent to "HTTP"). The host part is also not case-sensitive, but other components of the scheme-specific-part may be case-sensitive. When comparing URIs, conforming implementations MUST compare the scheme and host without regard to case, but assume the remainder of the scheme-specific-part is case-sensitive.

[RFC1738] In general, URLs are written as follows:

<scheme>:<scheme-specific-part>
A URL contains the name of the scheme being used (<scheme>) followed by a colon and then a string (the <scheme-specific-part>) whose interpretation depends on the scheme.

While the syntax for the rest of the URL may vary depending on the particular scheme selected, URL schemes that involve the direct use of an IP-based protocol to a specified host on the Internet use a common syntax for the scheme-specific data:

//<user>:<password>@<host>:<port>/<url-path>
[RFC2732] specifies that an IPv6 address contained inside a URL must be enclosed in square brackets (to allow distinguishing the colons that separate IPv6 components from the colons that separate scheme-specific data).
Authors
Amit Kapoor, Hemma Prafullchandra, Sean Mullan, Steve Hanna
See Also
GeneralName, GeneralNames, GeneralNameInterface

Field Summary

Modifier and TypeField and Description
private final String
private DNSName
private IPAddressName
private final URI

Constructor Summary

AccessConstructor and Description
public
URIName(DerValue
the encoded DER URIName.
derValue
)

Create the URIName object from the passed encoded Der value.

public
URIName(String
the URIName.
name
)

Create the URIName object with the specified name.

pack-priv
URIName(URI uri, String host, DNSName hostDNS)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

constraint type above
constrains
(GeneralNameInterface
to be checked for being constrained
inputName
)

Implements sun.security.x509.GeneralNameInterface.constrains.

Return type of constraint inputName places on this name:

  • NAME_DIFF_TYPE = -1: input name is different type from name (i.e. does not constrain).
  • NAME_MATCH = 0: input name matches name.
  • NAME_NARROWS = 1: input name narrows name (is lower in the naming subtree)
  • NAME_WIDENS = 2: input name widens name (is higher in the naming subtree)
  • NAME_SAME_TYPE = 3: input name does not match or narrow name, but is same type.
public void
encode(DerOutputStream
the DER stream to encode the URIName to.
out
)

Implements sun.security.util.DerEncoder.encode.

Encode the URI name into the DerOutputStream.

public boolean

Returns:

true iff the names are equivalent according to RFC 5280.
equals
(Object obj)

Overrides java.lang.Object.equals.

Compares this name with another, for equality.

public String

Returns:

host name or IP address portion of full name
getHost
()

Return the host name or IP address portion of the URIName

public Object

Returns:

host name as DNSName or IPAddressName
getHostObject
()

Return the host object type; if host name is a DNSName, then this host object does not include any initial "." on the name.

public String
getName()

Returns this URI name.

public String

Returns:

scheme portion of full name
getScheme
()

Return the scheme name portion of a URIName

public int
getType()

Implements sun.security.x509.GeneralNameInterface.getType.

Return the type of the GeneralName.

public URI
getURI()

Returns the URIName as a java.net.URI object

public int

Returns:

the hash code value for this object
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this object.

public static URIName
nameConstraint(DerValue
the URI name constraint
value
)

Create the URIName object with the specified name constraint.

public int

Returns:

distance of name from root
subtreeDepth
()

Implements sun.security.x509.GeneralNameInterface.subtreeDepth.

Return subtree depth of this name for purposes of determining NameConstraints minimum and maximum bounds and for calculating path lengths in name subtrees.

public String
toString()

Overrides java.lang.Object.toString.

Convert the name into user readable string.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

hostback to summary
private final String host
hostDNSback to summary
private DNSName hostDNS
hostIPback to summary
private IPAddressName hostIP
uriback to summary
private final URI uri

Constructor Detail

URINameback to summary
public URIName(DerValue derValue) throws IOException

Create the URIName object from the passed encoded Der value.

Parameters
derValue:DerValue

the encoded DER URIName.

Exceptions
IOException:
on error.
URINameback to summary
public URIName(String name) throws IOException

Create the URIName object with the specified name.

Parameters
name:String

the URIName.

Exceptions
IOException:
if name is not a proper URIName
URINameback to summary
pack-priv URIName(URI uri, String host, DNSName hostDNS)

Method Detail

constrainsback to summary
public int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException

Implements sun.security.x509.GeneralNameInterface.constrains.

Return type of constraint inputName places on this name:

  • NAME_DIFF_TYPE = -1: input name is different type from name (i.e. does not constrain).
  • NAME_MATCH = 0: input name matches name.
  • NAME_NARROWS = 1: input name narrows name (is lower in the naming subtree)
  • NAME_WIDENS = 2: input name widens name (is higher in the naming subtree)
  • NAME_SAME_TYPE = 3: input name does not match or narrow name, but is same type.
. These results are used in checking NameConstraints during certification path verification.

RFC5280: For URIs, the constraint applies to the host part of the name. The constraint may specify a host or a domain. Examples would be "foo.bar.com"; and ".xyz.com". When the constraint begins with a period, it may be expanded with one or more subdomains. That is, the constraint ".xyz.com" is satisfied by both abc.xyz.com and abc.def.xyz.com. However, the constraint ".xyz.com" is not satisfied by "xyz.com". When the constraint does not begin with a period, it specifies a host.

Parameters
inputName:GeneralNameInterface

to be checked for being constrained

Returns:int

constraint type above

Exceptions
UnsupportedOperationException:
if name is not exact match, but narrowing and widening are not supported for this name type.
encodeback to summary
public void encode(DerOutputStream out)

Implements sun.security.util.DerEncoder.encode.

Encode the URI name into the DerOutputStream.

Parameters
out:DerOutputStream

the DER stream to encode the URIName to.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Compares this name with another, for equality.

Returns:boolean

true iff the names are equivalent according to RFC 5280.

Annotations
@Override
getHostback to summary
public String getHost()

Return the host name or IP address portion of the URIName

Returns:String

host name or IP address portion of full name

getHostObjectback to summary
public Object getHostObject()

Return the host object type; if host name is a DNSName, then this host object does not include any initial "." on the name.

Returns:Object

host name as DNSName or IPAddressName

getNameback to summary
public String getName()

Returns this URI name.

getSchemeback to summary
public String getScheme()

Return the scheme name portion of a URIName

Returns:String

scheme portion of full name

getTypeback to summary
public int getType()

Implements sun.security.x509.GeneralNameInterface.getType.

Return the type of the GeneralName.

getURIback to summary
public URI getURI()

Returns the URIName as a java.net.URI object

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this object.

Returns:int

the hash code value for this object

Annotations
@Override
nameConstraintback to summary
public static URIName nameConstraint(DerValue value) throws IOException

Create the URIName object with the specified name constraint. URI name constraints syntax is different from SubjectAltNames, etc. See 4.2.1.10 of RFC 5280.

Parameters
value:DerValue

the URI name constraint

Exceptions
IOException:
if name is not a proper URI name constraint
subtreeDepthback to summary
public int subtreeDepth() throws UnsupportedOperationException

Implements sun.security.x509.GeneralNameInterface.subtreeDepth.

Return subtree depth of this name for purposes of determining NameConstraints minimum and maximum bounds and for calculating path lengths in name subtrees.

Returns:int

distance of name from root

Exceptions
UnsupportedOperationException:
if not supported for this name type
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Convert the name into user readable string.