|
For the latest news and information visit The GNU Crypto project |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.crypto.der.OID
public class OID
This immutable class represents an object identifier, or OID.
OIDs are represented as a series of hierarcical tokens, each of which is usually represented as a single, unsigned integer. The hierarchy works so that later tokens are considered within the group of earlier tokens. Thus, the OID for the Serpent block cipher, 1.3.6.1.4.1.11591.13.2, is maintained by the GNU project, whose OID is 1.3.6.1.4.1.11591 (which is, in turn, part of bigger, more general bodies; the topmost, 1, stands for the OIDs assigned by the International Standards Organization, ISO).
OIDs can be represented in a variety of ways, including the dotted-decimal form we use here.
OIDs may be relative, in which case the first two elements of the OID are omitted.
Constructor Summary | |
---|---|
OID(byte[] encoded)
Construct a new OID from the given DER bytes. |
|
OID(byte[] encoded,
boolean relative)
Construct a new OID from the given DER bytes. |
|
OID(InputStream derIn,
int len)
Construct a new OID from the DER bytes in an input stream. |
|
OID(InputStream derIn,
int len,
boolean relative)
Construct a new OID from the DER bytes in an input stream. |
|
OID(int[] components)
Create a new OID from the given byte array. |
|
OID(int[] components,
boolean relative)
Create a new OID from the given byte array. |
|
OID(String strRep)
Create a new OID from the given dotted-decimal representation. |
|
OID(String strRep,
boolean relative)
Create a new OID from the given dotted-decimal representation. |
Method Summary | |
---|---|
Object |
clone()
Returns a copy of this OID. |
int |
compareTo(Object o)
Compares this OID to another. |
boolean |
equals(Object o)
Tests whether or not this OID equals another. |
OID |
getChild(int id)
|
byte[] |
getDER()
Get the DER encoding of this OID, minus the tag and length fields. |
int[] |
getIDs()
Return the numeric IDs of this OID. |
OID |
getParent()
Get the parent OID of this OID. |
OID |
getRoot()
Get the root OID of this OID. |
int |
hashCode()
Computes a hash code for this OID. |
boolean |
isRelative()
|
String |
toString()
Returns the value of this OID in dotted-decimal format. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OID(int[] components)
components
- The numeric IDs.
IllegalArgumentException
- If components is null or empty.public OID(int[] components, boolean relative)
components
- The numeric IDs.relative
- The relative flag.
IllegalArgumentException
- If components is null or empty.public OID(String strRep)
strRep
- The string representation of the OID.
IllegalArgumentException
- If the string does not contain at
least one integer.
NumberFormatException
- If the string does not contain only
numbers and periods ('.').public OID(String strRep, boolean relative)
strRep
- The string representation of the OID.relative
- The relative flag.
IllegalArgumentException
- If the string does not contain at
least one integer.
NumberFormatException
- If the string does not contain only
numbers and periods ('.').public OID(InputStream derIn, int len) throws IOException
derIn
- The DER input stream.len
- The number of bytes in the encoded form.
IOException
- If an error occurs reading the OID.public OID(InputStream derIn, int len, boolean relative) throws IOException
derIn
- The DER input stream.len
- The number of bytes in the encoded form.relative
- The relative flag.
IOException
- If an error occurs reading the OID.public OID(byte[] encoded) throws IOException
encoded
- The DER encoded OID.
IOException
- If an error occurs reading the OID.public OID(byte[] encoded, boolean relative) throws IOException
root
- The root OID.encoded
- The encoded relative OID.relative
- The relative flag.
IOException
Method Detail |
---|
public int[] getIDs()
public byte[] getDER()
public OID getParent()
public OID getChild(int id)
public OID getRoot()
public boolean isRelative()
public Object clone()
clone
in class Object
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public int compareTo(Object o)
compareTo
in interface Comparable
o
- The object to compare.
ClassCastException
- If o is not an OID.
|
For the latest news and information visit The GNU Crypto project |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |