Slide 31 of 41
Notes:
When can you apply implicit tagging to a type? The answer is simple: if the type is an untagged CHOICE type (or a type reference to such a type), then it is illegal to apply implicit tagging. Under all other circumstances, both implicit and explicit tagging is legal.
If you think this through, it is the encoding of the outer-level tag that distinguishes the alternatives in the encoding of a CHOICE. If that tag is over-ridden for all alternatives with a single fixed tag, then clearly the encoding may become ambiguous, so it has to be made illegal. (The problem arises partly because a CHOICE type has no TLV wrapper of its own - the encoding is just the encoding of the chosen alternative.)
Note that once a CHOICE type has been (explicitly) tagged, then there are no restrictions on applying further tags which can be either implicit or explicit to the tagged CHOICE.
The other rule on tagging is when you are required to ensure that tags are distinct. This will be the last item covered in this tutorial, but the rules should by now be obvious (I hope!).
But first we need to address the case where there is no IMPLICIT or EXPLICIT keyword following a tag. If there is such a keyword, then as you might expect it determines the tagging. And as you might also expect, if there is no keyword, then the tagging is implicit or explicit depending on the module defaults, but perhaps not quite in the way you might expect. Let’s look at the rules ….