Class Oid

java.lang.Object
com.sun.gssapi.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

RFC 2078
This class replaces the following GSS-API functions:
  • gss_test_oid_set_member
  • gss_release_oid
  • gss_oid_to_str
  • gss_str_to_oid
  • Constructor Summary

    Constructors
    Constructor
    Description
    Oid(byte[] DEROid)
    Constructs an Oid object from its DER encoding.
    Oid(byte[] data, int offset)
    Constructs an Oid object from its DER encoding.
    Oid(InputStream derOid)
    Constructs an Oid object from its DER encoding.
    Oid(String strOid)
    Constructs an Oid object from a string representation of its integer components.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    containedIn(Oid[] oids)
    A utility method which takes an array of Oids and checks if it contains this oid object.
    boolean
    Equality test for oid objects.
    byte[]
    Returns the full ASN.1 DER encoding for this oid object.
    Returns a string representation of the Oid's integer components in the format specified within RFC 2078.
    Returns a string representation of the oid's integer components in dot separated notation.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Oid

      public Oid(String strOid) throws GSSException
      Constructs an Oid object from a string representation of its integer components. Will throw a GSSException if the string is improperly formatted.
      Parameters:
      strOid - the string in either of these two formats: "{1 2 3 3}" or "1.2.3.3".
      Throws:
      GSSException - may be thrown when the string is incorrectly formatted
    • Oid

      public Oid(InputStream derOid) throws GSSException
      Constructs an Oid object from its DER encoding. The structure and encoding of Oids is defined in ISOIEC-8824 and ISOIEC-8825.
      Parameters:
      derOid - stream containing the DER encoded oid
      Throws:
      GSSException - may be thrown when the DER encoding does not follow the prescribed format.
    • Oid

      public Oid(byte[] data, int offset) throws GSSException
      Constructs an Oid object from its DER encoding. The structure and encoding of Oids is defined in ISOIEC-8824 and ISOIEC-8825.
      Parameters:
      data - byte array containing the DER encoded oid
      offset - where in the data byte array to start from
      Throws:
      GSSException - may be thrown when the DER encoding does not follow the prescribed format.
    • Oid

      public Oid(byte[] DEROid) throws GSSException
      Constructs an Oid object from its DER encoding. The structure and encoding of Oids is defined in ISOIEC-8824 and ISOIEC-8825.
      Parameters:
      DEROid - a byte array containing the DER encoding of the Oid
      Throws:
      GSSException - may be thrown when the DER encoding does not follow the prescribed format.
      See Also:
  • Method Details

    • toString

      public String toString()
      Returns a string representation of the oid's integer components in dot separated notation.
      Overrides:
      toString in class Object
      Returns:
      string representation in the following format: "1.2.3.4.5"
      See Also:
    • toRFC2078String

      public String toRFC2078String()
      Returns a string representation of the Oid's integer components in the format specified within RFC 2078. For example { 1 2 3 4 }
      RFC 2078
      equivalent to gss_oid_to_str
      Returns:
      string representation in the following format: { 1 2 3 4 5 }
      See Also:
    • equals

      public boolean equals(Object Obj)
      Equality test for oid objects.
      Overrides:
      equals in class Object
      Parameters:
      Obj - Oid object that has to be compared to this one
      Returns:
      true if they represent the same Oid, false otherwise
    • getDER

      public byte[] getDER() throws GSSException
      Returns the full ASN.1 DER encoding for this oid object.
      Returns:
      byte array containing the DER encoding of this oid object.
      Throws:
      GSSException - may be thrown when the oid can't be encoded
    • containedIn

      public boolean containedIn(Oid[] oids)
      A utility method which takes an array of Oids and checks if it contains this oid object.

      RFC 2078
      In the JGSS package Oid sets are represented as arrays of Oids. This method is equivalent to gss_test_oid_set_member.
      Parameters:
      An - array of Oids to search
      Returns:
      true if the array contains this object, false otherwise