public class

URIName

extends Object
implements GeneralNameInterface
java.lang.Object
   ↳ sun.security.x509.URIName

Class Overview

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

[RFC3280] 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 1738]. 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 1738], 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:

 :
 
A URL contains the name of the scheme being used () followed by a colon and then a string (the ) 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:

 //:@:/
 
[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.

Summary

[Expand]
Inherited Constants
From interface sun.security.x509.GeneralNameInterface
Public Constructors
URIName(DerValue derValue)
Create the URIName object from the passed encoded Der value.
URIName(String name)
Create the URIName object with the specified name.
Public Methods
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(DerOutputStream out)
Encode the URI name into the DerOutputStream.
boolean equals(Object obj)
Compares this name with another, for equality.
String getHost()
Return the host name or IP address portion of the URIName
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.
String getName()
Returns this URI name.
String getScheme()
Return the scheme name portion of a URIName
int getType()
Return the type of the GeneralName.
URI getURI()
Returns the URIName as a java.net.URI object
int hashCode()
Returns the hash code value for this object.
static URIName nameConstraint(DerValue value)
Create the URIName object with the specified name constraint.
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.
String toString()
Convert the name into user readable string.
[Expand]
Inherited Methods
From class java.lang.Object
From interface sun.security.x509.GeneralNameInterface

Public Constructors

public URIName (DerValue derValue)

Create the URIName object from the passed encoded Der value.

Parameters
derValue the encoded DER URIName.
Throws
IOException on error.

public URIName (String name)

Create the URIName object with the specified name.

Parameters
name the URIName.
Throws
IOException if name is not a proper URIName

Public Methods

public 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. 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.

RFC3280: 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 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 to be checked for being constrained
Throws
UnsupportedOperationException if name is not exact match, but narrowing and widening are not supported for this name type.

public void encode (DerOutputStream out)

Encode the URI name into the DerOutputStream.

Parameters
out the DER stream to encode the URIName to.
Throws
IOException on encoding errors.

public boolean equals (Object obj)

Compares this name with another, for equality.

Parameters
obj the reference object with which to compare.
Returns
  • true iff the names are equivalent according to RFC2459.

public String getHost ()

Return the host name or IP address portion of the URIName

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.

public String getName ()

Returns this URI name.

public String getScheme ()

Return the scheme name portion of a URIName

public int getType ()

Return the type of the GeneralName.

public URI getURI ()

Returns the URIName as a java.net.URI object

public int hashCode ()

Returns the hash code value for this object.

Returns
  • a hash code value for this object.

public static URIName nameConstraint (DerValue value)

Create the URIName object with the specified name constraint. URI name constraints syntax is different than SubjectAltNames, etc. See 4.2.1.11 of RFC 3280.

Parameters
value the URI name constraint
Throws
IOException if name is not a proper URI name constraint

public 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.

Throws
UnsupportedOperationException if not supported for this name type

public String toString ()

Convert the name into user readable string.

Returns
  • a string representation of the object.