|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.shared.asn1.primitives.OID
public class OID
This class implement an OID (Object Identifier). An OID is encoded as a list of bytes representing integers. An OID has a numeric representation where number are separated with dots : SPNEGO Oid = 1.3.6.1.5.5.2 Translating from a byte list to a dot separated list of number follows the rules : - the first number is in [0..2] - the second number is in [0..39] if the first number is 0 or 1 - the first byte has a value equal to : number 1 * 40 + number two - the upper bit of a byte is set if the next byte is a part of the number For instance, the SPNEGO Oid (1.3.6.1.5.5.2) will be encoded : 1.3 -> 0x2B (1*40 + 3 = 43 = 0x2B) .6 -> 0x06 .1 -> 0x01 .5 -> 0x05 .5 -> 0x05 .2 -> 0x02 The Kerberos V5 Oid (1.2.840.48018.1.2.2) will be encoded : 1.2 -> 0x2A (1*40 + 2 = 42 = 0x2A) 840 -> 0x86 0x48 (840 = 6 * 128 + 72 = (0x06 | 0x80) 0x48 = 0x86 0x48 48018 -> 0x82 0xF7 0x12 (2 * 128 * 128 + 119 * 128 + 18 = (0x02 | 0x80) (0x77 | 0x80) 0x12
Constructor Summary | |
---|---|
OID()
Creates a new OID object. |
|
OID(byte[] oid)
Create a new OID object from a byte array |
|
OID(java.lang.String oid)
Create a new OID object from a String |
Method Summary | |
---|---|
byte[] |
getOID()
Get an array of bytes from the OID |
int |
getOIDLength()
Get the number of bytes necessary to store the OID |
long[] |
getOIDValues()
Get an array of int from the OID |
static boolean |
isOID(java.lang.String oid)
Check that an OID is valid |
void |
setOID(byte[] oid)
Set the OID. |
void |
setOID(java.lang.String oid)
Set the OID. |
java.lang.String |
toString()
Get the OID as a String |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OID()
public OID(byte[] oid) throws DecoderException
oid
-
DecoderException
public OID(java.lang.String oid) throws DecoderException
oid
- The String which is supposed to be an OID
DecoderException
Method Detail |
---|
public void setOID(byte[] oid) throws DecoderException
oid
- The bytes containing the OID
DecoderException
public void setOID(java.lang.String oid) throws DecoderException
oid
- The String containing the OID
DecoderException
public long[] getOIDValues()
public int getOIDLength()
public byte[] getOID()
public java.lang.String toString()
toString
in class java.lang.Object
public static boolean isOID(java.lang.String oid)
oid
- The oid to be checked
true
if the OID is valid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |