Hi,

Look at http://www.oss.com/asn1/booksintro.html for downloadable books.

You find in "ASN.1 - Communication between heterogeneous systems"
by Olivier Dubuisson 

<cite>
18.2.8 OBJECT IDENTIFIER value
The encoding is always in primitive form. It is the number associated
with each arc that is encoded but not the identifiers. Every integer is
encoded on a series of octets where all the bits no. 7 but for the last
octet
equals 1. The encoding of the integer is therefore the concatenation of
the bits from no. 6 down to no. 0 for each octet (this form is similar
to the long-form encoding of the tag octets presented in Figure 18.2 on
page 396).
The first two arcs of the registration tree (see Figure 10.4 on
page 161) are encoded on a single integer using the formula  
`first arc x 40 + second arc', which assumes 8 that there is no more than 39
arcs just
below the iso and itu-t arcs of the root. No limitation, however, is
imposed on the number of arcs under joint-iso-itu-t.
The decoding of the first content octet should therefore be carried
out according to Table 18.1. Nevertheless, the decoder does not always
need to decode an object identifier: it may only concatenate the content
octets and compare the resulting string with those associated with the
various syntaxes negotiated by the Presentation layer (in the case of a
value embedded by one of the presentation context negotiation types of
Chapter 14).
</cite>

> I never decode OBJECT ID before, so please
> help me with the following questions.
> 
> > itu-t (0) recommendation (0) h (8) 245 version (0) 2
> > 1) 40 * 0 + 0 = 0
> 
> ===> Why 40? where 40 comes from? and why only 1 byte for 
> both "itu-t (0)
> recommendation (0)"? why not 2 bytes? 1 byte (0) for itu-t 
> and other byte
> (0) for recommendation?

I don't know why, but is only one byte.

E.g. {iso(1) org(3) dod(6) internet(1) private(4) enterprise(1)
intershop(5785)}
gives:

40 * 1 + 3 = 43 = 0x2B

> > 2) 8
> > 3+4) 245 = 11110101B => 1 0000001 0 1110101 = F1 75
> 
> ===> How "11110101B" is converted to "1 0000001 0 1110101"?

The bit 7 marks the using - if 1 the next byte is also part of the number. 
So there are only 7 bits (=127) to use in one byte.
5785 = 1011010011001 => 13 bit => 2Bytes needed
=> 1 0101101 0 0011001          => AD 19
   ^         ^         inserted

> > 5) 0
> > 6) 2
> 
> 
> Thanks!
> 
> Justin
> 
> 
> -----Original Message-----
> From: Sathya[IT] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 15, 2001 3:35 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [ASN.1] itu-t (0) recommendation (0) h (8) 245 
> version (0)
> 2
> 
> 
> Hi Bernd,
> 
> While I encode this, the octets turn out to be 00 08 81 75 00 02
> 
> I dont understand how you arrived at f1 instead of 81. Is there a
> significance 
> for the deviation?
> 
> regards,
> 
> Sathya Narayanan S
> RPG Cellular Services Limited
> GSM : +91 98410 48051
> 
> > -----Original Message-----
> > From:       Bernd Kunze 
> > Sent:       Monday, November 05, 2001 9:15 PM
> > To: '[EMAIL PROTECTED]'
> > Subject:    RE: [ASN.1] itu-t (0) recommendation (0) h (8) 
> 245 version
> > (0) 2
> > 
> > Hi,
> > 
> > itu-t (0) recommendation (0) h (8) 245 version (0) 2
> > 
> > 1) 40 * 0 + 0 = 0
> > 2) 8
> > 3+4) 245 = 11110101B => 1 0000001 0 1110101 = F1 75
> > 5) 0
> > 6) 2
> > 
> > => 00 08 F1 75 00 02
> > 
> > Bernd
> 

Reply via email to