Newer
Older
// 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(
20013
20014
20015
20016
20017
20018
20019
20020
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
20050
20051
20052
20053
20054
20055
20056
20057
20058
20059
20060
20061
20062
20063
20064
20065
20066
20067
20068
20069
20070
20071
20072
20073
20074
20075
20076
20077
20078
20079
20080
20081
20082
20083
20084
20085
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 tlm_ctl_generation
// ETSI TS 103 525-2 V2.0.2 (2023-07) Clause 5.9 CPOC behaviour
YannGarcia
committed
20091
20092
20093
20094
20095
20096
20097
20098
20099
20100
20101
20102
20103
20104
20105
20106
20107
20108
20109
20110
20111
20112
20113
20114
20115
20116
20117
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
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
20149
20150
20151
20152
20153
20154
20155
20156
20157
20158
20159
20160
20161
20162
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
// 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
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
// 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
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
20228
20229
20230
20231
20232
20233
*/
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;
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
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);
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
// 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);
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
20340
20341
20342
20343
20344
20345
20346
20347
20348
20349
20350
20351
// 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);
20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
20373
20374
20375
// 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);
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400
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