Dharshana Eswaran wrote:
Hi All,
Can anyone tell me the difference between IMPLICIT OCTET STRING AND OCTET
STRING?
In short, there's no such thing as IMPLICIT OCTET STRING.
The OCTET STRING is always OCTET STRING.
It only makes sense if the keyword "IMPLICIT" is used
in association with the tag value, such as in
SpecialString ::= [0] IMPLICIT OCTET STRING
And moreover, this has implications only for BER encoding.
Consider the following type:
Type1 ::= OCTET STRING
if you want to encode "DATUM" string using this type, you'll
have to produce the following Tag-Length-Value sequence:
04 05 44 41 54 55 4d
where
04 is a tag [UNIVERSAL 4], primitive
05 is a length of string "DATUM"
44 "D"
41 "A"
54 "T"
55 "U"
4d "M"
In contrast, if you have another type
Type2 ::= [3] IMPLICIT OCTET STRING
this means that the tag [3] is applied instead of the
usual [UNIVERSAL 4] tag of the bare OCTET STRING type.
The "DATUM" string will have to be encoded as:
83 05 44 41 54 55 4d
where
83 is a tag [3] in primitive form
05 is a length of string "DATUM"
44 "D"
41 "A"
54 "T"
55 "U"
4d "M"
You can also see something like
Type3 ::= [PRIVATE 8] EXPLICIT OCTET STRING
which tells that the encoding should produce both tags,
the tag [PRIVATE 8] and the tag for OCTET STRING:
e8 07 04 05 44 41 54 55 4d
where
e8 is a tag [PRIVATE 4] in constructed form
07 is a length of underlying TLV
04 is a tag [UNIVERSAL 4], primitive
05 is a length of string "DATUM"
44 "D"
41 "A"
54 "T"
55 "U"
4d "M"
You may also encounter tagged types as types of members
of constructed types:
Type4 ::= SEQUENCE {
field1 [0] OCTET STRING,
field2 [PRIVATE 8] IMPLICIT OCTET STRING,
field3 [APPLICATION 13] EXPLICIT OCTET STRING
}
for which the same BER encoding rules apply.
The tagging has almost no effect on encoding of XER and PER.
--
Lev Walkin
[EMAIL PROTECTED]
_______________________________________________
Asn1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1