Hello ,
 
With an example I'll try to explain this to you! 
 
Suppose 
xx-OIDVal  OBJECT IDENTIFIER ::=  {1 3 12 2 1107 3 66 3 1}
if you observe the above OID, there is one arc with value 1107 (: which cannot be fit into one byte), So the tool which you are using to generate the code (ASN.1 --> cpp) will make it as 2 or more byte according to ASN.1 standards
 
let us take number 1107 as first e.g
1107  = 0x453 = 10001010011 ( encoded as 0x88 0x53
 
Step1) Take the number in binary format 10001010011  and try to group it into 7 bits(from right --> left ) like below
 1000  1010011
 
Step2)
Add 0( boolean) to left most bits if the number of bits are less than 7
then
    0001000  1010011
 
Step3)
 
make 7 bits as byte( 8 bits ) following the below rules
Rule a) if there is any spill of the number make 8 th bit as 1
Rule b) else set 8 th bit to 0(zero:boolean)
 
After applying the above rules
 
 The number becomes as below
    Second byte becomes  01010011 (=0x53)
  First byte becomes   10001000 (=0x88)
 
 
xx-anotherOIDVal  OBJECT IDENTIFIER ::=  {2 3 12 2 9999999 3 66 3 1} equals to
  {0x53,0x0C,0x02,0x84,0xE2,0xAC,0X7F,0x03,0x42,0x03,0x01}
 
let's take another e.g. and if we apply the above algo.
9999999 ( decimal )
= 0x98967F
= 100110001001011001111111
~= 100   1100010  0101100  1111111   (Step1)
~= 0000100   1100010  0101100  1111111 (Step2 : Added 4 zeros-boolean)
~= 10000100   11100010  10101100  01111111 (Step3:making above number to bytes)
=    0x84       0xE2     0xAC      0X7F
 
In the above e.g. if you see the length of "xx-anotherOIDVal"  the tool will give
9 but not 11. If you observe the first two arc's in the OID they are encoded differently. ( i.e. 2,3 are encoded as 0x53 in one byte!!)
 
 
Warm regards,
Vasa
 
 
 
 
   
 
 
 
-----Original Message-----
From: nigar [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 23, 2002 9:02 AM
To: [EMAIL PROTECTED]
Subject: [ASN.1] ASN1OBJID clarification

Hello
 
I have a baisc doubt on how the values of the ASN1OBJID is interpreted.
see ASN1OBJID { x00, x11, x86, x05, x01, x01, x01}
so when i assigned, this value to one varable, and then check the hex dump
for that, the variable is taking a legth of 8 bytes. why? and the x86 value
takes 2bytes - x80,x06.
please guide me, i some how want the variable to take x86, and not x80,x06.
 
Regards
Nigar

Reply via email to