Newer
Older
Yann Garcia
committed
if (f_verify_pki_request_message(vc_aaPrivateEncKey, vc_aaWholeHash/*salt*/, ''O, p_request.body.binary_body.ieee1609dot2_data, true, v_request_hash, v_bfk_hashed_id8, v_etsi_ts_102941_data, v_aes_enc_key) == false) { // Cannot decrypt the message
Yann Garcia
committed
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
// Send error message
v_response := m_http_response(m_http_response_ko_no_body(p_headers, 400, "Bad request")); // Initialize v_reponse with an error message
// Set verdict
p_result := -1;
} else {
var UInt64 v_current_time := f_getCurrentTimeUtc();
var UInt64 v_delta_time := 30;
log("f_verify_http_butterfly_cert_request_message_to_ea: match ", match(v_etsi_ts_102941_data, mw_etsiTs102941Data_ra_aca_cert_request(mw_ra_aca_cert_request))); // TODO In TITAN, this is the only way to get the unmatching in log
if (match(v_etsi_ts_102941_data, mw_etsiTs102941Data_ra_aca_cert_request(mw_ra_aca_cert_request((v_current_time - v_delta_time .. v_current_time + v_delta_time), explicit, '00000000'B/*butterflyExplicit*/, mw_bfk_to_be_signed_certificate))) == false) {
// Send error message
v_response := m_http_response(m_http_response_ko_no_body(p_headers, 400, "Bad request")); // Initialize v_reponse with an error message
// Set verdict
p_result := -2;
} else {
// TODO Add checked ???
}
}
log("<<< f_verify_http_butterfly_cert_request_message_to_ea: p_result: ", p_result);
} // End of function f_verify_http_butterfly_cert_request_message_to_ea
} // End of group bfk_cert_request_helpers
/**
* @desc Check that the AA sends the butterfly certificate response message after receiving of the butterfly certificate request
* Check that this message is encrypted using the same symmetric encryption key as the butterfly certificate request message
* <pre>
* Pics Selection: PICS_IUT_AA_ROLE
* Initial conditions:
* with {
* the EA in "operational" state
* authorized with CERT_AA certificate
* }
* Expected behaviour:
* ensure that {
* when {
* the IUT received the ButterflyCertificateRequestMessage
* containing content.encryptedData.recipients
* containing the instance of RecipientInfo
* containing certRecipInfo
* containing recipientId
* indicating HashedId8 of the CERT_AA
* and containing encKey
* containing encrypted symmetric encryption key (ENC_KEY)
* }
* then {
* the IUT sends to the EA a EtsiTs103097Data-Encrypted
* containing content.encryptedData.recipients
* indicating size 1
* and containing the instance of RecipientInfo
* containing pskRecipInfo
* indicating HashedId8 of the ENC_KEY
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 v2.0.1 SECPKI_AA_AUTHVAL_01_BV
Yann Garcia
committed
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
* @reference ETSI TS 102 941, clause 6.2.3.3.2
*/
testcase TC_SECPKI_AA_BFK_AUTH_01_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variables
var HashedId8 v_aes_sym_key_hashed_id8;
var Headers v_headers;
var HttpMessage v_request;
var integer v_result;
var RaAcaCertRequest v_ra_aca_cert_request;
var AcaRaCertResponse v_aca_ra_cert_response;
// Test control
if (not PICS_IUT_AA_ROLE) {
log("*** " & testcasename() & ": PICS_IUT_AA_ROLE required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cfHttpUp(PICS_TS_EA_CERTIFICATE_ID, PICS_TS_AA_CERTIFICATE_ID);
// Test adapter configuration
// Preamble
f_trigger_butterfly_cert_request(v_aes_sym_key_hashed_id8, v_ra_aca_cert_request);
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpAtVPort.receive(
mw_http_request(
mw_http_request_post(
-, // URI
v_headers, // Headers
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_butterflyCertResponseMessage(
mw_encryptedData
Yann Garcia
committed
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
)))))) -> value v_request {
tc_ac.stop;
f_verify_http_butterfly_cert_request_message_to_ea(v_request.request, v_headers, v_result, v_aca_ra_cert_response);
// Set verdict
if (v_result == 0) {
log("*** " & testcasename() & ": PASS: ButterflyCertResponsetMessage received ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Failed to verify ButterflyCertResponsetMessage ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
}
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_cfHttpDown();
} // End of testcase TC_SECPKI_AA_BFK_AUTH_01_BV
} // End of group authorization_with_bfk
} // End of group aa_beavior
group ca_behavior {
group ctl {
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
/**
* @desc Check that the RootCA generates the Full CTL when new EA is about to be added to the Root CTL
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE
* Initial conditions:
* }
* Expected behaviour:
* ensure that {
* when {
* the RootCA is triggered to add new EA certificate (CERT_EA) in the CTL
* }
* then {
* the IUT issue a new CTL of type CtlFormat
* containing isFullCtl
* indicating TRUE
* and containing ctlCommands
* containing CtlCommand
* containing add
* containing ea
* containing eaCertificate
* indicating CERT_EA
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 TP RCA_CTLGEN_01_BV
* @reference ETSI TS 102 941, clause 6.3.2 and 6.3.4
*/
testcase TC_RCA_CTLGEN_01_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not PICS_IUT_CA_ROLE) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE required for executing the TC ***");
setverdict(inconc);
stop;
}
// Preamble
f_init_default_headers_list(PICS_HEADER_CTL_CONTENT_TYPE, "ca_request", v_headers);
action("The RootCA is triggered to add new EA certificate (CERT_EA) in the CTL");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
// Test Body
f_http_send(
v_headers,
m_http_request(
m_http_request_get(
PICS_HTTP_GET_URI_CTL,
v_headers
)));
tc_ac.start;
alt {
[not(PICS_MULTIPLE_END_POINT)] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
mw_toBeSignedData(
mw_signedDataPayload
),
var ToBeSignedRcaCtl v_to_be_signed_rca_ctl;
tc_ac.stop;
// Check ETag header
if (f_check_headers(v_response.response.header, c_etag_http_header) == false) {
log("*** " & testcasename() & ": INFO: 'ETag' HTTP header not set ***");
//f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
} else {
f_get_header(v_response.response.header, c_etag_http_header, v_etag);
log("*** " & testcasename() & ": INFO: ETag= ", v_etag[0]);
}
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
if (f_verify_rca_ctl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, true, v_to_be_signed_rca_ctl) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
if (f_verify_full_ctl(v_to_be_signed_rca_ctl) == true) {
log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
}
}
[PICS_MULTIPLE_END_POINT] httpCaPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
mw_toBeSignedData(
mw_signedDataPayload
),
YannGarcia
committed
?
var ToBeSignedRcaCtl v_to_be_signed_rca_ctl;
tc_ac.stop;
// Check ETag header
if (f_check_headers(v_response.response.header, c_etag_http_header) == false) {
log("*** " & testcasename() & ": INCONC: 'ETag' HTTP header not set ***");
//f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
} else {
f_get_header(v_response.response.header, c_etag_http_header, v_etag);
log("*** " & testcasename() & ": INFO: ETag= ", v_etag[0]);
}
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
if (f_verify_rca_ctl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, true, v_to_be_signed_rca_ctl) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
if (f_verify_full_ctl(v_to_be_signed_rca_ctl) == true) {
log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
}
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_cfHttpDown_ca();
} // End of testcase TC_RCA_CTLGEN_01_BV
} // End of group ctl
group crl {
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
/**
* @desc Check that the RootCA generates the CRL signed with appropriate certificate
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE
* Initial conditions:
* }
* Expected behaviour:
* ensure that {
* when {
* the RootCA is triggered to add new CA certificate (CERT_CA) to the revocation list
* }
* then {
* the IUT issue a new CRL of type ToBeSignedCrl
* containing emtries
* containing item of type CrlEntry
* indicating HashedId8 of CERT_CA
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 TP RCA_CRLGEN_01_BV
* @reference ETSI TS 102 941, clause 6.3.3
*/
testcase TC_RCA_CRLGEN_01_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not PICS_IUT_CA_ROLE) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE required for executing the TC ***");
setverdict(inconc);
stop;
}
// Preamble
f_init_default_headers_list(PICS_HEADER_CRL_CONTENT_TYPE, "ca_request", v_headers);
action("the RootCA is triggered to generate new CRL");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
// Test Body
f_http_send(
v_headers,
m_http_request(
m_http_request_get(
PICS_HTTP_GET_URI_CRL,
v_headers
)));
tc_ac.start;
alt {
[not(PICS_MULTIPLE_END_POINT)] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
mw_toBeSignedData( mw_signedDataPayload ),
mw_signerIdentifier_digest
))))))) -> value v_response {
var ToBeSignedCrl v_to_be_signed_crl;
tc_ac.stop;
if (f_verify_rca_crl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, true, v_to_be_signed_crl) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
if (f_verify_full_crl(v_to_be_signed_crl) == true) {
log("*** " & testcasename() & ": PASS: ToBeSignedCrl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
}
}
[PICS_MULTIPLE_END_POINT] httpCaPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
mw_toBeSignedData( mw_signedDataPayload ),
mw_signerIdentifier_digest
))))))) -> value v_response {
var ToBeSignedCrl v_to_be_signed_crl;
tc_ac.stop;
if (f_verify_rca_crl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, true, v_to_be_signed_crl) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
if (f_verify_full_crl(v_to_be_signed_crl) == true) {
log("*** " & testcasename() & ": PASS: ToBeSignedCrl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
}
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_cfHttpDown_ca();
} // End of testcase TC_RCA_CRLGEN_01_BV
} // End of group crl
} // End of group ca_behavior
group tlm_behavior {
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
group ctl {
/**
* @desc Check that the TLM generates the ECTL when new RootCA is about to be added
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE
* Initial conditions:
* }
* Expected behaviour:
* ensure that {
* when {
* the TLM is triggered to add new RootCA certificate (CERT_RCA) in the CTL
* }
* then {
* the IUT issue a new CTL of type CtlFormat
* containing isFullCtl
* indicating TRUE
* and containing ctlCommands
* containing CtlCommand
* containing add
* containing rca
* containing selfsignedRootCa
* indicating CERT_RCA
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 TP TLM_ECTLGEN_01_BV
* @reference ETSI TS 102 941, clause 6.3.1
*/
testcase TC_TLM_ECTLGEN_01_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variables
var Headers v_headers;
var HttpMessage v_response;
// Test control
if (not PICS_IUT_CA_ROLE) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE required for executing the TC ***");
setverdict(inconc);
stop;
}
// Preamble
f_init_default_headers_list(PICS_HEADER_CTL_CONTENT_TYPE, "tlm_request", v_headers);
action("The TLM is triggered to add new RootCA certificate (CERT_RCA) in the CTL");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// Test Body
f_http_send(
v_headers,
m_http_request(
m_http_request_get(
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
v_headers
)));
tc_ac.start;
alt {
[not(PICS_MULTIPLE_END_POINT)] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
mw_toBeSignedData( mw_signedDataPayload ),
- // Certificate or HasedId8
))))))) -> value v_response {
var ToBeSignedTlmCtl v_to_be_signed_tlm_ectl;
tc_ac.stop;
// FIXME Can not verify signature, to be checked
if (f_verify_tlm_ectl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, false, v_to_be_signed_tlm_ectl) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
if (f_verify_full_ectl(v_to_be_signed_tlm_ectl) == true) {
log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
}
}
[PICS_MULTIPLE_END_POINT] httpTlmPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
mw_toBeSignedData( mw_signedDataPayload ),
- // Certificate or HasedId8
))))))) -> value v_response {
var ToBeSignedTlmCtl v_to_be_signed_tlm_ectl;
tc_ac.stop;
// FIXME Can not verify signature, to be checked
if (f_verify_tlm_ectl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, false, v_to_be_signed_tlm_ectl) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
if (f_verify_full_ectl(v_to_be_signed_tlm_ectl) == true) {
log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
}
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_cfHttpDown_tlm();
} // End of testcase TC_TLM_ECTLGEN_01_BV
} // End of group ctl
} // End of group tlm_behavior
YannGarcia
committed
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
group cpoc_behavior {
/**
* @desc Check that the TLM CTL is published and accessible when issued
* <pre>
* Pics Selection:
* Initial conditions:
* the TLM issued a new CTL
* }
* Expected behaviour:
* ensure that {
* when {
* the ITS-S asked the IUT for the newly issued CTL
* }
* then {
* the IUT is answered with this CTL
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 TP SECPKI_CPOC_LISTDIST_01_BV
* @reference ETSI TS 102 941, Clauses 6.3.2 and 6.3.3
*/
testcase TC_SECPKI_CPOC_LISTDIST_01_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variable
var Headers v_headers;
var HttpMessage v_response;
YannGarcia
committed
// Test component configuration
f_cfHttpUp(PICS_TS_EA_CERTIFICATE_ID, PICS_TS_AA_CERTIFICATE_ID);
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
f_init_default_headers_list(-, "cpoc_request", v_headers);
f_http_send(
v_headers,
m_http_request(
m_http_request_get(
YannGarcia
committed
v_headers
)));
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
YannGarcia
committed
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
// Test Body
tc_ac.start;
alt {
[not(PICS_MULTIPLE_END_POINT)] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
mw_toBeSignedData(
mw_signedDataPayload
)
))))))) -> value v_response {
var ToBeSignedTlmCtl v_to_be_signed_tlm_ectl;
tc_ac.stop;
// FIXME Can not verify signature, to be checked
if (f_verify_tlm_ectl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, false, v_to_be_signed_tlm_ectl) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify ECTL message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
if (f_verify_full_ectl(v_to_be_signed_tlm_ectl) == true) {
log("*** " & testcasename() & ": PASS: ToBeSignedTlmCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
}
}
[PICS_MULTIPLE_END_POINT] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
mw_toBeSignedData(
mw_signedDataPayload
)
))))))) -> value v_response {
var ToBeSignedTlmCtl v_to_be_signed_tlm_ectl;
YannGarcia
committed
tc_ac.stop;
YannGarcia
committed
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
// FIXME Can not verify signature, to be checked
if (f_verify_tlm_ectl_response_message(v_response.response.body.binary_body.ieee1609dot2_data, false, v_to_be_signed_tlm_ectl) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify ECTL message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
if (f_verify_full_ectl(v_to_be_signed_tlm_ectl) == true) {
log("*** " & testcasename() & ": PASS: ToBeSignedTlmCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Receive unexpected message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
}
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
}
} // End of 'alt' statement
YannGarcia
committed
// Postamble
f_cfHttpDown();
} // End of testcase TC_SECPKI_CPOC_LISTDIST_01_BV
YannGarcia
committed
} // End of group cpoc_behavior
group pki_platform_simu {
/**
* @desc Await for DC/CTL/CRL request and provides "CERT_IUT_A_RCA", "CERT_TS_A_AA", "CERT_TS_A_EA" certificates
* It simulates the ETSI point of certificates distribution
* Usage: curl 'http://192.168.1.43/dc/getctl/{hasehedid8}' --header 'Content-Type: application/x-its-ctl' --header 'Content-Text: ca_request' --output ctl.oer
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
*/
testcase TC_PKI_PLTF_RCV_BV_01() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variables
var charstring v_rca_certificate_id := "CERT_IUT_A_RCA";
var charstring v_tlm_certificate_id := "CERT_IUT_A_RCA"; // TODO Need CERT_IUT_A_TLM certificate
var charstring v_aa_certificate_id := "CERT_TS_A_AA";
var charstring v_ea_certificate_id := "CERT_TS_A_EA";
var Oct32 v_hash;
var Oct8 v_rca_hashed_id8;
var HttpMessage v_request;
var boolean v_result := false;
var ToBeSignedRcaCtl v_ctl;
var Headers v_headers;
var template (value) HttpMessage v_response;
var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
var EtsiTs102941Data v_etsi_ts_102941_data;
var Oct16 v_request_hash;
var Oct16 v_aes_enc_key;
// Test component configuration
f_cfHttpUp_ca();
// Test control
if (not PICS_IUT_CA_ROLE) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
f_cfHttpUp_ca();
// Preamble
f_getCertificateHash256(v_rca_certificate_id, v_hash);
v_rca_hashed_id8 := f_hashedId8FromSha256(v_hash);
log("*** " & testcasename() & ": DEBUG: v_rca_hashed_id8= ", v_rca_hashed_id8);
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// Test Body
tc_wait.start;
alt {
[] a_await_dc_http_request_from_iut( // Await for DC request
mw_http_request(
mw_http_request_get(
PICS_HTTP_GET_URI_DC & "/" & oct2str(v_rca_hashed_id8)
)),
v_request
) {
var EtsiTs103097Certificate v_rca_certificate;
tc_wait.stop;
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
f_init_default_headers_list(-, "ca_response", v_headers);
// Send message
f_build_dc(
v_rca_certificate_id,
v_rca_certificate
);
log("*** " & testcasename() & ": INFO: v_rca_certificate: ", v_rca_certificate);
v_response := m_http_response(m_http_response_ok(m_http_message_body_binary(m_binary_body_ieee1609dot2_certificate(v_rca_certificate)), v_headers));
f_http_send(v_headers, v_response);
log("*** " & testcasename() & ": INFO: ToBeSignedRcaCtl sent ***");
tc_wait.start;
repeat;
}
[] a_await_ctl_http_request_from_iut( // Await for CTL request
mw_http_request(
mw_http_request_get(
PICS_HTTP_GET_URI_CTL & "/" & oct2str(v_rca_hashed_id8)
)),
v_request
) {
var ToBeSignedRcaCtl v_to_be_signed_rca_ctl;
tc_wait.stop;
f_init_default_headers_list(-, "ca_response", v_headers);
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
// Send message
f_build_ctl(
v_ea_certificate_id,
v_aa_certificate_id,
v_rca_certificate_id,
v_to_be_signed_rca_ctl
);
log("*** " & testcasename() & ": INFO: v_to_be_signed_rca_ctl: ", v_to_be_signed_rca_ctl);
f_sign_dc_ctl(v_rca_certificate_id, v_to_be_signed_rca_ctl, v_ieee1609dot2_signed_and_encrypted_data);
log("*** " & testcasename() & ": INFO: v_ieee1609dot2_signed_and_encrypted_data: ", v_ieee1609dot2_signed_and_encrypted_data);
v_response := m_http_response(m_http_response_ok(m_http_message_body_binary(m_binary_body_ieee1609dot2_data(v_ieee1609dot2_signed_and_encrypted_data)), v_headers));
f_http_send(v_headers, v_response);
log("*** " & testcasename() & ": INFO: ToBeSignedRcaCtl sent ***");
tc_wait.start;
repeat;
}
[] a_await_crl_http_request_from_iut( // Await for CTL request
mw_http_request(
mw_http_request_get(
PICS_HTTP_GET_URI_CRL & "/" & oct2str(v_rca_hashed_id8)
)),
v_request
) {
var ToBeSignedCrl v_to_be_signed_crl;
tc_wait.stop;
f_init_default_headers_list(-, "ca_response", v_headers);
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
// Send message
f_build_crl(
-,
-,
v_to_be_signed_crl
);
log("*** " & testcasename() & ": INFO: v_to_be_signed_crl: ", v_to_be_signed_crl);
f_sign_dc_crl(v_rca_certificate_id, v_to_be_signed_crl, v_ieee1609dot2_signed_and_encrypted_data);
log("*** " & testcasename() & ": INFO: v_ieee1609dot2_signed_and_encrypted_data: ", v_ieee1609dot2_signed_and_encrypted_data);
v_response := m_http_response(m_http_response_ok(m_http_message_body_binary(m_binary_body_ieee1609dot2_data(v_ieee1609dot2_signed_and_encrypted_data)), v_headers));
f_http_send(v_headers, v_response);
log("*** " & testcasename() & ": INFO: ToBeSignedCRl sent ***");
tc_wait.start;
repeat;
}
[] a_await_cpoc_http_request_from_iut( // Await for TLM request (E-CPOC)
mw_http_request(
mw_http_request_get(
PICS_HTTP_GET_URI_TLM & "/" & oct2str(v_rca_hashed_id8)
)),
v_request
) {
var ToBeSignedTlmCtl v_to_be_signed_tlm_ctl;
tc_wait.stop;
f_init_default_headers_list(-, "ca_response", v_headers);
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
// Send message
f_build_tlm(
v_tlm_certificate_id,
v_rca_certificate_id,
v_to_be_signed_tlm_ctl
);
log("*** " & testcasename() & ": INFO: v_to_be_signed_tlm_ctl: ", v_to_be_signed_tlm_ctl);
f_sign_dc_ctl(v_rca_certificate_id, v_to_be_signed_tlm_ctl, v_ieee1609dot2_signed_and_encrypted_data);
log("*** " & testcasename() & ": INFO: v_ieee1609dot2_signed_and_encrypted_data: ", v_ieee1609dot2_signed_and_encrypted_data);
v_response := m_http_response(m_http_response_ok(m_http_message_body_binary(m_binary_body_ieee1609dot2_data(v_ieee1609dot2_signed_and_encrypted_data)), v_headers));
f_http_send(v_headers, v_response);
log("*** " & testcasename() & ": INFO: ToBeSignedTlmCtl sent ***");
tc_wait.start;
repeat;
}
[] a_await_any_http_request_from_iut(
mw_http_request,
v_request
) {
tc_wait.stop;
f_init_default_headers_list(-, "ca_response", v_headers);
v_response := m_http_response(m_http_response_400_bad_request(m_http_message_body_html("<!DOCTYPE html><html><body><h1>ETSI ITS PKI Infrastructure L0 simulator</h1><p>Request not supported</p></body></html>"), v_headers));
f_http_send(v_headers, v_response);
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
tc_wait.start;
repeat;
}
[] tc_wait.timeout {
//log("*** " & testcasename() & ": PASS: Terminate Generation/Distrbution server ***");
//f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
tc_wait.start;
repeat;
}
} // End of 'alt' statement
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
// Postamble
f_cfHttpDown_ca();
} // End of testcase TC_PKI_PLTF_RCV_BV_01
} // End of group pki_platform_simu