7 IMPORTS HEIM_ANY FROM heim;
9 -- Check that we handle out of order definitions.
10 -- The compiler should emit the definition of TESTOutOfOrderBar before that of
12 TESTOutOfOrderFoo ::= SEQUENCE {
16 TESTOutOfOrderBar ::= SEQUENCE {
20 -- Check that we can handle rpc.mountd style "lists". This is unnecessarily
21 -- inefficient in its encoding, and there's no point to using this over
22 -- SEQUENCE OF (arrays), but it's neat that we can do this now that we can do
23 -- out of order definitions.
25 -- This could be useful if we ever extend asn1_compile to also handle XDR,
26 -- which we well might since XDR's syntax is a dual of a strict subset of
27 -- ASN.1, and since XDR the encoding is fairly straightforward.
29 -- Note that the `next' member has to be OPTIONAL for this to work.
30 TESTCircular ::= SEQUENCE {
32 next TESTCircular OPTIONAL
35 TESTDefault ::= SEQUENCE {
36 name UTF8String DEFAULT "Heimdal",
37 version [0] TESTuint32 DEFAULT 8,
38 maxint TESTuint64 DEFAULT 9223372036854775807,
39 works BOOLEAN DEFAULT TRUE
42 TESTuint32 ::= INTEGER (0..4294967295)
43 TESTuint64 ::= INTEGER(0..9223372036854775807)
44 TESTint64 ::= INTEGER(-9223372036854775808..9223372036854775807)
46 TESTLargeTag ::= SEQUENCE {
47 foo[127] INTEGER (-2147483648..2147483647),
48 bar[128] INTEGER (-2147483648..2147483647)
51 TESTSeq ::= SEQUENCE {
52 tag0[0] INTEGER (-2147483648..2147483647),
54 tagless INTEGER (-2147483648..2147483647),
55 tag3[2] INTEGER (-2147483648..2147483647)
58 TESTChoice1 ::= CHOICE {
59 i1[1] INTEGER (-2147483648..2147483647),
60 i2[2] INTEGER (-2147483648..2147483647),
64 TESTChoice2 ::= CHOICE {
65 i1[1] INTEGER (-2147483648..2147483647),
69 TESTInteger ::= INTEGER (-2147483648..2147483647)
71 TESTInteger2 ::= [4] IMPLICIT TESTInteger
72 TESTInteger3 ::= [5] IMPLICIT TESTInteger2
74 TESTImplicit ::= SEQUENCE {
75 ti1[0] IMPLICIT INTEGER (-2147483648..2147483647),
76 ti2[1] IMPLICIT SEQUENCE {
77 foo[127] INTEGER (-2147483648..2147483647)
79 ti3[2] IMPLICIT [5] IMPLICIT [4] IMPLICIT INTEGER (-2147483648..2147483647)
82 TESTImplicit2 ::= SEQUENCE {
83 ti1[0] IMPLICIT TESTInteger,
84 -- ti2[1] IMPLICIT TESTLargeTag, this is disabled since the IMPLICT encoder does't get the types right when stepping inside an structure --
85 ti3[2] IMPLICIT TESTInteger3,
86 ti4[51] IMPLICIT TESTInteger OPTIONAL
89 TESTImplicit3 ::= CHOICE {
90 ti1[0] IMPLICIT INTEGER (-2147483648..2147483647),
91 ti2[5] IMPLICIT CHOICE { i1[1] INTEGER (-2147483648..2147483647) }
94 TESTImplicit4 ::= CHOICE {
95 ti1[0] IMPLICIT INTEGER (-2147483648..2147483647),
96 ti2[5] IMPLICIT TESTChoice2
99 TESTAllocInner ::= SEQUENCE {
103 TESTAlloc ::= SEQUENCE {
104 tagless TESTAllocInner OPTIONAL,
105 three [1] INTEGER (-2147483648..2147483647),
106 tagless2 HEIM_ANY OPTIONAL
109 TESTOptional ::= SEQUENCE {
110 zero [0] INTEGER (-2147483648..2147483647) OPTIONAL,
111 one [1] INTEGER (-2147483648..2147483647) OPTIONAL
115 TESTCONTAINING ::= OCTET STRING ( CONTAINING INTEGER )
116 TESTENCODEDBY ::= OCTET STRING ( ENCODED BY
117 { joint-iso-itu-t(2) asn(1) ber-derived(2) distinguished-encoding(1) }
120 testDer OBJECT IDENTIFIER ::= {
121 joint-iso-itu-t(2) asn(1) ber-derived(2) distinguished-encoding(1)
124 testContainingEncodedBy ::= OCTET STRING ( CONTAINING INTEGER ENCODED BY
125 { joint-iso-itu-t(2) asn(1) ber-derived(2) distinguished-encoding(1) }
128 testContainingEncodedBy2 ::= OCTET STRING (
129 CONTAINING INTEGER ENCODED BY testDer
133 testValue1 INTEGER ::= 1
135 testUserConstrained ::= OCTET STRING (CONSTRAINED BY { -- meh -- })
136 -- TESTUSERCONSTRAINED2 ::= OCTET STRING (CONSTRAINED BY { TESTInteger })
137 -- TESTUSERCONSTRAINED3 ::= OCTET STRING (CONSTRAINED BY { INTEGER })
138 -- TESTUSERCONSTRAINED4 ::= OCTET STRING (CONSTRAINED BY { INTEGER : 1 })
140 TESTSeqOf ::= SEQUENCE OF TESTInteger
142 TESTSeqSizeOf1 ::= SEQUENCE SIZE (2) OF TESTInteger
143 TESTSeqSizeOf2 ::= SEQUENCE SIZE (1..2) OF TESTInteger
144 TESTSeqSizeOf3 ::= SEQUENCE SIZE (1..MAX) OF TESTInteger
145 TESTSeqSizeOf4 ::= SEQUENCE SIZE (0..2) OF TESTInteger
147 TESTOSSize1 ::= OCTET STRING SIZE (1..2)
149 TESTSeqOfSeq ::= SEQUENCE OF SEQUENCE {
153 TESTSeqOfSeq2 ::= SEQUENCE OF SEQUENCE {
154 string [0] GeneralString
157 TESTSeqOfSeq3 ::= SEQUENCE OF SEQUENCE {
158 zero [0] TESTInteger,
159 string [0] GeneralString
162 TESTSeqOf2 ::= SEQUENCE {
163 strings SEQUENCE OF GeneralString
166 TESTSeqOf3 ::= SEQUENCE {
167 strings SEQUENCE OF GeneralString OPTIONAL
170 -- Larger/more complex to increase odds of out-of-bounds
171 -- read/writes if miscoded
173 TESTSeqOf4 ::= SEQUENCE {
174 b1 [0] SEQUENCE OF SEQUENCE {
180 b2 [1] IMPLICIT SEQUENCE OF SEQUENCE {
188 b3 [2] IMPLICIT SEQUENCE OF SEQUENCE {
200 TESTSeqOf5 ::= SEQUENCE {
224 TESTPreserve ::= SEQUENCE {
225 zero [0] TESTInteger,
229 TESTBitString ::= BIT STRING {
235 TESTBitString64 ::= BIT STRING {
243 TESTLargeBitString ::= BIT STRING {
247 onehundredtwenty(120)
250 TESTMechType::= OBJECT IDENTIFIER
251 TESTMechTypeList ::= SEQUENCE OF TESTMechType
255 _EXTENSION ::= CLASS {
256 &id OBJECT IDENTIFIER UNIQUE,
258 &Critical BOOLEAN DEFAULT FALSE
261 TESTExtension{_EXTENSION:ExtensionSet} ::= SEQUENCE {
262 extnID _EXTENSION.&id({ExtensionSet}),
264 -- (EXTENSION.&Critical({ExtensionSet}{@extnID}))
266 extnValue OCTET STRING (CONTAINING
267 _EXTENSION.&ExtnType({ExtensionSet}{@extnID}))
270 id-test-default OBJECT IDENTIFIER ::= { 1 2 3 4 }
271 testext-TESTDefault _EXTENSION ::= {
274 &ExtnType TESTDefault
277 -- And Here's an object set for the EXTENSION CLASS collecting a bunch of
278 -- related extensions (here they are the extensions that certificates can
279 -- carry in their extensions member):
280 TestExtensions _EXTENSION ::= { testext-TESTDefault }
282 TESTExtension ::= TESTExtension { TestExtensions }
284 TESTExtensible ::= SEQUENCE {
286 extensions SEQUENCE OF TESTExtension
289 TESTDecorated ::= SEQUENCE {
291 -- gets decorated with varius fields (see test.opt)
294 TESTNotDecorated ::= SEQUENCE {
296 -- should have the same encoding as TESTDecorated
299 TESTDecoratedChoice ::= CHOICE {
301 -- gets decorated with varius fields (see test.opt)
304 TESTNotDecoratedChoice ::= CHOICE {
306 -- should have the same encoding as TESTDecoratedChoice