|
|||||||||
| Home >> All >> gnu >> java >> [ security overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
gnu.java.security
Class OID

java.lang.Objectgnu.java.security.OID
- All Implemented Interfaces:
- java.lang.Cloneable, java.lang.Comparable, java.io.Serializable
- public class OID
- extends java.lang.Object
- implements java.lang.Cloneable, java.lang.Comparable, java.io.Serializable
- extends java.lang.Object
This immutable class represents an object identifier, or OID.
OIDs are represented as a series of hierarchical 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.
| Field Summary | |
private int[] |
components
The numeric ID structure. |
private byte[] |
der
The DER encoding of this OID. |
private boolean |
relative
Whether or not this OID is relative. |
private java.lang.String |
strRep
The string representation of this OID, in dotted-decimal format. |
| Constructor Summary | |
private |
OID()
Our private constructor. |
|
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(java.io.InputStream derIn,
int len)
Construct a new OID from the DER bytes in an input stream. |
|
OID(java.io.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(java.lang.String strRep)
Create a new OID from the given dotted-decimal representation. |
|
OID(java.lang.String strRep,
boolean relative)
Create a new OID from the given dotted-decimal representation. |
| Method Summary | |
java.lang.Object |
clone()
Returns a copy of this OID. |
int |
compareTo(java.lang.Object o)
Compares this OID to another. |
private static void |
encodeSubID(java.io.ByteArrayOutputStream out,
int id)
|
boolean |
equals(java.lang.Object o)
Tests whether or not this OID equals another. |
private static int[] |
fromDER(byte[] der,
boolean relative)
|
private static int[] |
fromString(java.lang.String strRep)
|
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()
|
java.lang.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 |
| Field Detail |
components
private int[] components
- The numeric ID structure.
strRep
private transient java.lang.String strRep
- The string representation of this OID, in dotted-decimal format.
der
private transient byte[] der
- The DER encoding of this OID.
relative
private boolean relative
- Whether or not this OID is relative.
| Constructor Detail |
OID
public OID(int[] components)
- Create a new OID from the given byte array. The argument (which can
neither be null nor zero-length) is copied to prevent subsequent
modification.
OID
public OID(int[] components,
boolean relative)
- Create a new OID from the given byte array. The argument (which can
neither be null nor zero-length) is copied to prevent subsequent
modification.
OID
public OID(java.lang.String strRep)
- Create a new OID from the given dotted-decimal representation.
OID
public OID(java.lang.String strRep, boolean relative)
- Create a new OID from the given dotted-decimal representation.
OID
public OID(java.io.InputStream derIn, int len) throws java.io.IOException
- Construct a new OID from the DER bytes in an input stream. This method
does not read the tag or the length field from the input stream, so
the caller must supply the number of octets in this OID's encoded
form.
OID
public OID(java.io.InputStream derIn, int len, boolean relative) throws java.io.IOException
- Construct a new OID from the DER bytes in an input stream. This method
does not read the tag or the length field from the input stream, so
the caller must supply the number of octets in this OID's encoded
form.
OID
public OID(byte[] encoded)
throws java.io.IOException
- Construct a new OID from the given DER bytes.
OID
public OID(byte[] encoded,
boolean relative)
throws java.io.IOException
- Construct a new OID from the given DER bytes.
OID
private OID()
- Our private constructor.
| Method Detail |
getIDs
public int[] getIDs()
- Return the numeric IDs of this OID. The value returned is copied to
prevent modification.
getDER
public byte[] getDER()
- Get the DER encoding of this OID, minus the tag and length fields.
getParent
public OID getParent()
- Get the parent OID of this OID. That is, if this OID is "1.2.3.4",
then the parent OID will be "1.2.3". If this OID is a top-level
OID, this method returns null.
getChild
public OID getChild(int id)
getRoot
public OID getRoot()
- Get the root OID of this OID. That is, the first two components.
isRelative
public boolean isRelative()
clone
public java.lang.Object clone()
- Returns a copy of this OID.
toString
public java.lang.String toString()
- Returns the value of this OID in dotted-decimal format.
hashCode
public int hashCode()
- Computes a hash code for this OID.
equals
public boolean equals(java.lang.Object o)
- Tests whether or not this OID equals another.
compareTo
public int compareTo(java.lang.Object o)
- Compares this OID to another. The comparison is essentially
lexicographic, where the two OIDs are compared until their
first difference, then that difference is returned. If one OID is
shorter, but all elements equal between the two for the shorter
length, then the shorter OID is lesser than the longer.
- Specified by:
compareToin interfacejava.lang.Comparable
fromDER
private static int[] fromDER(byte[] der,
boolean relative)
throws gnu.java.security.der.DEREncodingException
fromString
private static int[] fromString(java.lang.String strRep) throws java.lang.NumberFormatException
encodeSubID
private static void encodeSubID(java.io.ByteArrayOutputStream out, int id)
|
|||||||||
| Home >> All >> gnu >> java >> [ security overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
gnu.java.security.OID