BER - Basic Encoding Rules: Introduction
- BER is a simple encoding scheme which works via Type-Length-Value
- Type represents the type of data
- Length represents the length of the data in octets
- Value represents the actual data
Type
- Usually 1 byte
- Bits 6,7 indicate the class. 00=universal; 01=application; 10=context specific; 11=private
- Bit 5 indicates the form; 0=primative; 1=constucted
- Bits 0-4 indicate the Tag or Type of Data
Hex | Type |
1 | boolean |
2 | integer |
3 | bit string |
4 | octet string |
5 | null |
6 | object identifier |
9 | real |
10 | sequence of (e.g. array) |
16 | iasstring |
1A | visible string |
- If all 5 bits of the type are set to 1 indicates a custom type
Length
- 3 ways to encode length
- short, long, indefinite