summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/ieee1609dot2/Ieee1609Dot2.asn
blob: e9c557cd6ff4accce1c4e0e0f8a3dd38ee8b0abf (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
-- https://forge.etsi.org/rep/ITS/asn1/ieee1609.2/-/blob/ieee/Ieee1609Dot2.asn
--***************************************************************************--
--                              IEEE Std 1609.2                              --
--***************************************************************************--

/**
 * @note Section references in this file are to clauses in IEEE Std
 * 1609.2 unless indicated otherwise. Full forms of acronyms and
 * abbreviations used in this file are specified in 3.2.
 */

Ieee1609Dot2 {iso(1) identified-organization(3) ieee(111)
  standards-association-numbered-series-standards(2) wave-stds(1609)
  dot2(2) base(1) schema(1) major-version-2(2) minor-version-6(6)}

DEFINITIONS AUTOMATIC TAGS ::= BEGIN

IMPORTS
  CERT-EXT-TYPE,
  CrlSeries,
  EccP256CurvePoint,
  EcencP256EncryptedKey,
  EciesP256EncryptedKey,
  EncryptionKey,
  EXT-TYPE,
  Extension,
  ExtId,
  GeographicRegion,
  GroupLinkageValue,
  HashAlgorithm,
  HashedId3,
  HashedId8,
  HashedId32,
  HashedId48,
  Hostname,
  IValue,
  LinkageValue,
  Opaque,
  Psid,
  PsidSsp,
  PsidSspRange,
  PublicEncryptionKey,
  PublicVerificationKey,
  SequenceOfHashedId3,
  SequenceOfPsidSsp,
  SequenceOfPsidSspRange,
  ServiceSpecificPermissions,
  Signature,
  SubjectAssurance,
  SymmetricEncryptionKey,
  ThreeDLocation,
  Time64,
  Uint3,
  Uint8,
  Uint16,
  Uint32,
  ValidityPeriod
FROM Ieee1609Dot2BaseTypes {iso(1) identified-organization(3) ieee(111)
  standards-association-numbered-series-standards(2) wave-stds(1609) dot2(2)
  base(1) base-types(2) major-version-2(2) minor-version-4(4)}
WITH SUCCESSORS

  EtsiOriginatingHeaderInfoExtension
FROM EtsiTs103097ExtensionModule {itu-t(0) identified-organization(4) etsi(0) 
  itsDomain(5) wg5(5) secHeaders(103097) extension(2) major-version-1(1)
  minor-version-0(0)}
WITH SUCCESSORS
;

--***************************************************************************--
--                               Secured Data                                --
--***************************************************************************--

/**
 * @brief This data type is used to contain the other data types in this
 * clause. The fields in the Ieee1609Dot2Data have the following meanings:
 *
 * @param protocolVersion: contains the current version of the protocol. The
 * version specified in this standard is version 3, represented by the
 * integer 3. There are no major or minor version numbers.
 *
 * @param content: contains the content in the form of an Ieee1609Dot2Content.
 *
 * @note Canonicalization: This data structure is subject to canonicalization
 * for the relevant operations specified in 6.1.2. The canonicalization 
 * applies to the Ieee1609Dot2Content.
 */
Ieee1609Dot2Data ::= SEQUENCE {
  protocolVersion Uint8(3),
  content         Ieee1609Dot2Content
}

/**
 * @brief In this structure:
 *
 * @param unsecuredData: indicates that the content is an OCTET STRING to be
 * consumed outside the SDS.
 *
 * @param signedData: indicates that the content has been signed according to
 * this standard.
 *
 * @param encryptedData: indicates that the content has been encrypted
 * according to this standard.
 *
 * @param signedCertificateRequest: indicates that the content is a 
 * certificate request signed by an IEEE 1609.2 certificate or self-signed.
 *
 * @param signedX509CertificateRequest: indicates that the content is a 
 * certificate request signed by an ITU-T X.509 certificate.
 *
 * @note Canonicalization: This data structure is subject to canonicalization 
 * for the relevant operations specified in 6.1.2 if it is of type signedData.
 * The canonicalization applies to the SignedData.
 */
Ieee1609Dot2Content ::=  CHOICE { 
  unsecuredData                Opaque, 
  signedData                   SignedData,
  encryptedData                EncryptedData,
  signedCertificateRequest     Opaque,
  ...,
  signedX509CertificateRequest Opaque
}

/**
 * @brief In this structure:
 *
 * @param hashId: indicates the hash algorithm to be used to generate the hash
 * of the message for signing and verification.
 *
 * @param tbsData: contains the data that is hashed as input to the signature.
 *
 * @param signer: determines the keying material and hash algorithm used to
 * sign the data.
 *
 * @param signature: contains the digital signature itself, calculated as
 * specified in 5.3.1.
 *   - If signer indicates the choice self, then the signature calculation
 * is parameterized as follows:
 *     - Data input is equal to the COER encoding of the tbsData field
 * canonicalized according to the encoding considerations given in 6.3.6.
 *     - Verification type is equal to self.
 *     - Signer identifier input is equal to the empty string.
 *   - If signer indicates certificate or digest, then the signature
 * calculation is parameterized as follows:
 *     - Data input is equal to the COER encoding of the tbsData field
 * canonicalized according to the encoding considerations given in 6.3.6.
 *     - Verification type is equal to certificate.
 *     - Signer identifier input equal to the COER-encoding of the
 * Certificate that is to be used to verify the SPDU, canonicalized according
 * to the encoding considerations given in 6.4.3.
 *
 * @note Canonicalization: This data structure is subject to canonicalization 
 * for the relevant operations specified in 6.1.2. The canonicalization 
 * applies to the ToBeSignedData and the Signature.
 */
SignedData ::= SEQUENCE { 
  hashId    HashAlgorithm,
  tbsData   ToBeSignedData,
  signer    SignerIdentifier,
  signature Signature
}

/**
 * @brief This structure contains the data to be hashed when generating or
 * verifying a signature. See 6.3.4 for the specification of the input to the
 * hash.
 *
 * @param payload: contains data that is provided by the entity that invokes
 * the SDS.
 *
 * @param headerInfo: contains additional data that is inserted by the SDS.
 * This structure is used as follows to determine the "data input" to the 
 * hash operation for signing or verification as specified in 5.3.1.2.2 or 
 * 5.3.1.3.
 *   - If payload does not contain the field omitted, the data input to the 
 * hash operation is the COER encoding of the ToBeSignedData. 
 *   - If payload field in this ToBeSignedData instance contains the field 
 * omitted, the data input to the hash operation is the COER encoding of the
 * ToBeSignedData, concatenated with the hash of the omitted payload. The hash
 * of the omitted payload is calculated with the same hash algorithm that is 
 * used to calculate the hash of the data input for signing or verification. 
 * The data input to the hash operation is simply the COER enocding of the 
 * ToBeSignedData, concatenated with the hash of the omitted payload: there is
 * no additional wrapping or length indication. As noted in 5.2.4.3.4, the 
 * means by which the signer and verifier establish the contents of the 
 * omitted payload are out of scope for this standard.
 *
 * @note Canonicalization: This data structure is subject to canonicalization 
 * for the relevant operations specified in 6.1.2. The canonicalization 
 * applies to the SignedDataPayload if it is of type data, and to the 
 * HeaderInfo.
 */
ToBeSignedData ::= SEQUENCE { 
  payload    SignedDataPayload,
  headerInfo HeaderInfo
}

/**
 * @brief This structure contains the data payload of a ToBeSignedData. This 
 * structure contains at least one of the optional elements, and may contain 
 * more than one. See 5.2.4.3.4 for more details.
 * The security profile in Annex C allows an implementation of this standard 
 * to state which forms of Signed�Data�Payload are supported by that 
 * implementation, and also how the signer and verifier are intended to obtain
 * the external data for hashing. The specification of an SDEE that uses 
 * external data is expected to be explicit and unambiguous about how this 
 * data is obtained and how it is formatted prior to processing by the hash 
 * function.
 *
 * @param data: contains data that is explicitly transported within the
 * structure.
 *
 * @param extDataHash: contains the hash of data that is not explicitly 
 * transported within the structure, and which the creator of the structure 
 * wishes to cryptographically bind to the signature. 
 *
 * @param omitted: indicates that there is external data to be included in the
 * hash calculation for the signature.The mechanism for including the external
 * data in the hash calculation is specified in 6.3.6.
 *
 * @note Canonicalization: This data structure is subject to canonicalization 
 * for the relevant operations specified in 6.1.2. The canonicalization 
 * applies to the Ieee1609Dot2Data.
 */
SignedDataPayload ::= SEQUENCE { 
  data        Ieee1609Dot2Data OPTIONAL,
  extDataHash HashedData OPTIONAL,
  ...,
  omitted     NULL OPTIONAL
} (WITH COMPONENTS {..., data PRESENT} |
   WITH COMPONENTS {..., extDataHash PRESENT} |
   WITH COMPONENTS {..., omitted PRESENT})


/**
 * @brief This structure contains the hash of some data with a specified hash
 * algorithm. See 5.3.3 for specification of the permitted hash algorithms.
 *
 * @param sha256HashedData: indicates data hashed with SHA-256.
 *
 * @param sha384HashedData: indicates data hashed with SHA-384.
 * 
 * @param sm3HashedData: indicates data hashed with SM3.
 *
 * @note Critical information fields: If present, this is a critical 
 * information field as defined in 5.2.6. An implementation that does not 
 * recognize the indicated CHOICE for this type when verifying a signed SPDU 
 * shall indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, 
 * that is, it is invalid in the sense that its validity cannot be established.
 */
HashedData::= CHOICE { 
  sha256HashedData HashedId32,
  ...,
  sha384HashedData HashedId48,
  sm3HashedData    HashedId32
}

/**
 * @brief This structure contains information that is used to establish
 * validity by the criteria of 5.2.
 *
 * @param psid: indicates the application area with which the sender is
 * claiming the payload is to be associated.
 *
 * @param generationTime: indicates the time at which the structure was
 * generated. See 5.2.5.2.2 and 5.2.5.2.3 for discussion of the use of this
 * field.
 *
 * @param expiryTime: if present, contains the time after which the data
 * is no longer considered relevant. If both generationTime and
 * expiryTime are present, the signed SPDU is invalid if generationTime is
 * not strictly earlier than expiryTime.
 *
 * @param generationLocation: if present, contains the location at which the
 * signature was generated.
 *
 * @param p2pcdLearningRequest: if present, is used by the SDS to request 
 * certificates for which it has seen identifiers and does not know the 
 * entire certificate. A specification of this peer-to-peer certificate 
 * distribution (P2PCD) mechanism is given in Clause 8. This field is used 
 * for the separate-certificate-pdu flavor of P2PCD and shall only be present 
 * if inlineP2pcdRequest is not present. The HashedId3 is calculated with the 
 * whole-certificate hash algorithm, determined as described in 6.4.3, 
 * applied to the COER-encoded certificate, canonicalized as defined in the 
 * definition of Certificate.
 *
 * @param missingCrlIdentifier: if present, is used by the SDS to request
 * CRLs which it knows to have been issued and have not received. This is
 * provided for future use and the associated mechanism is not defined in
 * this version of this standard.
 *
 * @param encryptionKey: if present, is used to provide a key that is to 
 * be used to encrypt at least one response to this SPDU. The SDEE 
 * specification is expected to specify which response SPDUs are to be 
 * encrypted with this key. One possible use of this key to encrypt a 
 * response is specified in 6.3.35, 6.3.37, and 6.3.34. An encryptionKey 
 * field of type symmetric should only be used if the SignedData containing 
 * this field is securely encrypted by some means.
 *
 * @param inlineP2pcdRequest: if present, is used by the SDS to request
 * unknown certificates per the inline peer-to-peer certificate distribution
 * mechanism is given in Clause 8. This field shall only be present if
 * p2pcdLearningRequest is not present. The HashedId3 is calculated with the
 * whole-certificate hash algorithm, determined as described in 6.4.3, applied
 * to the COER-encoded certificate, canonicalized as defined in the definition
 * of Certificate.
 *
 * @param requestedCertificate: if present, is used by the SDS to provide
 * certificates per the "inline" version of the peer-to-peer certificate
 * distribution mechanism given in Clause 8.
 *
 * @param pduFunctionalType: if present, is used to indicate that the SPDU is
 * to be consumed by a process other than an application process as defined
 * in ISO 21177 [B14a]. See 6.3.23b for more details.
 *
 * @param contributedExtensions: if present, is used to contain additional 
 * extensions defined using the ContributedExtensionBlocks structure.
 *
 * @note Canonicalization: This data structure is subject to canonicalization 
 * for the relevant operations specified in 6.1.2. The canonicalization
 * applies to the EncryptionKey. If encryptionKey is present, and indicates
 * the choice public, and contains a BasePublicEncryptionKey that is an
 * elliptic curve point (i.e., of type EccP256CurvePoint or 
 * EccP384CurvePoint), then the elliptic curve point is encoded in compressed
 * form, i.e., such that the choice indicated within the Ecc*CurvePoint is
 * compressed-y-0 or compressed-y-1.
 * The canonicalization does not apply to any fields after the extension 
 * marker, including any fields in contributedExtensions.
 */
HeaderInfo ::= SEQUENCE { 
  psid                  Psid,
  generationTime        Time64 OPTIONAL,
  expiryTime            Time64 OPTIONAL,
  generationLocation    ThreeDLocation OPTIONAL,
  p2pcdLearningRequest  HashedId3 OPTIONAL,
  missingCrlIdentifier  MissingCrlIdentifier OPTIONAL,
  encryptionKey         EncryptionKey OPTIONAL,
  ...,
  inlineP2pcdRequest    SequenceOfHashedId3 OPTIONAL,
  requestedCertificate  Certificate OPTIONAL,
  pduFunctionalType     PduFunctionalType OPTIONAL,
  contributedExtensions ContributedExtensionBlocks OPTIONAL
}

/**
 * @brief This structure may be used to request a CRL that the SSME knows to
 * have been issued and has not yet received. It is provided for future use
 * and its use is not defined in this version of this standard.
 *
 * @param cracaId: is the HashedId3 of the CRACA, as defined in 5.1.3. The 
 * HashedId3 is calculated with the whole-certificate hash algorithm, 
 * determined as described in 6.4.3, applied to the COER-encoded certificate,
 * canonicalized as defined in the definition of Certificate.
 *
 * @param crlSeries: is the requested CRL Series value. See 5.1.3 for more
 * information.
 */
MissingCrlIdentifier ::= SEQUENCE { 
  cracaId   HashedId3,
  crlSeries CrlSeries,
  ...
}

/**
 * @brief This data structure identifies the functional entity that is 
 * intended to consume an SPDU, for the case where that functional entity is 
 * not an application process, and are instead security support services for an
 * application process. Further details and the intended use of this field are 
 * defined in ISO 21177 [B20].
 *
 * @param tlsHandshake: indicates that the Signed SPDU is not to be directly 
 * consumed as an application PDU and is to be used to provide information 
 * about the holder�s permissions to a Transport Layer Security (TLS) 
 * (IETF 5246 [B15], IETF 8446 [B16]) handshake process operating to secure 
 * communications to an application process. See IETF [B15] and ISO 21177 
 * [B20] for further information.
 *
 * @param iso21177ExtendedAuth: indicates that the Signed SPDU is not to be 
 * directly consumed as an application PDU and is to be used to provide 
 * additional information about the holder�s permissions to the ISO 21177 
 * Security Subsystem for an application process. See ISO 21177 [B20] for 
 * further information.
 *
 * @param iso21177SessionExtension: indicates that the Signed SPDU is not to 
 * be directly consumed as an application PDU and is to be used to extend an 
 * existing ISO 21177 secure session. This enables a secure session to 
 * persist beyond the lifetime of the certificates used to establish that 
 * session.
 */
PduFunctionalType ::= INTEGER (0..255)

tlsHandshake             PduFunctionalType ::= 1
iso21177ExtendedAuth     PduFunctionalType ::= 2
iso21177SessionExtension PduFunctionalType ::= 3


/**
 * @brief This type is used for clarity of definitions.
 */
ContributedExtensionBlocks ::= SEQUENCE (SIZE(1..MAX)) OF
  ContributedExtensionBlock

/**
 * @brief This Information Object Class defines the class that provides a 
 * template for defining extension blocks.
 */
IEEE1609DOT2-HEADERINFO-CONTRIBUTED-EXTENSION ::= CLASS {
  &id   HeaderInfoContributorId UNIQUE,
  &Extn
} WITH SYNTAX {&Extn IDENTIFIED BY &id}

/**
 * @brief This data structure defines the format of an extension block
 * provided by an identified contributor by using the temnplate provided
 * in the class IEEE1609DOT2-HEADERINFO-CONTRIBUTED-EXTENSION constraint
 * to the objects in the set Ieee1609Dot2HeaderInfoContributedExtensions.
 *
 * @param contributorId: uniquely identifies the contributor.
 *
 * @param extns: contains a list of extensions from that contributor. 
 * Extensions are expected and not required to follow the format specified 
 * in 6.5.
 */
ContributedExtensionBlock ::= SEQUENCE {
  contributorId IEEE1609DOT2-HEADERINFO-CONTRIBUTED-EXTENSION.&id({
    Ieee1609Dot2HeaderInfoContributedExtensions
  }),
  extns         SEQUENCE (SIZE(1..MAX)) OF
    IEEE1609DOT2-HEADERINFO-CONTRIBUTED-EXTENSION.&Extn({
    Ieee1609Dot2HeaderInfoContributedExtensions
  }{@.contributorId})
}

/**
 * @brief This structure is an ASN.1 Information Object Set listing the 
 * defined contributed extension types and the associated 
 * HeaderInfoContributorId values. In this version of this standard two 
 * extension types are defined: Ieee1609ContributedHeaderInfoExtension and 
 * EtsiOriginatingHeaderInfoExtension.
 */
Ieee1609Dot2HeaderInfoContributedExtensions
  IEEE1609DOT2-HEADERINFO-CONTRIBUTED-EXTENSION ::= {
  {Ieee1609ContributedHeaderInfoExtension IDENTIFIED BY 
        ieee1609HeaderInfoContributorId} |
  {EtsiOriginatingHeaderInfoExtension IDENTIFIED BY
    etsiHeaderInfoContributorId},
  ...
}

/**
 * @brief This is an integer used to identify a HeaderInfo extension
 * contributing organization. In this version of this standard two values are
 * defined: 
 *   - ieee1609OriginatingExtensionId indicating extensions originating with 
 * IEEE 1609.
 *   - etsiOriginatingExtensionId indicating extensions originating with 
 * ETSI TC ITS.
 */
HeaderInfoContributorId ::= INTEGER (0..255)

ieee1609HeaderInfoContributorId HeaderInfoContributorId ::= 1
etsiHeaderInfoContributorId     HeaderInfoContributorId ::= 2


/**
 * @brief This structure allows the recipient of data to determine which
 * keying material to use to authenticate the data. It also indicates the
 * verification type to be used to generate the hash for verification, as
 * specified in 5.3.1.
 *
 * @param digest: If the choice indicated is digest:
 *   - The structure contains the HashedId8 of the relevant certificate. The
 * HashedId8 is calculated with the whole-certificate hash algorithm,
 * determined as described in 6.4.3.
 *   - The verification type is certificate and the certificate data
 * passed to the hash function as specified in 5.3.1 is the authorization
 * certificate.
 *
 * @param certificate: If the choice indicated is certificate:
 *   - The structure contains one or more Certificate structures, in order
 * such that the first certificate is the authorization certificate and each
 * subsequent certificate is the issuer of the one before it.
 *   - The verification type is certificate and the certificate data
 * passed to the hash function as specified in 5.3.1 is the authorization
 * certificate.
 *
 * @param self: If the choice indicated is self:
 *   - The structure does not contain any data beyond the indication that
 * the choice value is self.
 *   - The verification type is self-signed.
 *
 * @note Critical information fields:
 *   - If present, this is a critical information field as defined in 5.2.6.
 * An implementation that does not recognize the CHOICE value for this type
 * when verifying a signed SPDU shall indicate that the signed SPDU is invalid.
 *   - If present, certificate is a critical information field as defined in
 * 5.2.6. An implementation that does not support the number of certificates
 * in certificate when verifying a signed SPDU shall indicate that the signed
 * SPDU is invalid. A compliant implementation shall support certificate
 * fields containing at least one certificate.
 *
 * @note Canonicalization: This data structure is subject to canonicalization
 * for the relevant operations specified in 6.1.2. The canonicalization 
 * applies to every Certificate in the certificate field.
 */
SignerIdentifier ::= CHOICE { 
  digest      HashedId8,
  certificate SequenceOfCertificate,
  self        NULL,
  ...
}

/**
 * @brief This data structure is used to perform a countersignature over an
 * already-signed SPDU. This is the profile of an Ieee1609Dot2Data containing
 * a signedData. The tbsData within content is composed of a payload
 * containing the hash (extDataHash) of the externally generated, pre-signed
 * SPDU over which the countersignature is performed.
 */
Countersignature ::= Ieee1609Dot2Data (WITH COMPONENTS {...,
  content (WITH COMPONENTS {..., 
    signedData  (WITH COMPONENTS {..., 
      tbsData (WITH COMPONENTS {..., 
        payload (WITH COMPONENTS {..., 
          data ABSENT,
          extDataHash PRESENT
        }),
        headerInfo(WITH COMPONENTS {..., 
          generationTime PRESENT,
          expiryTime ABSENT,
          generationLocation ABSENT,
          p2pcdLearningRequest ABSENT,
          missingCrlIdentifier ABSENT,
          encryptionKey ABSENT
        })
      })
    })
  })
})


--***************************************************************************--
--                              Encrypted Data                               --
--***************************************************************************--

/**
 * @brief This data structure encodes data that has been encrypted to one or 
 * more recipients using the recipients� public or symmetric keys as 
 * specified in 5.3.4.
 *
 * @param recipients: contains one or more RecipientInfos. These entries may
 * be more than one RecipientInfo, and more than one type of RecipientInfo,
 * as long as all entries are indicating or containing the same data encryption
 * key.
 *
 * @param ciphertext: contains the encrypted data. This is the encryption of
 * an encoded Ieee1609Dot2Data structure as specified in 5.3.4.2.
 *
 * @note Critical information fields:
 *   - If present, recipients is a critical information field as defined in
 * 5.2.6. An implementation that does not support the number of RecipientInfo
 * in recipients when decrypted shall indicate that the encrypted SPDU could
 * not be decrypted due to unsupported critical information fields. A
 * compliant implementation shall support recipients fields containing at
 * least eight entries.
 *
 * @note If the plaintext is raw data, i.e., it has not been output from a 
 * previous operation of the SDS, then it is trivial to encapsulate it in an
 * Ieee1609Dot2Data of type unsecuredData as noted in 4.2.2.2.2. For example,
 * '03 80 08 01 23 45 67 89 AB CD EF' is the C-OER encoding of '01 23 45 67 
 * 89 AB CD EF' encapsulated in an Ieee1609Dot2Data of type unsecuredData. 
 * The first byte of the encoding 03 is the protocolVersion, the second byte 
 * 80 indicates the choice unsecuredData, and the third byte 08 is the length 
 * of the raw data '01 23 45 67 89 AB CD EF'.
 */
EncryptedData ::= SEQUENCE {
  recipients SequenceOfRecipientInfo,
  ciphertext SymmetricCiphertext
}

/**
 * @brief This data structure is used to transfer the data encryption key to
 * an individual recipient of an EncryptedData. The option pskRecipInfo is
 * selected if the EncryptedData was encrypted using the static encryption
 * key approach specified in 5.3.4. The other options are selected if the
 * EncryptedData was encrypted using the ephemeral encryption key approach
 * specified in 5.3.4. The meanings of the choices are:
 *
 * See Annex C.7 for guidance on when it may be appropriate to use
 * each of these approaches.
 *
 * @param pskRecipInfo: The data was encrypted directly using a pre-shared 
 * symmetric key.
 *
 * @param symmRecipInfo: The data was encrypted with a data encryption key,
 * and the data encryption key was encrypted using a symmetric key.
 *
 * @param certRecipInfo: The data was encrypted with a data encryption key, 
 * the data encryption key was encrypted using a public key encryption scheme,
 * where the public encryption key was obtained from a certificate. In this 
 * case, the parameter P1 to ECIES as defined in 5.3.5 is the hash of the 
 * certificate, calculated with the whole-certificate hash algorithm, 
 * determined as described in 6.4.3, applied to the COER-encoded certificate, 
 * canonicalized as defined in the definition of Certificate.
 *
 * @note If the encryption algorithm is SM2, there is no equivalent of the 
 * parameter P1 and so no input to the encryption process that uses the hash
 * of the certificate.
 *
 * @param signedDataRecipInfo: The data was encrypted with a data encryption 
 * key, the data encryption key was encrypted using a public key encryption 
 * scheme, where the public encryption key was obtained as the public response 
 * encryption key from a SignedData. In this case, if ECIES is the encryption 
 * algorithm, then the parameter P1 to ECIES as defined in 5.3.5 is the 
 * SHA-256 hash of the Ieee1609Dot2Data of type signedData containing the 
 * response encryption key, canonicalized as defined in the definition of 
 * Ieee1609Dot2Data.
 *
 * @note If the encryption algorithm is SM2, there is no equivalent of the 
 * parameter P1 and so no input to the encryption process that uses the hash
 * of the Ieee1609Dot2Data.
 *
 * @param rekRecipInfo: The data was encrypted with a data encryption key, 
 * the data encryption key was encrypted using a public key encryption scheme,
 * where the public encryption key was not obtained from a Signed-Data or a 
 * certificate. In this case, the SDEE specification is expected to specify 
 * how the public key is obtained, and if ECIES is the encryption algorithm, 
 * then the parameter P1 to ECIES as defined in 5.3.5 is the hash of the 
 * empty string.
 *
 * @note If the encryption algorithm is SM2, there is no equivalent of the 
 * parameter P1 and so no input to the encryption process that uses the hash 
 * of the empty string.
 *
 * @note The material input to encryption is the bytes of the encryption key 
 * with no headers, encapsulation, or length indication. Contrast this to 
 * encryption of data, where the data is encapsulated in an Ieee1609Dot2Data.
 */
RecipientInfo ::= CHOICE {
  pskRecipInfo        PreSharedKeyRecipientInfo,
  symmRecipInfo       SymmRecipientInfo,
  certRecipInfo       PKRecipientInfo, 
  signedDataRecipInfo PKRecipientInfo, 
  rekRecipInfo        PKRecipientInfo 
}

/**
 * @brief This type is used for clarity of definitions.
 */
SequenceOfRecipientInfo ::= SEQUENCE OF RecipientInfo

/**
 * @brief This data structure is used to indicate a symmetric key that may 
 * be used directly to decrypt a SymmetricCiphertext. It consists of the 
 * low-order 8 bytes of the hash of the COER encoding of a 
 * SymmetricEncryptionKey structure containing the symmetric key in question. 
 * The HashedId8 is calculated with the hash algorithm determined as 
 * specified in 5.3.9.3. The symmetric key may be established by any 
 * appropriate means agreed by the two parties to the exchange.
 */
PreSharedKeyRecipientInfo ::= HashedId8

/**
 * @brief This data structure contains the following fields:
 *
 * @param recipientId: contains the hash of the symmetric key encryption key 
 * that may be used to decrypt the data encryption key. It consists of the 
 * low-order 8 bytes of the hash of the COER encoding of a 
 * SymmetricEncryptionKey structure containing the symmetric key in question. 
 * The HashedId8 is calculated with the hash algorithm determined as 
 * specified in 5.3.9.4. The symmetric key may be established by any 
 * appropriate means agreed by the two parties to the exchange.
 *
 * @param encKey: contains the encrypted data encryption key within a 
 * SymmetricCiphertext, where the data encryption key is input to the data 
 * encryption key encryption process with no headers, encapsulation, or 
 * length indication.
 */
SymmRecipientInfo ::= SEQUENCE { 
  recipientId HashedId8, 
  encKey      SymmetricCiphertext
}

/**
 * @brief This data structure contains the following fields:
 *
 * @param recipientId: contains the hash of the container for the encryption
 * public key as specified in the definition of RecipientInfo. Specifically,
 * depending on the choice indicated by the containing RecipientInfo structure:
 *   - If the containing RecipientInfo structure indicates certRecipInfo,
 * this field contains the HashedId8 of the certificate. The HashedId8 is
 * calculated with the whole-certificate hash algorithm, determined as
 * described in 6.4.3, applied to the COER-encoded certificate, canonicalized
 * as defined in the definition of Certificate.
 *   - If the containing RecipientInfo structure indicates 
 * signedDataRecipInfo, this field contains the HashedId8 of the 
 * Ieee1609Dot2Data of type signedData that contained the encryption key, 
 * with that Ieee��1609�Dot2��Data canonicalized per 6.3.4. The HashedId8 is 
 * calculated with the hash algorithm determined as specified in 5.3.9.5.
 *   - If the containing RecipientInfo structure indicates rekRecipInfo, this 
 * field contains the HashedId8 of the COER encoding of a PublicEncryptionKey 
 * structure containing the response encryption key. The HashedId8 is 
 * calculated with the hash algorithm determined as specified in 5.3.9.5.
 *
 * @param encKey: contains the encrypted data encryption key, where the data 
 * encryption key is input to the data encryption key encryption process with 
 * no headers, encapsulation, or length indication. 
 */
PKRecipientInfo ::= SEQUENCE { 
  recipientId HashedId8, 
  encKey      EncryptedDataEncryptionKey
}

/**
 * @brief This data structure contains an encrypted data encryption key, 
 * where the data encryption key is input to the data encryption key 
 * encryption process with no headers, encapsulation, or length indication.
 *
 * Critical information fields: If present and applicable to
 * the receiving SDEE, this is a critical information field as defined in
 * 5.2.6. If an implementation receives an encrypted SPDU and determines that
 * one or more RecipientInfo fields are relevant to it, and if all of those
 * RecipientInfos contain an EncryptedDataEncryptionKey such that the
 * implementation does not recognize the indicated CHOICE, the implementation
 * shall indicate that the encrypted SPDU is not decryptable.
 */
EncryptedDataEncryptionKey ::= CHOICE { 
  eciesNistP256        EciesP256EncryptedKey,
  eciesBrainpoolP256r1 EciesP256EncryptedKey,
  ...,
  ecencSm2256          EcencP256EncryptedKey
}

/**
 * @brief This data structure encapsulates a ciphertext generated with an
 * approved symmetric algorithm.
 *
 * @note Critical information fields: If present, this is a critical
 * information field as defined in 5.2.6. An implementation that does not
 * recognize the indicated CHOICE value for this type in an encrypted SPDU
 * shall indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, 
 * that is, it is invalid in the sense that its validity cannot be established.
 */
SymmetricCiphertext ::= CHOICE {
  aes128ccm One28BitCcmCiphertext,
  ...,
  sm4Ccm    One28BitCcmCiphertext
}

/**
 * @brief This data structure encapsulates an encrypted ciphertext for any 
 * symmetric algorithm with 128-bit blocks in CCM mode. The ciphertext is 
 * 16 bytes longer than the corresponding plaintext due to the inclusion of 
 * the message authentication code (MAC). The plaintext resulting from a 
 * correct decryption of the ciphertext is either a COER-encoded 
 * Ieee1609Dot2Data structure (see 6.3.41), or a 16-byte symmetric key 
 * (see 6.3.44).
 *
 * The ciphertext is 16 bytes longer than the corresponding plaintext.
 *
 * The plaintext resulting from a correct decryption of the
 * ciphertext is a COER-encoded Ieee1609Dot2Data structure.
 *
 * @param nonce: contains the nonce N as specified in 5.3.8.
 *
 * @param ccmCiphertext: contains the ciphertext C as specified in 5.3.8.
 *
 * @note In the name of this structure, "One28" indicates that the 
 * symmetric cipher block size is 128 bits. It happens to also be the case 
 * that the keys used for both AES-128-CCM and SM4-CCM are also 128 bits long. 
 * This is, however, not what �One28� refers to. Since the cipher is used in 
 * counter mode, i.e., as a stream cipher, the fact that that block size is 128
 * bits affects only the size of the MAC and does not affect the size of the
 * raw ciphertext.
 */
One28BitCcmCiphertext ::= SEQUENCE {
  nonce         OCTET STRING (SIZE (12)),
  ccmCiphertext Opaque 
}

/**
 * @brief This type is defined only for backwards compatibility.
 */
Aes128CcmCiphertext ::= One28BitCcmCiphertext

--***************************************************************************--
--                Certificates and other Security Management                 --
--***************************************************************************--

/**
 * @brief This structure is a profile of the structure CertificateBase which
 * specifies the valid combinations of fields to transmit implicit and
 * explicit certificates.
 *
 * @note Canonicalization: This data structure is subject to canonicalization 
 * for the relevant operations specified in 6.1.2. The canonicalization 
 * applies to the CertificateBase.
 */
Certificate ::=
  CertificateBase (ImplicitCertificate | ExplicitCertificate)

TestCertificate ::= Certificate

/**
 * @brief This type is used for clarity of definitions.
 */
SequenceOfCertificate ::= SEQUENCE OF Certificate

/**
 * @brief The fields in this structure have the following meaning:
 *
 * @param version: contains the version of the certificate format. In this
 * version of the data structures, this field is set to 3.
 *
 * @param type: states whether the certificate is implicit or explicit. This
 * field is set to explicit for explicit certificates and to implicit for
 * implicit certificates. See ExplicitCertificate and ImplicitCertificate for
 * more details.
 *
 * @param issuer: identifies the issuer of the certificate.
 *
 * @param toBeSigned: is the certificate contents. This field is an input to
 * the hash when generating or verifying signatures for an explicit
 * certificate, or generating or verifying the public key from the
 * reconstruction value for an implicit certificate. The details of how this
 * field are encoded are given in the description of the
 * ToBeSignedCertificate type.
 *
 * @param signature: is included in an ExplicitCertificate. It is the
 * signature, calculated by the signer identified in the issuer field, over
 * the hash of toBeSigned. The hash is calculated as specified in 5.3.1, where:
 *   - Data input is the encoding of toBeSigned following the COER.
 *   - Signer identifier input depends on the verification type, which in
 * turn depends on the choice indicated by issuer. If the choice indicated by
 * issuer is self, the verification type is self-signed and the signer
 * identifier input is the empty string. If the choice indicated by issuer is
 * not self, the verification type is certificate and the signer identifier
 * input is the canonicalized COER encoding of the certificate indicated by
 * issuer. The canonicalization is carried out as specified in the 
 * Canonicalization section of this subclause.
 *
 * @note Canonicalization: This data structure is subject to canonicalization 
 * for the relevant operations specified in 6.1.2. The canonicalization 
 * applies to the ToBeSignedCertificate and to the Signature.
 *
 * @note Whole-certificate hash: If the entirety of a certificate is hashed 
 * to calculate a HashedId3, HashedId8, or HashedId10, the algorithm used for 
 * this purpose is known as the whole-certificate hash. The method used to 
 * determine the whole-certificate hash algorithm is specified in 5.3.9.2.
 */
CertificateBase ::= SEQUENCE {
  version    Uint8(3),
  type       CertificateType,
  issuer     IssuerIdentifier,
  toBeSigned ToBeSignedCertificate,
  signature  Signature OPTIONAL
}

/**
 * @brief This enumerated type indicates whether a certificate is explicit or
 * implicit.
 *
 * @note Critical information fields: If present, this is a critical
 * information field as defined in 5.2.5. An implementation that does not
 * recognize the indicated CHOICE for this type when verifying a signed SPDU
 * shall indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, 
 * that is, it is invalid in the sense that its validity cannot be 
 * established.
 */
CertificateType ::= ENUMERATED {
  explicit,
  implicit,
  ...
}

/**
 * @brief This is a profile of the CertificateBase structure providing all
 * the fields necessary for an implicit certificate, and no others.
 */
ImplicitCertificate ::= CertificateBase (WITH COMPONENTS {...,
  type(implicit),
  toBeSigned(WITH COMPONENTS {...,
    verifyKeyIndicator(WITH COMPONENTS {reconstructionValue})
  }),
  signature ABSENT
})

/**
 * @brief This is a profile of the CertificateBase structure providing all
 * the fields necessary for an explicit certificate, and no others.
 */
ExplicitCertificate ::= CertificateBase (WITH COMPONENTS {...,
  type(explicit),
  toBeSigned (WITH COMPONENTS {...,
    verifyKeyIndicator(WITH COMPONENTS {verificationKey})
  }),
  signature PRESENT
})

/**
 * @brief This structure allows the recipient of a certificate to determine
 * which keying material to use to authenticate the certificate.
 *
 * If the choice indicated is sha256AndDigest, sha384AndDigest, or 
 * sm3AndDigest:
 *   - The structure contains the HashedId8 of the issuing certificate. The 
 * HashedId8 is calculated with the whole-certificate hash algorithm, 
 * determined as described in 6.4.3, applied to the COER-encoded certificate, 
 * canonicalized as defined in the definition of Certificate. 
 *   - The hash algorithm to be used to generate the hash of the certificate 
 * for verification is SHA-256 (in the case of sha256AndDigest), SM3 (in the 
 * case of sm3AndDigest) or SHA-384 (in the case of sha384AndDigest).
 *   - The certificate is to be verified with the public key of the
 * indicated issuing certificate.
 *
 * If the choice indicated is self:
 *   - The structure indicates what hash algorithm is to be used to generate
 * the hash of the certificate for verification.
 *   - The certificate is to be verified with the public key indicated by
 * the verifyKeyIndicator field in theToBeSignedCertificate.
 *
 * @note Critical information fields: If present, this is a critical
 * information field as defined in 5.2.5. An implementation that does not
 * recognize the indicated CHOICE for this type when verifying a signed SPDU
 * shall indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, 
 * that is, it is invalid in the sense that its validity cannot be 
 * established.
 */
IssuerIdentifier ::= CHOICE { 
  sha256AndDigest HashedId8,
  self            HashAlgorithm,
  ...,
  sha384AndDigest HashedId8,
  sm3AndDigest    HashedId8
}

/**
 * @brief The fields in the ToBeSignedCertificate structure have the
 * following meaning:
 *
 * For both implicit and explicit certificates, when the certificate
 * is hashed to create or recover the public key (in the case of an implicit
 * certificate) or to generate or verify the signature (in the case of an
 * explicit certificate), the hash is Hash (Data input) || Hash (
 * Signer identifier input), where:
 *   - Data input is the COER encoding of toBeSigned, canonicalized
 * as described above.
 *   - Signer identifier input depends on the verification type,
 * which in turn depends on the choice indicated by issuer. If the choice
 * indicated by issuer is self, the verification type is self-signed and the
 * signer identifier input is the empty string. If the choice indicated by
 * issuer is not self, the verification type is certificate and the signer
 * identifier input is the COER encoding of the canonicalization per 6.4.3 of
 * the certificate indicated by issuer.
 *
 * In other words, for implicit certificates, the value H (CertU) in SEC 4,
 * section 3, is for purposes of this standard taken to be H [H
 * (canonicalized ToBeSignedCertificate from the subordinate certificate) ||
 * H (entirety of issuer Certificate)]. See 5.3.2 for further discussion,
 * including material differences between this standard and SEC 4 regarding
 * how the hash function output is converted from a bit string to an integer.
 *
 * @param id: contains information that is used to identify the certificate
 * holder if necessary.
 *
 * @param cracaId: identifies the Certificate Revocation Authorization CA
 * (CRACA) responsible for certificate revocation lists (CRLs) on which this
 * certificate might appear. Use of the cracaId is specified in 5.1.3. The
 * HashedId3 is calculated with the whole-certificate hash algorithm,
 * determined as described in 6.4.3, applied to the COER-encoded certificate, 
 * canonicalized as defined in the definition of Certificate.
 *
 * @param crlSeries: represents the CRL series relevant to a particular
 * Certificate Revocation Authorization CA (CRACA) on which the certificate
 * might appear. Use of this field is specified in 5.1.3.
 *
 * @param validityPeriod: contains the validity period of the certificate.
 *
 * @param region: if present, indicates the validity region of the
 * certificate. If it is omitted the validity region is indicated as follows:
 *   - If enclosing certificate is self-signed, i.e., the choice indicated
 * by the issuer field in the enclosing certificate structure is self, the
 * certificate is valid worldwide.
 *   - Otherwise, the certificate has the same validity region as the
 * certificate that issued it.
 *
 * @param assuranceLevel: indicates the assurance level of the certificate
 * holder.
 *
 * @param appPermissions: indicates the permissions that the certificate
 * holder has to sign application data with this certificate. A valid
 * instance of appPermissions contains any particular Psid value in at most
 * one entry.
 *
 * @param certIssuePermissions: indicates the permissions that the certificate
 * holder has to sign certificates with this certificate. A valid instance of
 * this array contains no more than one entry whose psidSspRange field
 * indicates all. If the array has multiple entries and one entry has its
 * psidSspRange field indicate all, then the entry indicating all specifies
 * the permissions for all PSIDs other than the ones explicitly specified in
 * the other entries. See the description of PsidGroupPermissions for further
 * discussion.
 *
 * @param certRequestPermissions: indicates the permissions that the 
 * certificate holder can request in its certificate. A valid instance of this
 * array contains no more than one entry whose psidSspRange field indicates 
 * all. If the array has multiple entries and one entry has its psidSspRange 
 * field indicate all, then the entry indicating all specifies the permissions 
 * for all PSIDs other than the ones explicitly specified in the other entries.
 * See the description of PsidGroupPermissions for further discussion.
 *
 * @param canRequestRollover: indicates that the certificate may be used to
 * sign a request for another certificate with the same permissions. This
 * field is provided for future use and its use is not defined in this
 * version of this standard.
 *
 * @param encryptionKey: contains a public key for encryption for which the
 * certificate holder holds the corresponding private key.
 *
 * @param verifyKeyIndicator: contains material that may be used to recover
 * the public key that may be used to verify data signed by this certificate.
 *
 * @param flags: indicates additional yes/no properties of the certificate 
 * holder. The only bit with defined semantics in this string in this version 
 * of this standard is usesCubk. If set, the usesCubk bit indicates that the 
 * certificate holder supports the compact unified butterfly key response. 
 * Further material about the compact unified butterfly key response can be 
 * found in IEEE Std 1609.2.1.
 *
 * @note usesCubk is only relevant for CA certificates, and the only 
 * functionality defined associated with this field is associated with 
 * consistency checks on received certificate responses. No functionality 
 * associated with communications between peer SDEEs is defined associated 
 * with this field.
 *
 * @param appExtensions: indicates additional permissions that may be applied
 * to application activities that the certificate holder is carrying out. 
 *
 * @param certIssueExtensions: indicates additional permissions to issue 
 * certificates containing endEntityExtensions. 
 *
 * @param certRequestExtensions: indicates additional permissions to request 
 * certificates containing endEntityExtensions.
 *
 * @note Canonicalization: This data structure is subject to canonicalization 
 * for the relevant operations specified in 6.1.2. The canonicalization 
 * applies to the PublicEncryptionKey and to the VerificationKeyIndicator.
 *
 * If the PublicEncryptionKey contains a BasePublicEncryptionKey that is an 
 * elliptic curve point (i.e., of type EccP256CurvePoint or EccP384CurvePoint),
 * then the elliptic curve point is encoded in compressed form, i.e., such 
 * that the choice indicated within the Ecc*CurvePoint is compressed-y-0 or 
 * compressed-y-1.
 *
 * @note Critical information fields:
 *   - If present, appPermissions is a critical information field as defined 
 * in 5.2.6. If an implementation of verification does not support the number 
 * of PsidSsp in the appPermissions field of a certificate that signed a 
 * signed SPDU, that implementation shall indicate that the signed SPDU is 
 * invalid in the sense of 4.2.2.3.2, that is, it is invalid in the sense 
 * that its validity cannot be established.. A conformant implementation 
 * shall support appPermissions fields containing at least eight entries. 
 * It may be the case that an implementation of verification does not support 
 * the number of entries in  the appPermissions field and the appPermissions 
 * field is not relevant to the verification: this will occur, for example, 
 * if the certificate in question is a CA certificate and so the 
 * certIssuePermissions field is relevant to the verification and the 
 * appPermissions field is not. In this case, whether the implementation 
 * indicates that the signed SPDU is valid (because it could validate all 
 * relevant fields) or invalid (because it could not parse the entire 
 * certificate) is implementation-specific.
 *   - If present, certIssuePermissions is a critical information field as 
 * defined in 5.2.6. If an implementation of verification does not support 
 * the number of PsidGroupPermissions in the certIssuePermissions field of a 
 * CA certificate in the chain of a signed SPDU, the implementation shall 
 * indicate that the signed SPDU is invalid in the sense of 4.2.2.3.2, that 
 * is, it is invalid in the sense that its validity cannot be established. 
 * A conformant implementation shall support certIssuePermissions fields 
 * containing at least eight entries.
 * It may be the case that an implementation of verification does not support
 * the number of entries in  the certIssuePermissions field and the 
 * certIssuePermissions field is not relevant to the verification: this will 
 * occur, for example, if the certificate in question is the signing 
 * certificate for the SPDU and so the appPermissions field is relevant to 
 * the verification and the certIssuePermissions field is not. In this case, 
 * whether the implementation indicates that the signed SPDU is valid 
 * (because it could validate all relevant fields) or invalid (because it 
 * could not parse the entire certificate) is implementation-specific.
 *   - If present, certRequestPermissions is a critical information field as 
 * defined in 5.2.6. If an implementaiton of verification of a certificate 
 * request does not support the number of PsidGroupPermissions in 
 * certRequestPermissions, the implementation shall indicate that the signed 
 * SPDU is invalid in the sense of 4.2.2.3.2, that is, it is invalid in the 
 * sense that its validity cannot be established. A conformant implementation 
 * shall support certRequestPermissions fields containing at least eight 
 * entries.
 * It may be the case that an implementation of verification does not support 
 * the number of entries in  the certRequestPermissions field and the 
 * certRequestPermissions field is not relevant to the verification: this will 
 * occur, for example, if the certificate in question is the signing 
 * certificate for the SPDU and so the appPermissions field is relevant to 
 * the verification and the certRequestPermissions field is not. In this 
 * case, whether the implementation indicates that the signed SPDU is valid 
 * (because it could validate all relevant fields) or invalid (because it 
 * could not parse the entire certificate) is implementation-specific.
 */
ToBeSignedCertificate ::= SEQUENCE { 
  id                     CertificateId,
  cracaId                HashedId3,
  crlSeries              CrlSeries,
  validityPeriod         ValidityPeriod,
  region                 GeographicRegion OPTIONAL,
  assuranceLevel         SubjectAssurance OPTIONAL,
  appPermissions         SequenceOfPsidSsp OPTIONAL,
  certIssuePermissions   SequenceOfPsidGroupPermissions OPTIONAL,
  certRequestPermissions SequenceOfPsidGroupPermissions OPTIONAL, 
  canRequestRollover     NULL OPTIONAL,
  encryptionKey          PublicEncryptionKey OPTIONAL,
  verifyKeyIndicator     VerificationKeyIndicator,
  ...,
  flags                  BIT STRING {usesCubk (0)} (SIZE (8)) OPTIONAL,
  appExtensions          SequenceOfAppExtensions,
  certIssueExtensions    SequenceOfCertIssueExtensions,
  certRequestExtension   SequenceOfCertRequestExtensions
}
(WITH COMPONENTS { ..., appPermissions PRESENT} |
 WITH COMPONENTS { ..., certIssuePermissions PRESENT} |
 WITH COMPONENTS { ..., certRequestPermissions PRESENT})

/**
 * @brief This structure contains information that is used to identify the
 * certificate holder if necessary.
 *
 * @param linkageData: is used to identify the certificate for revocation
 * purposes in the case of certificates that appear on linked certificate
 * CRLs. See 5.1.3 and 7.3 for further discussion.
 *
 * @param name: is used to identify the certificate holder in the case of
 * non-anonymous certificates. The contents of this field are a matter of
 * policy and are expected to be human-readable.
 *
 * @param binaryId: supports identifiers that are not human-readable.
 *
 * @param none: indicates that the certificate does not include an identifier.
 *
 * @note Critical information fields:
 *   - If present, this is a critical information field as defined in 5.2.6.
 * An implementation that does not recognize the choice indicated in this
 * field shall reject a signed SPDU as invalid.
 */
CertificateId ::= CHOICE {
  linkageData LinkageData,
  name        Hostname,
  binaryId    OCTET STRING(SIZE(1..64)),
  none        NULL,
  ...
}

/**
 * @brief This structure contains information that is matched against
 * information obtained from a linkage ID-based CRL to determine whether the
 * containing certificate has been revoked. See 5.1.3.4 and 7.3 for details
 * of use.
 */
LinkageData ::= SEQUENCE {
  iCert               IValue,
  linkage-value       LinkageValue, 
  group-linkage-value GroupLinkageValue OPTIONAL
}

/**
 * @brief This type indicates which type of permissions may appear in
 * end-entity certificates the chain of whose permissions passes through the
 * PsidGroupPermissions field containing this value. If app is indicated, the
 * end-entity certificate may contain an appPermissions field. If enroll is
 * indicated, the end-entity certificate may contain a certRequestPermissions
 * field.
 */
EndEntityType ::=
  BIT STRING {app (0), enrol (1) } (SIZE (8)) --(ALL EXCEPT {})

/**
 * @brief This structure states the permissions that a certificate holder has
 * with respect to issuing and requesting certificates for a particular set
 * of PSIDs. For examples, see D.5.3 and D.5.4.
 *
 * @param subjectPermissions: indicates PSIDs and SSP Ranges covered by this
 * field.
 *
 * @param minChainLength: and chainLengthRange indicate how long the
 * certificate chain from this certificate to the end-entity certificate is
 * permitted to be. As specified in 5.1.2.1, the length of the certificate
 * chain is the number of certificates "below" this certificate in the chain,
 * down to and including the end-entity certificate. The length is permitted
 * to be (a) greater than or equal to minChainLength certificates and (b)
 * less than or equal to minChainLength + chainLengthRange certificates. A
 * value of 0 for minChainLength is not permitted when this type appears in
 * the certIssuePermissions field of a ToBeSignedCertificate; a certificate
 * that has a value of 0 for this field is invalid. The value -1 for
 * chainLengthRange is a special case: if the value of chainLengthRange is -1
 * it indicates that the certificate chain may be any length equal to or
 * greater than minChainLength. See the examples below for further discussion.
 *
 * @param eeType: takes one or more of the values app and enroll and indicates
 * the type of certificates or requests that this instance of
 * PsidGroupPermissions in the certificate is entitled to authorize. 
 * Different instances of PsidGroupPermissions within a ToBeSignedCertificate
 * may have different values for eeType.
 *   - If this field indicates app, the chain is allowed to end in an 
 * authorization certificate, i.e., a certficate in which these permissions 
 * appear in an appPermissions field (in other words, if the field does not 
 * indicate app and the chain ends in an authorization certificate, the 
 * chain shall be considered invalid).
 *   - If this field indicates enroll, the chain is allowed to end in an 
 * enrollment certificate, i.e., a certificate in which these permissions 
 * appear in a certReqPermissions permissions field (in other words, if the 
 * field does not indicate enroll and the chain ends in an enrollment 
 * certificate, the chain shall be considered invalid).
 */
PsidGroupPermissions ::= SEQUENCE {
  subjectPermissions SubjectPermissions,
  minChainLength     INTEGER DEFAULT 1, 
  chainLengthRange   INTEGER DEFAULT 0, 
  eeType             EndEntityType DEFAULT {app}
}

/**
 * @brief This type is used for clarity of definitions.
 */
SequenceOfPsidGroupPermissions ::= SEQUENCE OF PsidGroupPermissions

/**
 * @brief This indicates the PSIDs and associated SSPs for which certificate
 * issuance or request permissions are granted by a PsidGroupPermissions
 * structure. If this takes the value explicit, the enclosing
 * PsidGroupPermissions structure grants certificate issuance or request
 * permissions for the indicated PSIDs and SSP Ranges. If this takes the
 * value all, the enclosing PsidGroupPermissions structure grants certificate
 * issuance or request permissions for all PSIDs not indicated by other
 * PsidGroupPermissions in the same certIssuePermissions or
 * certRequestPermissions field.
 *
 * @note Critical information fields:
 *   - If present, this is a critical information field as defined in 5.2.6.
 * An implementation that does not recognize the indicated CHOICE when
 * verifying a signed SPDU shall indicate that the signed SPDU is
 * invalidin the sense of 4.2.2.3.2, that is, it is invalid in the sense that
 * its validity cannot be established.
 *   - If present, explicit is a critical information field as defined in
 * 5.2.6. An implementation that does not support the number of PsidSspRange
 * in explicit when verifying a signed SPDU shall indicate that the signed
 * SPDU is invalid in the sense of 4.2.2.3.2, that is, it is invalid in the 
 * sense that its validity cannot be established. A conformant implementation
 * shall support explicit fields containing at least eight entries.
 */
SubjectPermissions ::= CHOICE {
  explicit SequenceOfPsidSspRange,
  all      NULL,
  ...
}

/**
 * @brief The contents of this field depend on whether the certificate is an
 * implicit or an explicit certificate.
 *
 * @param verificationKey: is included in explicit certificates. It contains
 * the public key to be used to verify signatures generated by the holder of
 * the Certificate.
 *
 * @param reconstructionValue: is included in implicit certificates. It
 * contains the reconstruction value, which is used to recover the public key
 * as specified in SEC 4 and 5.3.2.
 *
 * @note Critical information fields: If present, this is a critical 
 * information field as defined in 5.2.5. An implementation that does not 
 * recognize the indicated CHOICE for this type when verifying a signed SPDU 
 * shall indicate that the signed SPDU is invalid indicate that the signed 
 * SPDU is invalid in the sense of 4.2.2.3.2, that is, it is invalid in the 
 * sense that its validity cannot be established.
 *
 * @note Canonicalization: This data structure is subject to canonicalization 
 * for the relevant operations specified in 6.1.2. The canonicalization 
 * applies to the PublicVerificationKey and to the EccP256CurvePoint. The 
 * EccP256CurvePoint is encoded in compressed form, i.e., such that the 
 * choice indicated within the EccP256CurvePoint is compressed-y-0 or 
 * compressed-y-1.
 */
VerificationKeyIndicator ::= CHOICE {
  verificationKey     PublicVerificationKey,
  reconstructionValue EccP256CurvePoint,
  ...
}

/**
 * @brief This structure uses the parameterized type Extension to define an 
 * Ieee1609ContributedHeaderInfoExtension as an open Extension Content field 
 * identified by an extension identifier. The extension identifier value is 
 * unique to extensions defined by ETSI and need not be unique among all 
 * extension identifier values defined by all contributing organizations.
 */
Ieee1609ContributedHeaderInfoExtension ::=
  Extension{{Ieee1609HeaderInfoExtensions}}

/**
 * @brief This is an integer used to identify an 
 * Ieee1609ContributedHeaderInfoExtension.
 */
Ieee1609HeaderInfoExtensionId ::= ExtId

p2pcd8ByteLearningRequestId Ieee1609HeaderInfoExtensionId ::= 1

/**
 * @brief This is the ASN.1 Information Object Class that associates IEEE 
 * 1609 HeaderInfo contributed extensions with the appropriate 
 * Ieee1609HeaderInfoExtensionId value.
 */
Ieee1609HeaderInfoExtensions EXT-TYPE ::= {
  {HashedId8 IDENTIFIED BY p2pcd8ByteLearningRequestId},
  ...
}

/**
 * @brief This structure contains any AppExtensions that apply to the 
 * certificate holder. As specified in 5.2.4.2.3, each individual 
 * AppExtension type is associated with consistency conditions, specific to 
 * that extension, that govern its consistency with SPDUs signed by the 
 * certificate holder and with the CertIssueExtensions in the CA certificates 
 * in that certificate holder�s chain. Those consistency conditions are 
 * specified for each individual AppExtension below.
 */
SequenceOfAppExtensions ::= SEQUENCE (SIZE(1..MAX)) OF AppExtension

/**
 * @brief This structure contains an individual AppExtension. AppExtensions 
 * specified in this standard are drawn from the ASN.1 Information Object Set 
 * SetCertExtensions. This set, and its use in the AppExtension type, is 
 * structured so that each AppExtension is associated with a 
 * CertIssueExtension and a CertRequestExtension and all are identified by 
 * the same id value. In this structure:
 * 
 * @param id: identifies the extension type.
 * 
 * @param content: provides the content of the extension.
 */
AppExtension ::= SEQUENCE {
  id      CERT-EXT-TYPE.&id({SetCertExtensions}),
  content CERT-EXT-TYPE.&App({SetCertExtensions}{@.id})
}

/**
 * @brief This field contains any CertIssueExtensions that apply to the 
 * certificate holder. As specified in 5.2.4.2.3, each individual 
 * CertIssueExtension type is associated with consistency conditions, 
 * specific to that extension, that govern its consistency with 
 * AppExtensions in certificates issued by the certificate holder and with 
 * the CertIssueExtensions in the CA certificates in that certificate 
 * holder�s chain. Those consistency conditions are specified for each 
 * individual CertIssueExtension below.
 */
SequenceOfCertIssueExtensions ::= 
  SEQUENCE (SIZE(1..MAX)) OF CertIssueExtension

/**
 * @brief This field contains an individual CertIssueExtension. 
 * CertIssueExtensions specified in this standard are drawn from the ASN.1 
 * Information Object Set SetCertExtensions. This set, and its use in the 
 * CertIssueExtension type, is structured so that each CertIssueExtension 
 * is associated with a AppExtension and a CertRequestExtension and all are 
 * identified by the same id value. In this structure:
 * 
 * @param id: identifies the extension type.
 * 
 * @param permissions: indicates the permissions. Within this field.
 *   - all indicates that the certificate is entitled to issue all values of
 * the extension.
 *   - specific is used to specify which values of the extension may be 
 * issued in the case where all does not apply.
 */
CertIssueExtension ::= SEQUENCE {
  id          CERT-EXT-TYPE.&id({SetCertExtensions}),
  permissions CHOICE {
    specific  CERT-EXT-TYPE.&Issue({SetCertExtensions}{@.id}),
    all       NULL
  }
}

/**
 * @brief This field contains any CertRequestExtensions that apply to the 
 * certificate holder. As specified in 5.2.4.2.3, each individual 
 * CertRequestExtension type is associated with consistency conditions, 
 * specific to that extension, that govern its consistency with 
 * AppExtensions in certificates issued by the certificate holder and with 
 * the CertRequestExtensions in the CA certificates in that certificate 
 * holder�s chain. Those consistency conditions are specified for each 
 * individual CertRequestExtension below.
 */
SequenceOfCertRequestExtensions ::= SEQUENCE (SIZE(1..MAX)) OF CertRequestExtension

/**
 * @brief This field contains an individual CertRequestExtension. 
 * CertRequestExtensions specified in this standard are drawn from the 
 * ASN.1 Information Object Set SetCertExtensions. This set, and its use in 
 * the CertRequestExtension type, is structured so that each 
 * CertRequestExtension is associated with a AppExtension and a 
 * CertRequestExtension and all are identified by the same id value. In this 
 * structure:
 * 
 * @param id: identifies the extension type.
 * 
 * @param permissions: indicates the permissions. Within this field.
 *   - all indicates that the certificate is entitled to issue all values of
 * the extension.
 *   - specific is used to specify which values of the extension may be 
 * issued in the case where all does not apply.
 */
CertRequestExtension ::= SEQUENCE {
  id      CERT-EXT-TYPE.&id({SetCertExtensions}),
  permissions CHOICE {
    content   CERT-EXT-TYPE.&Req({SetCertExtensions}{@.id}),
    all       NULL
  }
}

/**
 * @brief This type is the AppExtension used to identify an operating 
 * organization. The associated CertIssueExtension and CertRequestExtension 
 * are both of type OperatingOrganizationId.
 * To determine consistency between this type and an SPDU, the SDEE 
 * specification for that SPDU is required to specify how the SPDU can be 
 * used to determine an OBJECT IDENTIFIER (for example, by including the 
 * full OBJECT IDENTIFIER in the SPDU, or by including a RELATIVE-OID with 
 * clear instructions about how a full OBJECT IDENTIFIER can be obtained from
 * the RELATIVE-OID). The SPDU is then consistent with this type if the 
 * OBJECT IDENTIFIER determined from the SPDU is identical to the OBJECT 
 * IDENTIFIER contained in this field.
 * This AppExtension does not have consistency conditions with a 
 * corresponding CertIssueExtension. It can appear in a certificate issued 
 * by any CA.
 */
OperatingOrganizationId ::= OBJECT IDENTIFIER

certExtId-OperatingOrganization ExtId ::= 1

/**
 * @brief This Information Object is an instance of the Information Object 
 * Class CERT-EXT-TYPE. It is defined to bind together the AppExtension, 
 * CertIssueExtension, and CertRequestExtension types associated with the 
 * use of an operating organization identifier, and to assocaute them all 
 * with the extension identifier value certExtId-OperatingOrganization.
 */
instanceOperatingOrganizationCertExtensions CERT-EXT-TYPE ::= {
  ID      certExtId-OperatingOrganization 
  APP     OperatingOrganizationId
  ISSUE   NULL
  REQUEST NULL
}

/**
 * @brief This Information Object Set is a collection of Information Objects 
 * used to contain the AppExtension, CertIssueExtension, and 
 * CertRequestExtension types associated with a specific use of certificate 
 * extensions. In this version of this standard it only has a single entry 
 * instanceOperatingOrganizationCertExtensions.
 */
SetCertExtensions CERT-EXT-TYPE ::= {
  instanceOperatingOrganizationCertExtensions,
  ...
}

END