Package com.unboundid.asn1
Class ASN1ObjectIdentifier
- java.lang.Object
-
- com.unboundid.asn1.ASN1Element
-
- com.unboundid.asn1.ASN1ObjectIdentifier
-
- All Implemented Interfaces:
java.io.Serializable
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ASN1ObjectIdentifier extends ASN1Element
This class provides an ASN.1 object identifier element, whose value represents a numeric OID. Note that ASN.1 object identifier elements must strictly conform to the numeric OID specification, which has the following requirements:- All valid OIDs must contain at least two components.
- The value of the first component must be 0, 1, or 2.
- If the value of the first component is 0 or 1, then the value of the second component must not be greater than 39.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ASN1ObjectIdentifier(byte type, OID oid)
Creates a new ASN.1 object identifier element with the specified BER type and the provided OID.ASN1ObjectIdentifier(byte type, java.lang.String oidString)
Creates a new ASN.1 object identifier element with the specified BER type and the provided OID.ASN1ObjectIdentifier(OID oid)
Creates a new ASN.1 object identifier element with the default BER type and the provided OID.ASN1ObjectIdentifier(java.lang.String oidString)
Creates a new ASN.1 object identifier element with the default BER type and the provided OID.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ASN1ObjectIdentifier
decodeAsObjectIdentifier(byte[] elementBytes)
Decodes the contents of the provided byte array as an object identifier element.static ASN1ObjectIdentifier
decodeAsObjectIdentifier(ASN1Element element)
Decodes the provided ASN.1 element as an object identifier element.OID
getOID()
Retrieves the OID represented by this object identifier element.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of the value for this ASN.1 element to the provided buffer.-
Methods inherited from class com.unboundid.asn1.ASN1Element
decode, decodeAsBigInteger, decodeAsBitString, decodeAsBoolean, decodeAsEnumerated, decodeAsGeneralizedTime, decodeAsIA5String, decodeAsInteger, decodeAsLong, decodeAsNull, decodeAsNumericString, decodeAsObjectIdentifier, decodeAsOctetString, decodeAsPrintableString, decodeAsSequence, decodeAsSet, decodeAsUTCTime, decodeAsUTF8String, encode, encodeLength, encodeTo, equals, equalsIgnoreType, getType, getTypeClass, getValue, getValueLength, hashCode, isConstructed, readFrom, readFrom, toString, writeTo
-
-
-
-
Constructor Detail
-
ASN1ObjectIdentifier
public ASN1ObjectIdentifier(@NotNull OID oid) throws ASN1Exception
Creates a new ASN.1 object identifier element with the default BER type and the provided OID.- Parameters:
oid
- The OID to represent with this element. It must not benull
, and it must represent a valid OID.- Throws:
ASN1Exception
- If the provided OID does not strictly adhere to the numeric OID format.
-
ASN1ObjectIdentifier
public ASN1ObjectIdentifier(byte type, @NotNull OID oid) throws ASN1Exception
Creates a new ASN.1 object identifier element with the specified BER type and the provided OID.- Parameters:
type
- The BER type for this element.oid
- The OID to represent with this element. It must not benull
, and it must represent a valid OID.- Throws:
ASN1Exception
- If the provided OID does not strictly adhere to the numeric OID format.
-
ASN1ObjectIdentifier
public ASN1ObjectIdentifier(@NotNull java.lang.String oidString) throws ASN1Exception
Creates a new ASN.1 object identifier element with the default BER type and the provided OID.- Parameters:
oidString
- The string representation of the OID to represent with this element. It must not benull
, and it must represent a valid OID.- Throws:
ASN1Exception
- If the provided OID does not strictly adhere to the numeric OID format.
-
ASN1ObjectIdentifier
public ASN1ObjectIdentifier(byte type, @NotNull java.lang.String oidString) throws ASN1Exception
Creates a new ASN.1 object identifier element with the specified BER type and the provided OID.- Parameters:
type
- The BER type for this element.oidString
- The string representation of the OID to represent with this element. It must not benull
, and it must represent a valid OID.- Throws:
ASN1Exception
- If the provided OID does not strictly adhere to the numeric OID format.
-
-
Method Detail
-
getOID
@NotNull public OID getOID()
Retrieves the OID represented by this object identifier element.- Returns:
- The OID represented by this object identifier element.
-
decodeAsObjectIdentifier
@NotNull public static ASN1ObjectIdentifier decodeAsObjectIdentifier(@NotNull byte[] elementBytes) throws ASN1Exception
Decodes the contents of the provided byte array as an object identifier element.- Parameters:
elementBytes
- The byte array to decode as an ASN.1 object identifier element.- Returns:
- The decoded ASN.1 object identifier element.
- Throws:
ASN1Exception
- If the provided array cannot be decoded as an object identifier element.
-
decodeAsObjectIdentifier
@NotNull public static ASN1ObjectIdentifier decodeAsObjectIdentifier(@NotNull ASN1Element element) throws ASN1Exception
Decodes the provided ASN.1 element as an object identifier element.- Parameters:
element
- The ASN.1 element to be decoded.- Returns:
- The decoded ASN.1 object identifier element.
- Throws:
ASN1Exception
- If the provided element cannot be decoded as an object identifier element.
-
toString
public void toString(@NotNull java.lang.StringBuilder buffer)
Appends a string representation of the value for this ASN.1 element to the provided buffer.- Overrides:
toString
in classASN1Element
- Parameters:
buffer
- The buffer to which to append the information.
-
-