I've been using implicit tagging with named fields following the examples in #45, but how can I build a schema for an sequence with an arbitrary number of homogeneous items?
Consider this as an example:
CargoMessageSet ::= SEQUENCE OF Message
Message ::= OCTET STRING
I can get it to work with explicit tagging using the following code:
const ASN1_SCHEMA = new asn1js.Sequence({
name: 'CargoMessageSet',
value: [
new asn1js.Repeated({
name: 'message_set',
value: new asn1js.OctetString({ name: 'message' }),
}),
],
});
But how can I get it to work with implicit tagging? I tried the code below:
const ASN1_SCHEMA = new asn1js.Sequence({
name: 'CargoMessages',
value: [
new asn1js.Repeated({
name: 'message_set',
value: new asn1js.Primitive({ idBlock: {tagClass: 3}, name: 'message' }),
}),
],
});
However, that schema only works when there's zero or one items. If there are two or more, asn1js.verifySchema() fails without giving an explanation: .result is a Sequence instance with no errors or warnings, and a single item.
I've been using implicit tagging with named fields following the examples in #45, but how can I build a schema for an sequence with an arbitrary number of homogeneous items?
Consider this as an example:
I can get it to work with explicit tagging using the following code:
But how can I get it to work with implicit tagging? I tried the code below:
However, that schema only works when there's zero or one items. If there are two or more,
asn1js.verifySchema()
fails without giving an explanation:.result
is aSequence
instance with no errors or warnings, and a single item.