Package io.fusionauth.der
Class Tag
java.lang.Object
io.fusionauth.der.Tag
This object models a ASN.1 DER Tag.
- Author:
- Daniel DeGroff
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intBit String Tagstatic final intInteger Tagstatic final intNull Tagstatic final intObject Identifier Tagstatic final intOctet String Tagfinal booleanTrue if this Tag is primitive.static final intPrintableString Tagfinal byteThe raw byte read from the DER encoded array.static final intSequence Tagstatic final intSet and Set offinal TagClassThe class of this tag read from bits 8 and 7 of the raw byte.static final intUTCTime Tagfinal intThe tag value in decimal. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
BitString
public static final int BitStringBit String Tag- See Also:
-
Integer
public static final int IntegerInteger Tag- See Also:
-
Null
public static final int NullNull Tag- See Also:
-
ObjectIdentifier
public static final int ObjectIdentifierObject Identifier Tag- See Also:
-
OctetString
public static final int OctetStringOctet String Tag- See Also:
-
PrintableString
public static final int PrintableStringPrintableString Tag19 decimal, 0x13 hex
- See Also:
-
Sequence
public static final int SequenceSequence Tag16 decimal, 0x10 hex, 0b00010000 binary
Because the Sequence tag is always in a constructed form (not primitive), the tag will present as0x30because the 6th bit is a1indicating a constructed form. So the raw sequence of0b00010000becomes0b00110000which is48decimal.- See Also:
-
Set
public static final int SetSet and Set of17 decimal, 0x11 hex
- See Also:
-
UTCTime
public static final int UTCTimeUTCTime Tag23 decimal, 0x17 hex
- See Also:
-
primitive
public final boolean primitiveTrue if this Tag is primitive. False if this Tag is constructed. -
rawByte
public final byte rawByteThe raw byte read from the DER encoded array. This byte includes the class, form and tag number. -
tagClass
The class of this tag read from bits 8 and 7 of the raw byte. -
value
public final int valueThe tag value in decimal. This value will only represent the decimal value of bits 5 to 1.For example, if this is a sequence tag, this value will be
16and you should expectprimitiveto be false. If you want the raw byte which will be48or0x30you can readrawByte.
-
-
Constructor Details
-
Tag
public Tag(int value) Construct a new tag from the tag byte in the DER byte array. The following depicts the layout of the tag byte.--------------------------------------------------------- | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 | --------------------------------------------------------- |______| | |___________________________| | | | | |-- [0] Primitive | | |-- [1] Constructed | | Tag Number (value) | Class |--------------------------- |-- 0 0 Universal |-- 0 1 Application |-- 1 0 Context Specific |-- 1 1 Private- Parameters:
value- the tag value from the DER byte array
-
-
Method Details
-
equals
-
getName
-
hashCode
public int hashCode() -
is
public boolean is(int tag) - Parameters:
tag- a tag- Returns:
- true if this tag has the same value as requested
-
isConstructed
public boolean isConstructed() -
isPrimitive
public boolean isPrimitive() -
toString
-