On Sat, 2 Feb 2002, naoki hashimoto wrote: > Hi All, > > My question is regarding PER encoding of open type field to be NULL > type. > > Is "myvalue" encoded as follows( in aligned PER )? > > 0x00 0x01 0x02 > > 0x00 : lenght of open type field encoding > 0x01 0x02 : INTEGER value encoding
NULL encodes to no bits. However, X.691 clause 10.1.3 which talks about how to produce a "complete encoding" states: [...] If the result of encoding the outermost value is an empty bit string, the bit string shall be replaced with a single octet with all bits set to 0. [...] NOTE - The encoding of the outermost value is the empty bit string if, for example, the abstract syntax value is of the null type or of an integer type constrained to a single value. and X.691 clause 10.2.1 which talks about how to encode an open type states: In order to encode an open type field, the value of the actual type occupying the field shall be encoded to a field-list which shall then be converted to a complete encoding specified in 10.1 to produce an octet string of length "n" (say). In other words, 10.2.1 is saying that first you encode the value of the actual type, which in this case is NULL. Since NULL always encodes to zero bits, you will end up with zero bits at this point in the encoding process. However, 10.2.1 then goes on to say that the value shall next be encoded to a field-list which then gets converted into a complete encoding, and as you can see in 10.1.3, if the result of encoding the outermost value (in this case, NULL) is an empty bit string, the bit string gets replaced with a single octet of 0. Thus, the encoding you show above is incorrect, and the correct encoding is: 0x01 0x00 : open type encoding of NULL:NULL 0x01 0x02 : INTEGER value encoding ------------------------------------------------------------------------- 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 > NULLSETTING DEFINITIONS AUTOMATIC TAGS ::= BEGIN > > myvalue DefMsg ::={ > msgtype NULL:NULL, > msgid 2 > } > > -- *************************************************** > -- Message > -- *************************************************** > > DefMsg ::= SEQUENCE{ > msgtype DEFCLASS.&Open ({ObjSet}{@msgid}), > msgid DEFCLASS.&id ({ObjSet}) > } > > -- *************************************************** > -- information object class > -- *************************************************** > > DEFCLASS ::= CLASS > { > &Open , > &id INTEGER UNIQUE > } > WITH SYNTAX > { > OPEN &Open > ID &id > } > > -- *************************************************** > -- information object & set > -- *************************************************** > > ObjSet DEFCLASS ::= { > objfirst | objsecond, ... > } > > objfirst DEFCLASS ::= { > OPEN BOOLEAN > ID 1 > } > > objsecond DEFCLASS ::= { > OPEN NULL > ID 2 > } > > END > > > Thanks for all > > > Naoki Hahsimoto > [EMAIL PROTECTED] >
