Package com.unboundid.asn1
Class ASN1ObjectIdentifier
java.lang.Object
com.unboundid.asn1.ASN1Element
com.unboundid.asn1.ASN1ObjectIdentifier
- All Implemented Interfaces:
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:
-
Constructor Summary
ConstructorsConstructorDescriptionASN1ObjectIdentifier(byte type, OID oid) Creates a new ASN.1 object identifier element with the specified BER type and the provided OID.ASN1ObjectIdentifier(byte type, 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(String oidString) Creates a new ASN.1 object identifier element with the default BER type and the provided OID. -
Method Summary
Modifier and TypeMethodDescriptionstatic ASN1ObjectIdentifierdecodeAsObjectIdentifier(byte[] elementBytes) Decodes the contents of the provided byte array as an object identifier element.static ASN1ObjectIdentifierdecodeAsObjectIdentifier(ASN1Element element) Decodes the provided ASN.1 element as an object identifier element.getOID()Retrieves the OID represented by this object identifier element.voidtoString(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 Details
-
ASN1ObjectIdentifier
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
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
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
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 Details
-
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
Appends a string representation of the value for this ASN.1 element to the provided buffer.- Overrides:
toStringin classASN1Element- Parameters:
buffer- The buffer to which to append the information.
-