public class

DNSName

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

Class Overview

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

[RFC2459] When the subjectAltName extension contains a domain name service label, the domain name MUST be stored in the dNSName (an IA5String). The name MUST be in the "preferred name syntax," as specified by RFC 1034 [RFC 1034]. Note that while upper and lower case letters are allowed in domain names, no signifigance is attached to the case. In addition, while the string " " is a legal domain name, subjectAltName extensions with a dNSName " " are not permitted. Finally, the use of the DNS representation for Internet mail addresses (wpolk.nist.gov instead of wpolk@nist.gov) is not permitted; such identities are to be encoded as rfc822Name.

Summary

[Expand]
Inherited Constants
From interface sun.security.x509.GeneralNameInterface
Public Constructors
DNSName(DerValue derValue)
Create the DNSName object from the passed encoded Der value.
DNSName(String name)
Create the DNSName 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 DNS name into the DerOutputStream.
boolean equals(Object obj)
Compares this name with another, for equality.
String getName()
Return the actual name value of the GeneralName.
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.
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 DNSName (DerValue derValue)

Create the DNSName object from the passed encoded Der value.

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

public DNSName (String name)

Create the DNSName object with the specified name.

Parameters
name the DNSName.
Throws
IOException if the name is not a valid DNSName subjectAltName

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.

RFC2459: DNS name restrictions are expressed as foo.bar.com. Any subdomain satisfies the name constraint. For example, www.foo.bar.com would satisfy the constraint but bigfoo.bar.com would not.

draft-ietf-pkix-new-part1-00.txt: DNS name restrictions are expressed as foo.bar.com. Any DNS name that can be constructed by simply adding to the left hand side of the name satisfies the name constraint. For example, www.foo.bar.com would satisfy the constraint but foo1.bar.com would not.

RFC1034: By convention, domain names can be stored with arbitrary case, but domain name comparisons for all present domain functions are done in a case-insensitive manner, assuming an ASCII character set, and a high order zero bit.

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 DNS name into the DerOutputStream.

Parameters
out the DER stream to encode the DNSName 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 getName ()

Return the actual name value of the GeneralName.

public int getType ()

Return the type of the GeneralName.

public int hashCode ()

Returns the hash code value for this object.

Returns
  • a hash code value for this object.

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.