-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIeee1609Dot2Dot1Protocol.mjs
executable file
·217 lines (193 loc) · 9.06 KB
/
Ieee1609Dot2Dot1Protocol.mjs
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
/**
* @module Ieee1609Dot2Dot1Protocol
*/
import {Uint8, Uint16, Choice, Sequence, OctetString, SequenceOf } from 'asnjs';
import {HashAlgorithm, Ieee1609Dot2Data, Psid, Signature, SignerIdentifier} from 'Ieee1609Dot2js';
import {AcaEeInterfacePdu} from './Ieee1609Dot2Dot1AcaEeInterface.mjs'
import {AcaLaInterfacePdu} from './Ieee1609Dot2Dot1AcaLaInterface.mjs'
import {AcaMaInterfacePdu} from './Ieee1609Dot2Dot1AcaMaInterface.mjs'
import {AcaRaInterfacePdu, AcaResponse } from './Ieee1609Dot2Dot1AcaRaInterface.mjs'
import {AcpcTreeId} from './Ieee1609Dot2Dot1Acpc.mjs'
import {CertManagementPdu, MultiSignedCtl, CompositeCrl, CertificateChain} from './Ieee1609Dot2Dot1CertManagement.mjs'
import {EcaEeInterfacePdu} from './Ieee1609Dot2Dot1EcaEeInterface.mjs'
import {EeMaInterfacePdu} from './Ieee1609Dot2Dot1EeMaInterface.mjs'
import {EeRaInterfacePdu} from './Ieee1609Dot2Dot1EeRaInterface.mjs'
import {LaMaInterfacePdu} from './Ieee1609Dot2Dot1LaMaInterface.mjs'
import {LaRaInterfacePdu} from './Ieee1609Dot2Dot1LaRaInterface.mjs'
import {MaRaInterfacePdu} from './Ieee1609Dot2Dot1MaRaInterface.mjs'
import {
Ieee1609Dot2Data_Unsecured, Ieee1609Dot2Data_Signed,
Ieee1609Dot2Data_Encrypted, Ieee1609Dot2Data_SignedEncrypted, Ieee1609Dot2Data_EncryptedSigned,
Ieee1609Dot2Data_SignedCertRequest, Ieee1609Dot2Data_SignedEncryptedCertRequest
} from './Ieee1609Dot2Extension.mjs'
/** @type {number} */
export const SecurityMgmtPsid = 35;
/** @type {number} */
export const BaseMbrPsid = 38;
export class AnyMbrPsid extends Psid {};
/**
* @property {AcaEeInterfacePdu} aca_ee contains the interface structures defined for interaction
* between the ACA and the EE.
*
* @property {AcaLaInterfacePdu} aca_la contains the interface structures defined for interaction
* between the ACA and the LA.
*
* @property {AcaMaInterfacePdu} aca_ma contains the interface structures defined for interaction
* between the ACA and the MA.
*
* @property {AcaRaInterfacePdu} aca_ra contains the interface structures defined for interaction
* between the ACA and the RA.
*
* @property {CertManagementPdu} cert contains the interface structures defined for certificate
* management.
*
* @property {EcaEeInterfacePdu} eca_ee contains the interface structures defined for interaction
* between the ECA and the EE.
*
* @property {EeMaInterfacePdu} ee_ma contains the interface structures defined for interaction
* between the EE and the MA.
*
* @property {EeRaInterfacePdu} ee_ra contains the interface structures defined for interaction
* between the EE and the RA.
*
* @property {LaMaInterfacePdu} la_ma contains the interface structures defined for interaction
* between the LA and the MA.
*
* @property {LaRaInterfacePdu} la_ra contains the interface structures defined for interaction
* between the LA and the RA.
*
* @property {MaRaInterfacePdu} ma_ra contains the interface structures defined for interactions
* between the MA and the RA.
*/
export class ScmsPduContent extends Choice([
{ name: "aca_ee", type: AcaEeInterfacePdu},
{ name: "aca_la", type: AcaLaInterfacePdu},
{ name: "aca_ma", type: AcaMaInterfacePdu},
{ name: "aca_ra", type: AcaRaInterfacePdu},
{ name: "cert", type: CertManagementPdu},
{ name: "eca_ee", type: EcaEeInterfacePdu},
{ name: "ee_ma", type: EeMaInterfacePdu},
{ name: "ee_ra", type: EeRaInterfacePdu},
{ name: "la_ma", type: LaMaInterfacePdu},
{ name: "la_ra", type: LaRaInterfacePdu},
{ name: "ma_ra", type: MaRaInterfacePdu},
{ extension :true }
]){}
/**
* @class ScmsPdu
*
* @brief This is the parent structure that encompasses all parent structures
* of interfaces defined in the SCMS. An overview of this structure is as
* follows:
*
* @property {number} version contains the current version of the structure.
* @property {ScmsPduContent} content
*
*/
export class ScmsPdu extends Sequence([
{ name: "version", type: Uint8},
{ name: "content", type: ScmsPduContent
}
]){}
export class X509Certificate extends OctetString() {}
export class X509SignerIdentifier extends Choice([
{ name: "certificate", type: SequenceOf(X509Certificate)},
{extension: true}
]) {}
export class SignerSingleCert extends SignerIdentifier {}
export class SignerSelf extends SignerIdentifier {}
class ScmsPdu_RaAcaCertRequest extends ScmsPdu {}
class ScmsPdu_EeEcaCertRequest extends ScmsPdu {}
class ScmsPdu_EeRaCertRequest extends ScmsPdu {}
class ScmsPdu_EeRaSuccessorEnrollmentCertRequest extends ScmsPdu {}
class ScopedCertificateRequest extends ScmsPdu {}
class SignedCertificateRequest extends Sequence([
{ name: "hashAlgorithmId", type: HashAlgorithm},
{ name: "tbsRequest", type: ScopedCertificateRequest},
{ name: "signer", type: SignerIdentifier},
{ name: "signature", type: Signature}
]){}
class SignedX509CertificateRequest extends Sequence ([
{ name: "hashAlgorithmId", type: HashAlgorithm,},
{ name: "tbsRequest", type: ScopedCertificateRequest},
{ name: "signer", type: X509SignerIdentifier},
{ name: "signature", type: Signature
}
]){}
export class AcaEeCertResponsePlainSpdu extends Ieee1609Dot2Data_Unsecured( ScmsPdu ){}
export class AcaEeCertResponsePrivateSpdu extends Ieee1609Dot2Data_EncryptedSigned( ScmsPdu ){}
export class AcaEeCertResponseCubkSpdu extends Ieee1609Dot2Data_Encrypted( ScmsPdu ){}
export class RaAcaCertRequestSpdu extends Ieee1609Dot2Data_SignedCertRequest ( ScmsPdu ) {}
export class AcaRaCertResponseSpdu extends Ieee1609Dot2Data_Signed( ScmsPdu ) {}
export class CompositeCrlSpdu extends Ieee1609Dot2Data_Unsecured( ScmsPdu ){}
export class CertificateChainSpdu extends Ieee1609Dot2Data_Unsecured( ScmsPdu ){}
export class MultiSignedCtlSpdu extends Ieee1609Dot2Data_Unsecured( ScmsPdu ){}
export class CtlSignatureSpdu extends Ieee1609Dot2Data_Signed( ScmsPdu ) {}
export class CertificateManagementInformationStatusSpdu extends Ieee1609Dot2Data_Signed( ScmsPdu ) {}
export class EeEcaCertRequestSpdu extends Ieee1609Dot2Data_SignedCertRequest ( ScmsPdu ) {}
export class EeRaCertRequestSpdu extends Ieee1609Dot2Data {}
export class EeRa1609Dot2AuthenticatedCertRequestSpdu extends Ieee1609Dot2Data_SignedEncryptedCertRequest ( ScmsPdu ){}
export class EeRaX509AuthenticatedCertRequestSpdu extends Ieee1609Dot2Data_Encrypted (ScmsPdu ){}
export class RaEeCertAckSpdu extends Ieee1609Dot2Data_Signed (ScmsPdu ){}
export class RaEeCertInfoSpdu extends Ieee1609Dot2Data_Unsecured (ScmsPdu){}
export class RaEeCertAndAcpcInfoSpdu extends Ieee1609Dot2Data_Signed (ScmsPdu){}
export class EeRaDownloadRequestPlainSpdu extends Ieee1609Dot2Data_Unsecured (ScmsPdu){}
export class EeRaDownloadRequestSpdu extends Ieee1609Dot2Data_SignedEncrypted (ScmsPdu) {}
export class EeRaSuccessorEnrollmentCertRequestSpdu extends Ieee1609Dot2Data_SignedEncryptedCertRequest (ScmsPdu) {}
export class RaEeEnrollmentCertAckSpdu extends Ieee1609Dot2Data_Signed (ScmsPdu) {}
export class EeRaEncryptedSignedMisbehaviorReportSpdu extends Ieee1609Dot2Data_EncryptedSigned (ScmsPdu) {}
export class EeRaEncryptedMisbehaviorReportSpdu extends Ieee1609Dot2Data {}
AcaResponse.fields[0].type = AcaEeCertResponsePlainSpdu;
AcaResponse.fields[1].type = AcaEeCertResponsePrivateSpdu;
AcaResponse.fields[2].type = AcaEeCertResponseCubkSpdu;
MultiSignedCtl.fields[3].type = SequenceOf(CtlSignatureSpdu);
CompositeCrl.fields[1].type = MultiSignedCtlSpdu;
CertificateChain.fields[0].type = MultiSignedCtlSpdu;
EeRaInterfacePdu.fields[4].type = EeEcaCertRequestSpdu;
class BaseSsp extends Sequence ([
{ name:"version", type: Uint8},
{extension:true}
]){}
class ElectorSsp extends BaseSsp {}
class RootCaSsp extends BaseSsp {}
class PgSsp extends BaseSsp {}
class IcaSsp extends BaseSsp {}
class EcaSsp extends BaseSsp {}
class AcaSsp extends BaseSsp {}
class CrlSignerSsp extends BaseSsp {}
class DcmSsp extends BaseSsp {}
class LaSsp extends Sequence([
{ name:"version", type: Uint8},
{ name:"laId", type: Uint16},
{extension:true}
]){}
class LopSsp extends BaseSsp {}
class MaSsp extends Sequence([
{ name:"version", type: Uint8},
{ name:"relevantPsids", type: SequenceOf(Psid)},
{extension:true}
]){}
class RaSsp extends BaseSsp {}
class EeSsp extends BaseSsp {}
class AcpcSsp extends Choice([
{ name:"cam", type: SequenceOf(AcpcTreeId)},
{extension:true}
]){}
class DcSsp extends BaseSsp {}
export class ScmsSsp extends Choice([
{ name: "elector", type: ElectorSsp},
{ name: "root", type: RootCaSsp},
{ name: "pg", type: PgSsp},
{ name: "ica", type: IcaSsp},
{ name: "eca", type: EcaSsp},
{ name: "aca", type: AcaSsp},
{ name: "crl", type: CrlSignerSsp},
{ name: "dcm", type: DcmSsp},
{ name: "la", type: LaSsp},
{ name: "lop", type: LopSsp},
{ name: "ma", type: MaSsp},
{ name: "ra", type: RaSsp},
{ name: "ee", type: EeSsp},
{extension:true},
{ name: "dc", type: DcSsp}
]){}