----- Original Message ----- From: "Rajul Gupta" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 01, 2002 10:15 AM Subject: Re: [ASN.1] BER: minimum number of bytes?
> > ----- Original Message ----- > From: "Sim. Ja." <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, October 01, 2002 9:16 AM > Subject: [ASN.1] BER: minimum number of bytes? > > > > Hi folk, > > > > I hope, you could confirm this statement. > > Given an element description as below > > cug-Index [17] IMPLICIT INTEGER ( 0 .. 32767 ) OPTIONAL, > > > > if the value to be encoded is 0x0a, which needs only one byte in BER, > > I must use one byte for a minimum encoding. One of the member in the list pointed me that, I misinterpreted your question before. I think you were asking, if an alternative way of encoding 0A in BER can be 91 02 00 0A instead of 91 01 0A If this is the question, then answer is NO. Look at page # 278 of ASN.1 standards http://ties.itu.int/ftp/asn1/asn.1-2002-july-16-2002.pdf Section 8.3 for Encoding of an Integer value explains that integer value should always be encoded in the smallest possible number of octets. Rajul > I don't think you can encode above in one byte. You need three bytes for BER > (91 01 0A) and two for PER (00 0A). Also, your value range is between 0 and > 32767, which can't fit in one byte for all the possible values. > > Rajul > > > Thanks in advance > > Simin > > > > PS: The alternative is to see the space reserved for this value as always > > two bytes. > > > > __________________________________________________________________ > > > > Gesendet von Yahoo! Mail - http://mail.yahoo.de > > Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de > > > > > > >