aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/asn1_SUITE_data/ParamBasic.asn1
blob: d203b6c816c1ea1d4dafe32d6bcb33bcab5957d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
ParamBasic DEFINITIONS AUTOMATIC TAGS ::=

BEGIN

General1{T,T:val} ::= SEQUENCE {
  number  INTEGER,
  string  T DEFAULT val
}

T11 ::= General1{PrintableString,"hej"}

T12 ::= General1{BIT STRING,'1010'B}

General2{T} ::= SEQUENCE {
  number  INTEGER,
  string  T
}

T21 ::= General2{PrintableString}

T22 ::= General2{BIT STRING}


--
-- Test a class parameter that is the governor for another parameter.
--

AlgorithmIdentifier{ALGORITHM-TYPE, ALGORITHM-TYPE:AlgorithmSet} ::=
  SEQUENCE {
     algorithm  ALGORITHM-TYPE.&id   ({AlgorithmSet}),
     type       ALGORITHM-TYPE.&Type ({AlgorithmSet}{@algorithm})
  }

AnAlgorithm ::= AlgorithmIdentifier{ SIGNATURE-ALGORITHM,
	                             { {KEY 1 CONTAINING INTEGER} |
				       {KEY 2 CONTAINING BOOLEAN} } }

SIGNATURE-ALGORITHM ::= CLASS {
    &id    INTEGER UNIQUE,
    &Type
} WITH SYNTAX {
    KEY &id CONTAINING &Type
}

alg-seq-1 AnAlgorithm ::= { algorithm 1, type 42 }
alg-seq-2 AnAlgorithm ::= { algorithm 2, type TRUE }

--
-- Test that indirect classes references are resolved.
--

AlgorithmIdentifier2 { ALGORITHM-IDENTIFIER:InfoObjectSet } ::= SEQUENCE {
  algorithm ALGORITHM-IDENTIFIER.&id({InfoObjectSet}),
  parameters ALGORITHM-IDENTIFIER.&Type({InfoObjectSet} {@algorithm}) OPTIONAL
}

ALGORITHM-IDENTIFIER ::= TYPE-IDENTIFIER

Seq ::= SEQUENCE {
  c1 AlgorithmIdentifier2 {{ObjectSet-1}},
  c2 AlgorithmIdentifier2 {{ObjectSet-2}}
}

ObjectSet-1 ALGORITHM-IDENTIFIER ::= { {INTEGER IDENTIFIED BY {2 1 1}}, ... }
ObjectSet-2 ALGORITHM-IDENTIFIER ::= { ... }

-- Test a value that uses the instantiation of a parameterized type inline.
-- (Adapted from PKCS-5.)
--

algid-hmacWithSHA1 AlgorithmIdentifier2 {{ObjectSet-3}} ::=
  {algorithm id-hmacWithSHA1, parameters NULL : NULL}

ObjectSet-3 TYPE-IDENTIFIER ::= { {NULL IDENTIFIED BY id-hmacWithSHA1} }

id-hmacWithSHA1 OBJECT IDENTIFIER ::= {2 9 9 9 7}

END