On Wed, 13 Mar 2002, Paul Long wrote:

> I'm writing a PER library (for the second time). Got a question about
> character strings. If a string is supposed to be octet-aligned but has
> length 0, is "nothing" supposed to be encoded at the next octet boundary?
> IOW, is there supposed to be zero padding out to the next octet boundary if
> not already at an octet boundary? I'm guess that we just forget the whole
> octet-boundary thing if the length is 0 and not encode anything for the
> string itself (of course) or even do any padding.

How is the type constrained?  If there is no subtype constraint, the
length is encoded on an octet boundary.  If there is a constraint,
then it depends on the constraint as to whether alignment of the length
takes place.  If the constraint would typically result in alignment on
an octet boundary of the data and it is length 0, clause 10.9.3.3 states:

   NOTE 2 - The effect of making no addition in the case of "n" equals
   zero is that padding to an octet boundary does not occur when these
   procedures are invoked to add an octet-aligned-bit-field of zero
   length, unless required by 10.5.

-------------------------------------------------------------------------
Bancroft Scott                               Toll Free    :1-888-OSS-ASN1
OSS Nokalva                                  International:1-732-302-0750
[EMAIL PROTECTED]                                 Tech Support :1-732-302-9669 x-1
1-732-302-9669 x-200                         Fax          :1-732-302-0023
http://www.oss.com

Reply via email to