org.ietf.jgss
Class Oid

java.lang.Object
  extended by org.ietf.jgss.Oid

public class Oid
extends Object

This class represents Universal Object Identifiers (Oids) and their associated operations.

Oids are hierarchically globally-interpretable identifiers used within the GSS-API framework to identify mechanisms and name formats.

The structure and encoding of Oids is defined in ISOIEC-8824 and ISOIEC-8825. For example the Oid representation of Kerberos V5 mechanism is "1.2.840.113554.1.2.2".

The GSSName name class contains public static Oid objects representing the standard name types defined in GSS-API.


Constructor Summary
Oid(byte[] derOid)
          Creates an Oid object from its DER encoding.
Oid(InputStream derOid)
          Creates an Oid object from its DER encoding.
Oid(String strOid)
          Creates an Oid object from a string representation of its integer components (e.g. "1.2.840.113554.1.2.2").
 
Method Summary
 boolean containedIn(Oid[] oids)
          A utility method to test if an Oid object is contained within the supplied Oid object array.
 boolean equals(Object o)
          Determine whether this Object is semantically equal to another Object.
 byte[] getDER()
          Returns the full ASN.1 DER encoding for this oid object, which includes the tag and length.
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 String toString()
          Returns a string representation of the oid's integer components in dot separated notation (e.g. "1.2.840.113554.1.2.2").
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Oid

public Oid(String strOid)
    throws GSSException
Creates an Oid object from a string representation of its integer components (e.g. "1.2.840.113554.1.2.2").

Parameters:
strOid - The string representation for the oid.
Throws:
GSSException - If the argument is badly formed.

Oid

public Oid(InputStream derOid)
    throws GSSException
Creates an Oid object from its DER encoding. This refers to the full encoding including tag and length. The structure and encoding of Oids is defined in ISOIEC-8824 and ISOIEC-8825. This method is identical in functionality to its byte array counterpart.

Parameters:
derOid - Stream containing the DER encoded oid.
Throws:
GSSException - If the DER stream is badly formed, or if the input stream throws an exception.

Oid

public Oid(byte[] derOid)
    throws GSSException
Creates an Oid object from its DER encoding. This refers to the full encoding including tag and length. The structure and encoding of Oids is defined in ISOIEC-8824 and ISOIEC-8825. This method is identical in functionality to its streaming counterpart.

Parameters:
derOid - Byte array storing a DER encoded oid.
Throws:
GSSException - If the DER bytes are badly formed.
Method Detail

toString

public String toString()
Returns a string representation of the oid's integer components in dot separated notation (e.g. "1.2.840.113554.1.2.2").

Overrides:
toString in class Object
Returns:
The string representation of this oid.
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)

getDER

public byte[] getDER()
              throws GSSException
Returns the full ASN.1 DER encoding for this oid object, which includes the tag and length.

Returns:
The ASN.1 DER encoding for this oid.
Throws:
GSSException - If encoding fails.

containedIn

public boolean containedIn(Oid[] oids)
A utility method to test if an Oid object is contained within the supplied Oid object array.

Parameters:
oids - An array of oids to search.
Returns:
True if this oid is contained in the given array.

equals

public boolean equals(Object o)
Description copied from class: Object
Determine whether this Object is semantically equal to another Object.

There are some fairly strict requirements on this method which subclasses must follow:

This is typically overridden to throw a ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for a.equals(b) to be true even though a.getClass() != b.getClass(). Also, it is typical to never cause a NullPointerException.

In general, the Collections API (java.util) use the equals method rather than the == operator to compare objects. However, IdentityHashMap is an exception to this rule, for its own good reasons.

The default implementation returns this == o.

Overrides:
equals in class Object
Parameters:
o - the Object to compare to
Returns:
whether this Object is semantically equal to another
See Also:
Object.hashCode()

hashCode

public int hashCode()
Description copied from class: Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

Notice that since hashCode is used in Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)

Overrides:
hashCode in class Object
Returns:
the hash code for this Object
See Also:
Object.equals(Object), System.identityHashCode(Object)