Package aQute.libg.asn1
Class BER
java.lang.Object
aQute.libg.asn1.BER
- All Implemented Interfaces:
Types
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final DateFormat
(package private) long
(package private) final DataInputStream
Fields inherited from interface aQute.libg.asn1.Types
APPLICATION, BIT_STRING, BMP_STRING, BOOLEAN, CHARACTER_STRING, CLASSES, CLASSMASK, CONSTRUCTED, CONTEXT, EMBEDDED_PDV, ENUMERATED, EOC, EXTERNAL, GENERAL_STRING, GENERALIZED_TIME, GRAPHIC_STRING, IA5STRING, INTEGER, NULL, NUMERIC_STRING, OBJECT_DESCRIPTOR, OBJECT_IDENTIFIER, OCTET_STRING, PRINTABLE_STRING, PRIVATE, REAL, RELATIVE_OID, SEQUENCE, SET, T61_STRING, TAGMASK, TAGS, UNIVERSAL, UNIVERSAL_STRING, UTCTIME, UTF8_STRING, VIDEOTEX_STRING, VISIBLE_STRING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
dump
(PrintStream out) (package private) void
dump
(PrintStream out, int type, long length, String indent) (package private) int
getPayloadLength
(PDU pdu) private long
private void
putOid
(OutputStream out, int i) private int
read()
private int
readByte()
private void
readFully
(byte[] data) private long
8.1.3.3 For the definite form, the length octets shall consist of one or more octets, and shall represent the number of octets in the contents octets using either the short form (see 8.1.3.4) or the long form (see 8.1.3.5) as a sender's option.(package private) String
readOID
(byte[] data) (package private) int
size
(long value) (package private) long
toLong
(byte[] data) void
write
(OutputStream out, PDU pdu) (package private) void
writePayload
(OutputStream out, PDU pdu)
-
Field Details
-
df
-
xin
-
position
long position
-
-
Constructor Details
-
BER
-
-
Method Details
-
dump
- Throws:
Exception
-
dump
- Throws:
Exception
-
toLong
long toLong(byte[] data) -
readLength
8.1.3.3 For the definite form, the length octets shall consist of one or more octets, and shall represent the number of octets in the contents octets using either the short form (see 8.1.3.4) or the long form (see 8.1.3.5) as a sender's option. NOTE – The short form can only be used if the number of octets in the contents octets is less than or equal to 127. 8.1.3.4 In the short form, the length octets shall consist of a single octet in which bit 8 is zero and bits 7 to 1 encode the number of octets in the contents octets (which may be zero), as an unsigned binary integer with bit 7 as the most significant bit. EXAMPLE L = 38 can be encoded as 001001102 8.1.3.5 In the long form, the length octets shall consist of an initial octet and one or more subsequent octets. The initial octet shall be encoded as follows: a) bit 8 shall be one; b) bits 7 to 1 shall encode the number of subsequent octets in the length octets, as an unsigned binary integer with bit 7 as the most significant bit; c) the value 111111112 shall not be used. ISO/IEC 8825-1:2003 (E) NOTE 1 – This restriction is introduced for possible future extension. Bits 8 to 1 of the first subsequent octet, followed by bits 8 to 1 of the second subsequent octet, followed in turn by bits 8 to 1 of each further octet up to and including the last subsequent octet, shall be the encoding of an unsigned binary integer equal to the number of octets in the contents octets, with bit 8 of the first subsequent octet as the most significant bit. EXAMPLE L = 201 can be encoded as: 100000012 110010012 NOTE 2 – In the long form, it is a sender's option whether to use more length octets than the minimum necessary. 8.1.3.6 For the indefinite form, the length octets indicate that the contents octets are terminated by end-of-contents octets (see 8.1.5), and shall consist of a single octet. 8.1.3.6.1 The single octet shall have bit 8 set to one, and bits 7 to 1 set to zero. 8.1.3.6.2 If this form of length is used, then end-of-contents octets (see 8.1.5) shall be present in the encoding following the contents octets. 8.1.4 Contents octets The contents octets shall consist of zero, one or more octets, and shall encode the data value as specified in subsequent clauses. NOTE – The contents octets depend on the type of the data value; subsequent clauses follow the same sequence as the definition of types in ASN.1. 8.1.5 End-of-contents octets The end-of-contents octets shall be present if the length is encoded as specified in 8.1.3.6, otherwise they shall not be present. The end-of-contents octets shall consist of two zero octets. NOTE – The end-of-contents octets can be considered as the encoding of a value whose tag is universal class, whose form is primitive, whose number of the tag is zero, and whose contents are absent, thus: End-of-contents Length Contents 0016 0016 Absent- Throws:
IOException
-
readByte
- Throws:
IOException
-
readFully
- Throws:
IOException
-
getPosition
private long getPosition() -
read
- Throws:
IOException
-
readOID
-
getPayloadLength
- Throws:
Exception
-
size
int size(long value) -
write
- Throws:
Exception
-
writePayload
- Throws:
Exception
-
putOid
- Throws:
IOException
-