Newer
Older
YannGarcia
committed
// Postamble
f_cfHttpDown_tlm();
} // End of function f_TC_SECPKI_ITSS_CTLDIST_02_BV_pki
} // End of group f_TC_SECPKI_ITSS_CTLDIST_02_BV
YannGarcia
committed
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
/**
* @desc Check that the IUT is using the proper BTP port to broadcast the Delta CTL
* <pre>
* Pics Selection: PICS_UC_SEC_05_2
* Initial conditions: {
* the IUT is configured to support P2P X_DISTRIBUTION distribution
* and the IUT has received the Delta X_DISTRIBUTION message
* }
* Expected behaviour:
* ensure that {
* when {
* the IUT is triggered to broadcast the Delta X_DISTRIBUTION message
* }
* then {
* the IUT sends the X_MESSAGE
* using the BTP port 2014
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 TP SECPKI_ITSS_CTLDIST_03_BV
* @reference ETSI TS 103 601, clause 5.4.4
*/
testcase TC_SECPKI_ITSS_CTLDIST_03_BV() runs on ItsMtc system ItsPkiItssSystem {
// Local variables
var ItsPkiItss v_itss;
var ItsPkiHttp v_cpoc;
YannGarcia
committed
// Test control
if (not PICS_IUT_ITS_S_ROLE or not PICS_UC_SEC_05_2) {
log("*** " & testcasename() & ": PICS_IUT_ITS_S_ROLE and PICS_UC_SEC_05_2 required for executing the TC ***");
setverdict(inconc);
stop;
}
YannGarcia
committed
// Test component configuration
f_cfMtcUp03(v_itss, v_cpoc);
// Start components
v_itss.start(f_TC_SECPKI_ITSS_CTLDIST_03_BV_itss());
v_cpoc.start(f_TC_SECPKI_ITSS_CTLDIST_03_BV_pki());
YannGarcia
committed
// Synchronization
f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
YannGarcia
committed
// Cleanup
f_cfMtcDown03(v_itss, v_cpoc);
YannGarcia
committed
} // End of testcase TC_SECPKI_ITSS_CTLDIST_03_BV
YannGarcia
committed
group f_TC_SECPKI_ITSS_CTLDIST_03_BV {
YannGarcia
committed
function f_TC_SECPKI_ITSS_CTLDIST_03_BV_itss() runs on ItsPkiItss system ItsPkiItssSystem {
// Local variables
var GeoNetworkingInd v_geonetworking_message;
var octetstring v_payload;
YannGarcia
committed
// Test component configuration
f_cfUp_itss();
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
geoNetworkingPort.clear;
tc_ac.start;
alt {
[] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwSecPdu(
mw_etsiTs103097Data_signed(
mw_signedData
)))) {
tc_ac.stop;
YannGarcia
committed
f_sendUtTriggerUpdateEctl(""); // FIXME Create PIXIT for ETCL URI
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
}
} // End of 'alt' statement
YannGarcia
committed
// Test Body
geoNetworkingPort.clear;
tc_ac.start;
alt {
[] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwSecPdu(
mw_etsiTs103097Data_signed(
mw_signedData
)))) -> value v_geonetworking_message {
tc_ac.stop;
YannGarcia
committed
if (f_verify_and_extract_payload(v_geonetworking_message.msgIn, -, v_payload) == false) {
log("*** " & testcasename() & ": INCONC: Failed to verifiy payload ***");
f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
} else {
// TODO Check payload
if (substr(v_payload, 0, 2) == int2oct(2014, 2)) { // TODO Reorganize CAM/DENM/BTP test suites
log("*** " & testcasename() & ": PASS: Delta CTL was successfully broadcasted on the correct BTP port ***");
f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Delta CTL was not broadcasted on BTP port 114 ***");
f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_error);
}
}
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
}
} // End of 'alt' statement
YannGarcia
committed
// Postamble
f_cfDown_itss();
YannGarcia
committed
} // End of function TC_SECPKI_ITSS_CTLDIST_03_BV_itss
YannGarcia
committed
function f_TC_SECPKI_ITSS_CTLDIST_03_BV_pki() runs on ItsPkiHttp system ItsPkiItssSystem {
// Local variable
var HttpMessage v_response;
var Headers v_headers;
// Test component configuration
f_cfHttpUp_tlm();
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
tc_ac.start;
alt {
[] a_await_cpoc_http_request_from_iut(
mw_http_request(
mw_http_request_get(
YannGarcia
committed
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
)),
v_response
) {
var HashedId8 v_rca_hashed_id8; // Used for signature
var Oct32 v_rca_private_key;
var EtsiTs103097Certificate v_rca_new; // The CERT_RCA_NEW
var bitstring v_enc_msg;
var ToBeSignedData v_tbs;
var bitstring v_tbs_enc;
var Oct32 v_tbs_signed;
var Signature v_signature;
var Ieee1609Dot2Data v_ieee1609dot2_signed_data;
tc_ac.stop;
// Read certificates
f_getCertificateHash(PICS_IUT_CA_CERTIFICATE_ID, v_rca_hashed_id8);
f_readSigningKey(PICS_IUT_CA_CERTIFICATE_ID, v_rca_private_key);
f_readCertificate(cc_ectl_rca_new, v_rca_new);
// Build the ToBeSignedTlmCtl data structure
v_enc_msg := encvalue(
valueof(
m_to_be_signed_tlm_full_ctl(
f_getCurrentTime() / 1000 + 3600,
10,
{
m_ctrl_command_add(
m_ctl_entry_rca(
m_root_ca_entry(
v_rca_new
)))
}
)));
v_tbs := valueof(
m_toBeSignedData(
m_signedDataPayload(
m_etsiTs103097Data_unsecured(bit2oct(v_enc_msg))
),
m_headerInfo_inner_pki_request(-, (f_getCurrentTime() * 1000)/*us*/)
));
v_tbs_enc := encvalue(v_tbs);
// Sign the certificate
v_tbs_signed := f_signWithEcdsa(bit2oct(v_tbs_enc), v_rca_hashed_id8, v_rca_private_key);
v_signature := valueof(
m_signature_ecdsaNistP256(
m_ecdsaP256Signature(
m_eccP256CurvePoint_x_only(
substr(v_tbs_signed, 0, 32)
),
substr(v_tbs_signed, 32, 32)
)));
log(testcasename() & ": v_signature= ", v_signature);
v_ieee1609dot2_signed_data := valueof(
m_etsiTs103097Data_signed(
m_signedData(
sha256,
v_tbs,
m_signerIdentifier_digest(v_rca_hashed_id8),
v_signature
)));
// Send response with CERT_RCA_NEW
f_init_default_headers_list(-, "tlm_ectl", v_headers);
f_http_send(
v_headers,
m_http_response(
m_http_response_ok(
m_http_message_body_binary(
m_binary_body_ieee1609dot2_data(
v_ieee1609dot2_signed_data
)),
v_headers
)));
YannGarcia
committed
log("*** " & testcasename() & ": INFO: CERT_RCA_NEW was sent to the IUT ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
}
} // End of 'alt' statement
YannGarcia
committed
// Test Body
f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
YannGarcia
committed
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
// Postamble
f_cfHttpDown_tlm();
} // End of function f_TC_SECPKI_ITSS_CTLDIST_03_BV_pki
} // End of group f_TC_SECPKI_ITSS_CTLDIST_03_BV
/**
* @desc Check that the IUT stops to redistribute the Delta CTL if anorther node is also sending it
* <pre>
* Pics Selection: PICS_UC_SEC_05_2
* Initial conditions: {
* the IUT is configured to support P2P Delta X_DISTRIBUTION distribution
* and the IUT has started broadcasting the Delta X_DISTRIBUTION message
* signed with X_CERTIFICATE
* and containing ctlSequence (SN)
* }
* Expected behaviour:
* ensure that {
* when {
* the IUT has received the Delta X_DISTRIBUTION
* signed with X_CERTIFICATE
* and containing ctlSequence
* indicating value equal or higher than SN
* }
* then {
* the IUT stops broadfcasting the Delta X_DISTRIBUTION
* signed with X_CERTIFICATE
* and containing ctlSequence (SN)
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 TP SECPKI_ITSS_CTLDIST_04_BV
* @reference ETSI TS 103 601, clause 5.4.4
*/
testcase TC_SECPKI_ITSS_CTLDIST_04_BV() runs on ItsMtc system ItsPkiItssSystem {
// Local variables
var ItsPkiItss v_itss;
var ItsPkiHttp v_cpoc;
YannGarcia
committed
// Test control
if (not PICS_IUT_ITS_S_ROLE or not PICS_UC_SEC_05_2) {
log("*** " & testcasename() & ": PICS_IUT_ITS_S_ROLE and PICS_UC_SEC_05_2 required for executing the TC ***");
setverdict(inconc);
stop;
}
YannGarcia
committed
// Test component configuration
f_cfMtcUp03(v_itss, v_cpoc);
// Start components
v_itss.start(f_TC_SECPKI_ITSS_CTLDIST_04_BV_itss());
v_cpoc.start(f_TC_SECPKI_ITSS_CTLDIST_04_BV_pki());
YannGarcia
committed
// Synchronization
f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
YannGarcia
committed
// Cleanup
f_cfMtcDown03(v_itss, v_cpoc);
YannGarcia
committed
} // End of testcase TC_SECPKI_ITSS_CTLDIST_04_BV
YannGarcia
committed
group f_TC_SECPKI_ITSS_CTLDIST_04_BV {
function f_broadcast_delta_ctl(
in charstring p_certificate_id,
out Ieee1609Dot2Data p_delta_ctl
) runs on ItsPkiItss return GeoNetworkingPdu {
// Local variables
var GeoNetworkingPdu v_securedGnPdu;
YannGarcia
committed
log(">>> f_broadcast_delta_ctl");
YannGarcia
committed
v_securedGnPdu := f_prepareSecuredCam(p_certificate_id, valueof(m_headerInfo_cam(-, (f_getCurrentTime() * 1000)/*us*/)), valueof(m_signerIdentifier_digest), f_getTsStationId());
log("f_sendSecuredCam: v_securedGnPdu= ", v_securedGnPdu);
geoNetworkingPort.send(valueof(m_geoNwReq_linkLayerBroadcast(v_securedGnPdu)));
return v_securedGnPdu;
} // End of function f_broadcast_delta_ctl
YannGarcia
committed
function f_TC_SECPKI_ITSS_CTLDIST_04_BV_itss() runs on ItsPkiItss system ItsPkiItssSystem {
// Local variables
var GeoNetworkingInd v_geonetworking_message;
var octetstring v_payload;
var Ieee1609Dot2Data v_delta_ctl;
YannGarcia
committed
// Test component configuration
f_cfUp_itss();
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
geoNetworkingPort.clear;
tc_ac.start;
alt {
[] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwSecPdu(
mw_etsiTs103097Data_signed(
mw_signedData
)))) {
tc_ac.stop;
YannGarcia
committed
f_sendUtTriggerUpdateEctl(""); // FIXME Create PIXIT for ETCL URI
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
}
} // End of 'alt' statement
// Check that the IUT is boradcasting the Delta CTL
geoNetworkingPort.clear;
tc_ac.start;
alt {
[] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwSecPdu(
mw_etsiTs103097Data_signed(
mw_signedData
)))) -> value v_geonetworking_message {
tc_ac.stop;
YannGarcia
committed
if (f_verify_and_extract_payload(v_geonetworking_message.msgIn, -, v_payload) == false) {
log("*** " & testcasename() & ": INCONC: Failed to verifiy payload ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
} else {
// TODO Check payload
if (substr(v_payload, 0, 2) == int2oct(2014, 2)) { // TODO Reorganize CAM/DENM/BTP test suites
log("*** " & testcasename() & ": INFO: Delta CTL was successfully broadcasted on the correct BTP port ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
} else {
log("*** " & testcasename() & ": INCONC: Delta CTL was not broadcasted on BTP port 114 ***");
f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
}
}
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictPreamble(c_tbDone, e_timeout);
}
} // End of 'alt' statement
YannGarcia
committed
// Test Body
// Delta CTL boradcasting from another node
f_broadcast_delta_ctl(cc_ectl_rca_new, v_delta_ctl);
// Check that the IUT stops broadcasting Delta CTL
geoNetworkingPort.clear;
tc_noac.start;
alt {
[] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwSecPdu(
mw_etsiTs103097Data_signed(
mw_signedData
)))) -> value v_geonetworking_message {
tc_noac.stop;
YannGarcia
committed
if (f_verify_and_extract_payload(v_geonetworking_message.msgIn, -, v_payload) == false) {
log("*** " & testcasename() & ": INCONC: Failed to verifiy payload ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
} else {
// TODO Check payload
if (substr(v_payload, 0, 2) == int2oct(2014, 2)) { // TODO Reorganize CAM/DENM/BTP test suites
log("*** " & testcasename() & ": FAIL: The IUT shall not continue Delta CTL broadcasting ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
} else {
tc_noac.start;
repeat;
}
}
}
[] tc_noac.timeout {
log("*** " & testcasename() & ": PASS: IUT stops broadcasting Delta CTL ***");
f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
}
} // End of 'alt' statement
YannGarcia
committed
// Postamble
f_cfDown_itss();
YannGarcia
committed
} // End of function TC_SECPKI_ITSS_CTLDIST_04_BV_itss
YannGarcia
committed
function f_TC_SECPKI_ITSS_CTLDIST_04_BV_pki() runs on ItsPkiHttp system ItsPkiItssSystem {
// Local variable
var HttpMessage v_response;
var Headers v_headers;
// Test component configuration
f_cfHttpUp_tlm();
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
tc_ac.start;
alt {
[] a_await_cpoc_http_request_from_iut(
mw_http_request(
mw_http_request_get(
YannGarcia
committed
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
)),
v_response
) {
var HashedId8 v_rca_hashed_id8; // Used for signature
var Oct32 v_rca_private_key;
var EtsiTs103097Certificate v_rca_new; // The CERT_RCA_NEW
var bitstring v_enc_msg;
var ToBeSignedData v_tbs;
var bitstring v_tbs_enc;
var Oct32 v_tbs_signed;
var Signature v_signature;
var Ieee1609Dot2Data v_ieee1609dot2_signed_data;
tc_ac.stop;
// Read certificates
f_getCertificateHash(PICS_IUT_CA_CERTIFICATE_ID, v_rca_hashed_id8);
f_readSigningKey(PICS_IUT_CA_CERTIFICATE_ID, v_rca_private_key);
f_readCertificate(cc_ectl_rca_new, v_rca_new);
// Build the ToBeSignedTlmCtl data structure
v_enc_msg := encvalue(
valueof(
m_to_be_signed_tlm_full_ctl(
f_getCurrentTime() / 1000 + 3600,
10,
{
m_ctrl_command_add(
m_ctl_entry_rca(
m_root_ca_entry(
v_rca_new
)))
}
)));
v_tbs := valueof(
m_toBeSignedData(
m_signedDataPayload(
m_etsiTs103097Data_unsecured(bit2oct(v_enc_msg))
),
m_headerInfo_inner_pki_request(-, (f_getCurrentTime() * 1000)/*us*/)
));
v_tbs_enc := encvalue(v_tbs);
// Sign the certificate
v_tbs_signed := f_signWithEcdsa(bit2oct(v_tbs_enc), v_rca_hashed_id8, v_rca_private_key);
v_signature := valueof(
m_signature_ecdsaNistP256(
m_ecdsaP256Signature(
m_eccP256CurvePoint_x_only(
substr(v_tbs_signed, 0, 32)
),
substr(v_tbs_signed, 32, 32)
)));
log(testcasename() & ": v_signature= ", v_signature);
v_ieee1609dot2_signed_data := valueof(
m_etsiTs103097Data_signed(
m_signedData(
sha256,
v_tbs,
m_signerIdentifier_digest(v_rca_hashed_id8),
v_signature
)));
// Send response with CERT_RCA_NEW
f_init_default_headers_list(-, "tlm_ectl", v_headers);
f_http_send(
v_headers,
m_http_response(
m_http_response_ok(
m_http_message_body_binary(
m_binary_body_ieee1609dot2_data(
v_ieee1609dot2_signed_data
)),
v_headers
)));
YannGarcia
committed
log("*** " & testcasename() & ": INFO: CERT_RCA_NEW was sent to the IUT ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_success);
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
}
} // End of 'alt' statement
YannGarcia
committed
// Test Body
f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
YannGarcia
committed
// Postamble
f_cfHttpDown_tlm();
} // End of function f_TC_SECPKI_ITSS_CTLDIST_04_BV_pki
} // End of group f_TC_SECPKI_ITSS_CTLDIST_04_BV
YannGarcia
committed
} // End of group itss_ctl_distribution
// ETSI TS 103 525-2 V2.0.2 (2023-07) Clause 5.2.6 CRL handling
YannGarcia
committed
group itss_crl_handling {
// TODO To be done after validation of itss_ctl_handling group as CTL and CRL are close
} // End of group itss_crl_handling
// ETSI TS 103 525-2 V2.0.2 (2023-07) Clause 5.2.7 CRL distribution
YannGarcia
committed
group itss_crl_distribution {
// TODO To be done after validation of itss_ctl_distribution group as CTL and CRL are close
} // End of group itss_crl_distribution
YannGarcia
committed
} // End of group itss_behavior
// ETSI TS 103 525-2 V2.0.2 (2023-07) Clause 5.3.1 Certificate validation
YannGarcia
committed
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
group ca_behaviour {
/**
* @desc Check that the issuing certificate has version 3
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE
* Initial conditions:
* with {
* CA is in 'operational' state
* }
* Expected behaviour:
* ensure that {
* when {
* the CA is requested to issue the certificate
* }
* then {
* this certificate is of type EtsiTs103097Certificate
* containing version
* indicating value 3
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 v2.0.1 SECPKI_CA_CERTGEN_01_BV
YannGarcia
committed
* @reference ETSI TS 103 097 [2], clause 6
* IEEE Std 1609.2 [3], clause 6.4.3
*/
YannGarcia
committed
testcase TC_SECPKI_CA_CERTGEN_01_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
YannGarcia
committed
// Local variables
var integer v_result;
var Certificate v_root_certificate;
YannGarcia
committed
// Test control
if (not PICS_IUT_CA_ROLE) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE required for executing the TC ***");
setverdict(inconc);
stop;
}
YannGarcia
committed
// Test component configuration
f_connect4SelfOrClientSync();
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
v_result := f_get_root_ca_certificate(-, -, v_root_certificate);
if (v_result == -1) {
log("*** " & testcasename() & ": INCONC: Fail to retrive the RCA ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
} else {
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
YannGarcia
committed
// Test Body
if (f_verify_rca_certificate(-, v_root_certificate) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
YannGarcia
committed
// Postamble
f_disconnect4SelfOrClientSync();
YannGarcia
committed
} // End of testcase TC_SECPKI_CA_CERTGEN_01_BV
YannGarcia
committed
/**
* @desc Check that the issuing certificate has type explicit
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE and PICS_SEC_EXPLICIT_CERTIFICATES
* Initial conditions:
* with {
* CA is in 'operational' state
* CA is initialized with the explicit certificate (CERT_IUT_A_RCA)
YannGarcia
committed
* }
* Expected behaviour:
* ensure that {
* when {
* the CA is requested to issue the explicit certificate
* }
* then {
* this certificate is of type EtsiTs103097Certificate
* containing version
* indicating value 3
* and containing type
* indicating 'explicit'
* and containing toBeSigned
* containing verifyKeyIndicator
* containing verificationKey
* and containing signature
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 v2.0.1 SECPKI_CA_CERTGEN_02_BV_01
YannGarcia
committed
* @reference ETSI TS 103 097 [2], clause 6
* IEEE Std 1609.2 [3], clause 6.4.3
*/
YannGarcia
committed
testcase TC_SECPKI_CA_CERTGEN_02_BV_01() runs on ItsPkiHttp system ItsPkiHttpSystem {
YannGarcia
committed
// Local variables
var integer v_result;
var Certificate v_root_certificate;
YannGarcia
committed
// Test control
if ((not PICS_IUT_CA_ROLE) or not(PICS_SEC_EXPLICIT_CERTIFICATES)) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE and PICS_SEC_EXPLICIT_CERTIFICATES required for executing the TC ***");
setverdict(inconc);
stop;
}
YannGarcia
committed
// Test component configuration
f_connect4SelfOrClientSync();
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
v_result := f_get_root_ca_certificate(-, -, v_root_certificate);
if (v_result == -1) {
log("*** " & testcasename() & ": INCONC: Fail to retrive the RCA ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
} else {
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
YannGarcia
committed
// Test Body
if (f_verify_rca_certificate(-, v_root_certificate) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
// Postamble
f_disconnect4SelfOrClientSync();
} // End of testcase TC_SECPKI_CA_CERTGEN_02_BV_01
/**
* @desc Check that the CA, been authorized using explicit certificate, is able to issue an implicit certificate
YannGarcia
committed
* Pics Selection: PICS_IUT_CA_ROLE and PICS_SEC_EXPLICIT_CERTIFICATES and PICS_SEC_IMPLICIT_CERTIFICATES
YannGarcia
committed
* CA is in 'operational' state
* CA is initialized with the explicit certificate (CERT_IUT_A_RCA)
* }
* Expected behaviour:
* ensure that {
* when {
YannGarcia
committed
* the CA is requested to issue the implicit certificate
YannGarcia
committed
* this certificate is of type EtsiTs103097Certificate
YannGarcia
committed
* indicating value 3
* and containing type
* indicating 'implicit'
* and containing toBeSigned
* containing verifyKeyIndicator
* containing reconstructionValue
* and not containing signature
* @see ETSI TS 103 525-2 v2.0.1 SECPKI_CA_CERTGEN_02_BV_02
YannGarcia
committed
* @reference ETSI TS 103 097 [2], clause 6
* IEEE Std 1609.2 [3], clause 6.4.3
YannGarcia
committed
testcase TC_SECPKI_CA_CERTGEN_02_BV_02() runs on ItsPkiHttp system ItsPkiHttpSystem {
YannGarcia
committed
// Local variables
var integer v_result;
var Certificate v_root_certificate;
YannGarcia
committed
// Test control
if ((not PICS_IUT_CA_ROLE) or not(PICS_SEC_EXPLICIT_CERTIFICATES) or not(PICS_SEC_IMPLICIT_CERTIFICATES)) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE and PICS_SEC_EXPLICIT_CERTIFICATES and PICS_SEC_IMPLICIT_CERTIFICATES required for executing the TC ***");
setverdict(inconc);
stop;
}
YannGarcia
committed
// Test component configuration
f_connect4SelfOrClientSync();
// Test adapter configuration
YannGarcia
committed
// Preamble
v_result := f_get_root_ca_certificate(-, -, v_root_certificate);
if (v_result == -1) {
log("*** " & testcasename() & ": INCONC: Fail to retrive the RCA ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
} else {
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
YannGarcia
committed
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
// Test Body
if (f_verify_rca_certificate(-, v_root_certificate, true, true, true) == false) { // implicit, reconstructionKey and no signature
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
// Postamble
f_disconnect4SelfOrClientSync();
} // End of testcase TC_SECPKI_CA_CERTGEN_02_BV_02
/**
* @desc Check that the CA, been authorized using explicit certificate, is able to issue an implicit certificate
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE and PICS_SEC_EXPLICIT_CERTIFICATES and PICS_SEC_IMPLICIT_CERTIFICATES
* Initial conditions:
* with {
* CA is in 'operational' state
* CA is initialized with the explicit certificate (CERT_IUT_I_AA)
* }
* Expected behaviour:
* ensure that {
* when {
* the CA is requested to issue the implicit certificate
* }
* then {
* this certificate is of type EtsiTs103097Certificate
* containing version
* indicating value 3
* and containing type
* indicating 'implicit'
* and containing toBeSigned
* containing verifyKeyIndicator
* containing reconstructionValue
* and not containing signature
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 v2.0.1 SECPKI_CA_CERTGEN_02_BV_03
YannGarcia
committed
* @reference ETSI TS 103 097 [2], clause 6
* IEEE Std 1609.2 [3], clause 6.4.3
*/
testcase TC_SECPKI_CA_CERTGEN_02_BV_03() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variables
var integer v_result;
var Certificate v_root_certificate;
YannGarcia
committed
// Test control
if ((not PICS_IUT_CA_ROLE) or not(PICS_SEC_EXPLICIT_CERTIFICATES) or not(PICS_SEC_IMPLICIT_CERTIFICATES)) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE and PICS_SEC_EXPLICIT_CERTIFICATES and PICS_SEC_IMPLICIT_CERTIFICATES required for executing the TC ***");
setverdict(inconc);
stop;
}
YannGarcia
committed
// Test component configuration
f_connect4SelfOrClientSync();
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
v_result := f_get_root_ca_certificate("CERT_IUT_I_AA", -, v_root_certificate);
if (v_result == -1) {
log("*** " & testcasename() & ": INCONC: Fail to retrive the RCA ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
} else {
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
YannGarcia
committed
// Test Body
if (f_verify_rca_certificate("CERT_IUT_I_AA", v_root_certificate) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
// Postamble
f_disconnect4SelfOrClientSync();
} // End of testcase TC_SECPKI_CA_CERTGEN_02_BV_03
YannGarcia
committed
/**
* @desc Check that the CA, been authorized using implicit certificate, does not issue an explicit certificate
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE and PICS_SEC_EXPLICIT_CERTIFICATES and PICS_SEC_IMPLICIT_CERTIFICATES
* Initial conditions:
* with {
* CA is in 'operational' state
* CA is initialized with the explicit certificate (CERT_IUT_I_AA)
* }
* Expected behaviour:
* ensure that {
* when {
* the CA is requested to issue the explicit certificate
* }
* then {
* the CA doesn’t issue the certificate
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 v2.0.1 SECPKI_CA_CERTGEN_02_BO_01
YannGarcia
committed
* @reference ETSI TS 103 097 [2], clause 6
* IEEE Std 1609.2 [3], clause 6.4.3
*/
testcase TC_SECPKI_CA_CERTGEN_02_BO_01() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variables
var integer v_result;
var Certificate v_root_certificate;
YannGarcia
committed
// Test control
if ((not PICS_IUT_CA_ROLE) or not(PICS_SEC_EXPLICIT_CERTIFICATES) or not(PICS_SEC_IMPLICIT_CERTIFICATES)) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE and PICS_SEC_EXPLICIT_CERTIFICATES and PICS_SEC_IMPLICIT_CERTIFICATES required for executing the TC ***");
setverdict(inconc);
stop;
}
YannGarcia
committed
// Test component configuration
f_connect4SelfOrClientSync();
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
YannGarcia
committed
// Test Body
v_result := f_get_root_ca_certificate("CERT_IUT_I_AA", true, v_root_certificate);
if (v_result == -1) {
log("*** " & testcasename() & ": PASS: No root certificate was generated ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
} else {
log("*** " & testcasename() & ": FAIL: Root certificate shall not be generated ***");
YannGarcia
committed
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
YannGarcia
committed
// Postamble
f_disconnect4SelfOrClientSync();
YannGarcia
committed
} // End of testcase TC_SECPKI_CA_CERTGEN_02_BO_01
YannGarcia
committed
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
/**
* @desc Check that CA issues certificate conformed to ETSI TS 103 097 [1], clause 6
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE
* Initial conditions:
* with {
* CA is in 'operational' state
* CA is initialized with the explicit certificate (CERT_IUT_I_AA)
* }
* Expected behaviour:
* ensure that {
* when {
* the CA is requested to issue the certificate
* }
* then {
* this certificate is of type EtsiTs103097Certificate
* containing toBesigned
* containing id
* indicating 'none' or 'name'
* and containing cracaId
* indicating '000000'H
* and containing crlSeries
* indicating '0'D
* and not containing certRequestPermissions
* and not containing canRequestRollover
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 v2.0.1 SECPKI_CA_CERTGEN_03_BV
YannGarcia
committed
* @reference ETSI TS 103 097 [2], clause 6
*/
testcase TC_SECPKI_CA_CERTGEN_03_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variables
var integer v_result;
var Certificate v_root_certificate;
YannGarcia
committed
// Test control
if (not PICS_IUT_CA_ROLE) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE required for executing the TC ***");
setverdict(inconc);
stop;
}
YannGarcia
committed
// Test component configuration
f_connect4SelfOrClientSync();
YannGarcia
committed
// Test adapter configuration
YannGarcia
committed
// Preamble
v_result := f_get_root_ca_certificate("CERT_IUT_I_AA", -, v_root_certificate);
if (v_result == -1) {
log("*** " & testcasename() & ": INCONC: Fail to retrive the RCA ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
} else {
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
YannGarcia
committed
// Test Body
if (f_verify_rca_certificate("CERT_IUT_I_AA", v_root_certificate) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify RCA message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
log("*** " & testcasename() & ": PASS: ToBeSignedRcaCtl received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
// Postamble
f_disconnect4SelfOrClientSync();
} // End of testcase TC_SECPKI_CA_CERTGEN_03_BV
YannGarcia
committed
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
/**
* @desc Check that the certificate issuer of certificates is referenced using digest
* Check that right digest field is used to reference to the certificate
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE
* Initial conditions:
* with {
* CA is in 'operational' state
* CA is initialized with the explicit certificate (C_ISSUER)
* }
* Expected behaviour:
* ensure that {
* when {
* the CA is requested to issue the explicit certificate
* }
* then {
* this certificate is of type EtsiTs103097Certificate
* containing issuer
* containing self
* or containing X_DIGEST
* indicating last 8 bytes of the hash of the certificate calculated using X_ALGORITHM
* referenced to certificate
* and containing toBeSigned
* containing verifyKeyIndicator
* containing verificationKey
* containing X_KEY
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 v2.0.1 SECPKI_CA_CERTGEN_04_BV
YannGarcia
committed
* @reference ETSI TS 103 097 [2], clause 6
*/
testcase TC_SECPKI_CA_CERTGEN_04_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {
// Local variables
var charstring v_authorized_certificate;
var integer v_result;
var Certificate v_root_certificate;
YannGarcia
committed
// Test control
if (not PICS_IUT_CA_ROLE and not PICS_SEC_SHA256 and not PICS_SEC_BRAINPOOL_P256R1 and not PICS_SEC_BRAINPOOL_P384R1) {
log("*** " & testcasename() & ": PICS_IUT_CA_ROLE and (PICS_SEC_SHA256 or PICS_SEC_BRAINPOOL_P256R1 or PICS_SEC_BRAINPOOL_P384R1 required for executing the TC ***");
setverdict(inconc);
stop;
}
YannGarcia
committed
// Test component configuration
f_connect4SelfOrClientSync();
YannGarcia
committed
// Test adapter configuration