Mark,
After automatic tagging, your ASN.1 specification
looks like this, assuming that type Transaction is
not a CHOICE or open type:
Message ::= SEQUENCE {
header [0] EXPLICIT Header,
trans [1] Transaction OPTIONAL
}
Header ::= CHOICE {
parmIndex [0] Index,
seqNum [1] SequenceNum
}
Except for component "header" in type Message,
all tagging is implicit.
Phil
Mark Mitchell wrote:
>
> Hi there,
>
> We have been looking at ASN.1 (BER) for a while and there are a couple of
> things we're not sure about, so we were wondering if anyone could help us
> out?
>
> If an ASN.1 module uses automatic tagging, and the following is part of the
> specification:
>
> Message ::= SEQUENCE
> {
> header Header,
> trans Transaction OPTIONAL
> }
>
> Header ::=CHOICE
> {
> parmIndex Index,
> seqNum SequenceNum
> }
>
> Index ::= OCTET STRING(SIZE(4))
>
> SequenceNum ::= OCTET STRING(SIZE(4))
>
> Would the correct encoding of a seqNum be
>
> 3080 (open Message)
> A080 (open Header)
> 810401020304 (tag for seqNum followed by length and value)
> 0000
> 0000
>
> or
>
> 3080 (open Message)
> A080 (open Header)
> A180 (external tag for seqNum)
> 040401020304 (internal tag for seqNum followed by
> length and value)
> 0000
> 0000
> 0000
>
> i.e. does the fact that a CHOICE needs to be explicitly tagged mean that the
> seqNum has an
> 'external' and 'internal' tag?
>
> If the first encoding option above is correct, how would the encoding differ
> if Header
> was a SEQUENCE (and parmIndex was OPTIONAL)?
>
> Thanks in advance for your help.
>
> Regards,
>
> Mark Mitchell
>
> -------
> Mark Mitchell
> Voice Networking Group
> Data Connection Ltd
> Tel: +44 20 8366 1177
> Fax: +44 20 8363 1468
> Email: [EMAIL PROTECTED]
> Web: http://www.dataconnection.com
--
Phil
----
Phillip H. Griffin Griffin Consulting
http://asn-1.com Secure ASN.1 Design & Implementation
p: +1-919-832-7008 1625 Glenwood Avenue
f: +1-919-832-7390 Hayes Barton at Five Points
e: [EMAIL PROTECTED] Raleigh, North Carolina 27608-2319 USA
------------------------------------------------------------