The ASN.1 representaion for the encoding given below is as follows:

Address               SEQUENCE OF Aliases

Aliases ::= CHOICE {
  myString         IA5String(SIZE (1..128))(FROM ("0123456789No. *,")),
  myString1        BMPString(SIZE (1..256)),
  ...,
  myString2        IA5String(SIZE (1..512))
}

The Encoding is 02 40 03 00 74 00 65 00 73 00 74 01 00 43 42

The following is my understanding:

02 represents the number of iterations of Aliases, i.e 2 aliases will be 
present.

40: 0100 0000 :---- 0 is the extension bit, 1 represents that the first string 
is
myString1. The remaining bits are padding bits.

03: 0000 0011 :-------  Represents that there are 4 characters(3+1) in the 
string.

Since the string type is BMP, the range of alphabet is 65535, and hence each
character requires 32 bits to be encoded. Hence the four characters length is 
4*32
= 8 bytes which are

00 74 00 65 00 73 00 74 represent the BMP String "test".

You're correct except for writing 32 instead of 16. Your arithmetic is as if you meant to write 16, but you wrote 32.

The remaining bytes to be looked are 01 00 43 42 which are explained here again.

------------- 01 00 43 42 --------------

i.e 0000 0001 0000 0000 0100 0011 0100 0010
 
The first two bits(00) are used as extension bit and representing choice value.
Since the string's size can be between 1 to 128, the number of bits used for
decoding length determinant is 7. Hence 00 0001 0 are used for finding length
determinant. That is , the length is equal to 3,(2 + 1).
The string yet to be read is 000 0000 0100 0011 0100 0010.
Since the string can take values from "0123456789No. *,", i.e 13 values , 4 bits
will be used for encoding each character.
Say , is represented by 0,* by 1,. by 2,0 by 3,1 by 4, 2 by 5 and so on.
So, 101 can  be represented as 434 i.e 0100 0011 0100.
 
Please let me know if my understanding is correct.

There are 16 values in "0123456789No. *," not 13. Nonetheless, it remains true that 4 bits would be used per character. The transformation table would be

   blank 0
   *     1
   ,     2
   .     3
   0     4
   .....
   9    13
   N    14
   o    15

Thus 434 decodes as "0.0" not as "101"

  
One More thing,
This is an excerpt from ASN.1 complete by John Larmouth,

I'll try to answer that separately.

=====================================================================
Conrad Sigona                    Voice Mail     : 1-732-302-9669 x400
OSS Nokalva                      Fax            : 1-614-388-4156
[EMAIL PROTECTED]                   My direct line : 1-315-845-1773
_______________________________________________
ASN1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to