Reputation: 1931
I have been reading ASN.1 specification, but I am not quite sure what exactly does tag do in this notation schema, for example:
ETYPE-INFO-ENTRY ::= SEQUENCE {
etype [0] Int32,
salt [1] OCTET STRING OPTIONAL
}
In this representation, what information did the tags "0" and "1" convey? I had thought that the tags may serve as a indicator of the data type of the field, but it seems not, the ASN.1 specification says that the tags mainly serves as a label, is it that simple? In that sense, I can assign arbitrary tag numbers to fields, is that right? Thank you.
Upvotes: 0
Views: 151
Reputation: 1978
Tags identify types. Technically, they define types, but it may not be helpful to think of them that way.
Consider having two optional fields of type INTEGER. If they were just encoded using the tag for INTEGER, you couldn't distinguish them. By putting unique tags on them, you can.
Tagging is somewhat complicated, and this isn't the best place to try to explain them. We have two books listed on our resources page which are helpful. If you Google for them, you can find some earlier(?) editions available on-line for free. They should help you get a better handle on tags.
Upvotes: 2