ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Basic Encoding Rules - Wikipedia, the free encyclopedia

Basic Encoding Rules

From Wikipedia, the free encyclopedia

The Basic Encoding Rules (BER) is one of the encoding formats defined as part of the ASN.1 standard specified by the ITU in X.690.

Contents

[edit] Description

The Basic Encoding Rules were the original rules laid out by the ASN.1 standard for encoding abstract information into a concrete data stream. The rules, collectively referred to as a transfer syntax in ASN.1 parlance, specify the exact octet sequences which are used to encode a given data item. The syntax defines such elements as: the representations for basic data types, the structure of length information, and the means for defining complex or compound types based on more primitive types. The BER syntax, along with two subsets of BER (the Canonical Encoding Rules and the Distinguished Encoding Rules), are defined by the ITU-T's X.690 standards document, which is part of the ASN.1 document series.

[edit] Encoding

The BER format specifies a self-describing and self-delimiting format to encoding the ASN.1 data structures. Each data element is encoded as a type identifier, a length description, the actual data elements, and where necessary, an end-of-content marker. These types of encodings are commonly called type-length-value or TLV encodings. This format allows a receiver to decode the ASN.1 information from an incomplete stream, without requiring any pre-knowledge of the size, content, or semantic meaning of the data[1].

TLV encoding
1 2..2+n 2+n..2+n+length
Type Length Value (of given length)

The encoding of a PDU consists of cascaded TLV encodings, encapsulating types are SEQUENCE, SET and CHOICE.

[edit] Type

The type field is an octet specifying the characteristics of the value field.

Type identifier octet
8 7 6 5 4 3 2 1
Class P/C Number

If Class is set to Universal, the value is of a type native to ASN.1 (e.g. INTEGER). The Application class is only valid for one specific application. Context-specific depends on the context and private can be defined in private specifications

Class bits in a Type identifier octet
Class bit 8 bit 7
Universal 0 0
Application 0 1
Context-specific 1 0
Private 1 1

P/C is the primitive/constructed bit, it specifies if the value is primitive like an INTEGER or constructed which means, it again holds TLV values like a SET.

Number specifies the tag, i.e. of which exact kind the value is.

Universal Class Tags
Name P/C Number (decimal) Number (hex)
EOC (End-of-Content) P 0 0x00
BOOLEAN P 1 0x01
INTEGER P 2 0x02
BIT STRING P/C 3 0x03
OCTET STRING P/C 4 0x04
NULL P 5 0x05
OBJECT IDENTIFIER P 6 0x06
Object Descriptor P 7 0x07
EXTERNAL C 8 0x08
REAL (float) P 9 0x09
ENUMERATED P 10 0x0A
EMBEDDED PDV C 11 0x0B
UTF8String P/C 12 0x0C
RELATIVE-OID P 13 0x0D
SEQUENCE and SEQUENCE OF C 16 0x10
SET and SET OF C 17 0x11
NumericString P/C 18 0x12
PrintableString P/C 19 0x13
T61String P/C 20 0x14
VideotexString P/C 21 0x15
IA5String P/C 22 0x16
UTCTime P/C 23 0x17
GraphicString P/C 25 0x19
VisibleString P/C 26 0x1A
GeneralString P/C 27 0x1B
UniversalString P/C 28 0x1C
CHARACTER STRING P/C 29 0x1D
BMPString P/C 30 0x1E

[edit] Comparison to alternative formats

The key difference between the BER format and the CER or DER formats is the flexibility provided by the Basic Encoding Rules. As stated in the X.690 standard, "Alternative encodings are permitted by the basic encoding rules as a sender's option. Receivers who claim conformance to the basic encoding rules shall support all alternatives"[1]. For example, when encoding a constructed value (that is, a value that is made up of multiple smaller, already-encoded values), the sender can use one of three different forms to specify the length of the data[1]. A receiver must be prepared to accept all legal encodings in order to legitimately claim BER-compliance. By contrast, both CER and DER restrict the available length specifications to a single option.

There is a common perception of BER as being "inefficient" compared to alternative encoding rules. It has been argued by some that this perception is primarily due to poor implementations, not necessarily any inherent flaw in the encoding rules.[2] These implementations rely on the flexibility that BER provides to use encoding logic that is easier to implement, but results in a larger encoded data stream than necessary. Whether this inefficiency is reality or perception, it has led to a number of alternative encoding schemes, such as the Packed Encoding Rules, which attempt to improve on BER performance and size.

Other alternative formatting rules, which still provide the flexibility of BER but use alternative encoding schemes, are also being developed. The most popular of these are XML-based alternatives, such as the XML Encoding Rules and ASN.1 SOAP[3]. In addition, there is a standard mapping to convert an XML Schema to an ASN.1 schema, which can then be encoded using BER[4].

[edit] Usage

Despite its perceived problems, BER is a popular format for transmitting data, particularly in systems with different native data encodings.

  • The SNMP protocol specifies ASN.1 with BER as its required encoding scheme.
  • The digital signature standard PKCS #7 also specifies ASN.1 with BER to encode encrypted messages and their digital signature or digital envelope.
  • Many telecommunication systems, such as ISDN, toll-free call routing, and most cellular phone services use ASN.1 with BER to some degree for transmitting control messages over the network[5].
  • LDAP messages are encoded using BER.
  • GSM TAP (Transferred Account Procedures) files are encoded using BER. [1]

[edit] See also

[edit] Footnotes

  1. ^ a b c ITU-T X.690, ISO 8825-1
  2. ^ Lin, Huai-An. “Estimation of the Optimal Performance of ASN.1/BER Transfer Syntax”. ACM Computer Communication Review. July 93, 45 - 58.
  3. ^ ITU-T Rec. X.892, ISO/IEC 24824-2
  4. ^ ITU-T X.694, ISO/IEC ISO/IEC 8825-5
  5. ^ ASN.1 Uses

[edit] External links

[edit] References

This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -