Package com.sun.gssapi
Class Oid
- java.lang.Object
-
- com.sun.gssapi.Oid
-
public class Oid extends java.lang.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(java.io.InputStream derOid)
Constructs an Oid object from its DER encoding.Oid(java.lang.String strOid)
Constructs an Oid object from a string representation of its integer components.
-
Method Summary
All Methods Instance Methods Concrete Methods 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
equals(java.lang.Object Obj)
Equality test for oid objects.byte[]
getDER()
Returns the full ASN.1 DER encoding for this oid object.java.lang.String
toRFC2078String()
Returns a string representation of the Oid's integer components in the format specified within RFC 2078.java.lang.String
toString()
Returns a string representation of the oid's integer components in dot separated notation.
-
-
-
Constructor Detail
-
Oid
public Oid(java.lang.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(java.io.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 oidoffset
- 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:
Oid(java.io.InputStream)
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns a string representation of the oid's integer components in dot separated notation.- Overrides:
toString
in classjava.lang.Object
- Returns:
- string representation in the following format: "1.2.3.4.5"
- See Also:
toRFC2078String()
-
toRFC2078String
public java.lang.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:
toString()
-
equals
public boolean equals(java.lang.Object Obj)
Equality test for oid objects.- Overrides:
equals
in classjava.lang.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
-
-