Hi Divya,

 

The 2 null bytes (0x00) at the end are, may be, indicating end of contents for some parameter.

Are you sure there is no length field for some parameter, before the bytes you have sent, in which length is specified as EOC-encoded.

 

Thanks and Best Regards,

Vishal.

==================

Every time you try to operate on of these weird black controls that are labelled in black on a black background, a little black light lights up black to let you know you've done it. - The Restaurant at the End of The Universe

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Divya
Sent: Friday, May 13, 2005 10:43 AM
To: [email protected]
Subject: [ASN1] BER decoding question

 

 

Hi,

    I have the following data type, which is encoded using BER.

 

Component ::=   CHOICE {

    invoke              [1] IMPLICIT Invoke,

    returnResultLast    [2] IMPLICIT ReturnResult,

    returnError         [3] IMPLICIT ReturnError,

    reject              [4] IMPLICIT Reject,

    returnResultNotLast [7] IMPLICIT ReturnResult

}

 

ReturnResult ::=  SEQUENCE {

    invokeID    INTEGER (-128..127),

 

    result  SEQUENCE {

        operationCode   CHOICE {

            localValue INTEGER,

            globalValue OBJECT IDENTIFIER

        },

        parameter  OCTET STRING (SIZE(1..255))

    } OPTIONAL

}

 

    I recieved the following byte stream as the encoding for this structure.

    0xa2 0x0d 0x02 0x01 0x00 0x30 0x06 0x02 0x01 0x0e 0x80 0x01 0x04 0x00 0x00

 

    This can be decoded as:

    0xa2: Tag for ReturnResult structure within Component (CNTX, CONS, 2)

    0x0d: Length of the contents = 13 bytes

        0x02: Integer tag (for invokeID)

        0x01: Length of the contents = 1 byte

        0x00: Value of invokeID = 0

 

        0x30: Sequence tag (for result)

        0x06: Length of the contents = 6 bytes

            0x02: Integer tag (for localValue)

            0x01: Length of the contents = 1 byte

            0x0e: Value of localValue = 0x0e

 

            Assumed tag (UNIV, PRIM, OCTETSTRING_TAG_CODE) and length of

            6 - 3 = 3 bytes

            0x80: parameter[0]

            0x01: parameter[1]

            0x04: parameter[2]

 

        0x00: ????

        0x00: ????

 

    As you can see, there are the 2 bytes of value 0 each left over. I

    wanted to know if this is a valid byte stream since my decode code gives

    an error when it reaches these 0.

 

    In this case, it is probably manageable since these extraneous bytes are

    coming at the end of the byte stream. But could I get a byte stream that

    contains such not-needed bytes in the middle of the byte stream ?

 

    Some light on what to do would be much appreciated.

 

    Regds,

    Divya

 

 

 

"SASKEN RATED THE BEST EMPLOYER IN THE COUNTRY by the BUSINESS TODAY Mercer Survey 2004"

 

 

                           SASKEN BUSINESS DISCLAIMER

This message may contain confidential, proprietary or legally Privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, Disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email

_______________________________________________

ASN1 mailing list

[email protected]

http://lists.asn1.org/mailman/listinfo/asn1

 

--

*****************************************************************

This email and any  files transmitted with  it  are  confidential

and  intended  solely  for the use of the individual or entity to

whom  they are addressed. Any opinions  expressed  in  the  email

are those of the individual and not necessarily the company.

 

This footnote also confirms that this message  has  been  scanned

for  viruses  and  dangerous  content  by the MailScanner, and is

believed to be clean.

*****************************************************************


--

*****************************************************************
This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom they are addressed. Any opinions expressed in the email
are those of the individual and not necessarily the company.

This footnote also confirms that this message has been scanned
for viruses and dangerous content by the MailScanner,
and is believed to be clean.
*****************************************************************
_______________________________________________
ASN1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to