Commit 7f5acfea authored by garciay's avatar garciay
Browse files

STF545: Add InnerAcRequest/Response support, UpperTester port for ITS-S

parent f5d1b6b0
......@@ -6,24 +6,24 @@
#ifdef _NO_SOFTLINKS_
/* to be used when built without generating softlinks to the working directory */
//#include "CALM_ports/AdapterControlPort_CALM.partH"
#include "Pki_ports/AdapterControlPort_Pki.partH"
#include "CAM_ports/AdapterControlPort_CAM.partH"
#include "DENM_ports/AdapterControlPort_DENM.partH"
#include "GN_ports/AdapterControlPort_GN.partH"
#include "IVIM_ports/AdapterControlPort_IVIM.partH"
#include "MapemSpatem_ports/AdapterControlPort_MapemSpatem.partH"
#include "SremSsem_ports/AdapterControlPort_SremSsem.partH"
#include "Pki_ports/AdapterControlPort_Pki.partH"
//#include "V2G_ports/AdapterControlPort_V2G.partH"
#else //_NO_SOFTLINKS_
#include "AdapterControlPort_Pki.partH"
#include "AdapterControlPort_CAM.partH"
#include "AdapterControlPort_DENM.partH"
#include "AdapterControlPort_IVIM.partH"
#include "AdapterControlPort_MapemSpatem.partH"
#include "AdapterControlPort_SremSsem.partH"
#include "AdapterControlPort_GN.partH"
#include "AdapterControlPort_Pki.partH"
/*
#include "AdapterControlPort_IVIM.partH"
#include "AdapterControlPort_MapemSpatem.partH"
......
#include <memory>
#include "UpperTesterPort.hh"
#ifdef _NO_SOFTLINKS_
/* to be used when built without generating softlinks to the working directory */
#include "BTP_ports/UpperTesterPort_BTP.partC"
#include "CAM_ports/UpperTesterPort_CAM.partC"
//#include "DCC_ports/UpperTesterPort_DCC.partC"
#include "DENM_ports/UpperTesterPort_DENM.partC"
#include "GN_ports/UpperTesterPort_GN.partC"
#include "IVIM_ports/UpperTesterPort_IVIM.partC"
//#include "MapSpat_ports/UpperTesterPort_MapSpat.partC"
#include "MapemSpatem_ports/UpperTesterPort_MapemSpatem.partC"
#include "SremSsem_ports/UpperTesterPort_SremSsem.partC"
#include "V2G_ports/UpperTesterPort_Pki.partC"
#include "Pki_ports/UpperTesterPort_Pki.partC"
//#include "V2G_ports/UpperTesterPort_V2G.partC"
#else //_NO_SOFTLINKS_
#include "UpperTesterPort_BTP.partC"
#include "UpperTesterPort_CAM.partC"
//#include "UpperTesterPort_DCC.partC"
#include "UpperTesterPort_DENM.partC"
#include "UpperTesterPort_IVIM.partC"
#include "UpperTesterPort_MapemSpatem.partC"
......
......@@ -6,28 +6,26 @@
//#include "TTCN_EncDec.hh"
#ifdef _NO_SOFTLINKS_
/* to be used when built without generating softlinks to the working directory */
#include "Pki_ports/UpperTesterPort_Pki.partH"
#include "BTP_ports/UpperTesterPort_BTP.partH"
#include "CAM_ports/UpperTesterPort_CAM.partH"
//#include "DCC_ports/UpperTesterPort_DCC.partH"
#include "DENM_ports/UpperTesterPort_DENM.partH"
#include "GN_ports/UpperTesterPort_GN.partH"
#include "IVIM_ports/UpperTesterPort_IVIM.partH"
#include "MapemSpatem_ports/UpperTesterPort_MapemSpatem.partH"
#include "SremSsem_ports/UpperTesterPort_SremSsem.partH"
#include "V2G_ports/UpperTesterPort_Pki.partH"
//#include "V2G_ports/UpperTesterPort_V2G.partH"
#else //_NO_SOFTLINKS_
#include "UpperTesterPort_Pki.partH"
#include "UpperTesterPort_BTP.partH"
#include "UpperTesterPort_CAM.partH"
//#include "UpperTesterPort_DCC.partH"
#include "UpperTesterPort_DENM.partH"
#include "UpperTesterPort_IVIM.partH"
#include "UpperTesterPort_MapemSpatem.partH"
#include "UpperTesterPort_SremSsem.partH"
#include "UpperTesterPort_GN.partH"
#include "UpperTesterPort_Pki.partH"
/*
#include "UpperTesterPort_IVIM.partH"
//#include "UpperTesterPort_MapSpat.partH"
......
......@@ -96,11 +96,11 @@ module ItsPki_TestCases {
*/
testcase TC_SEC_PKI_ITSS_ENR_BV_01() runs on ItsMtc /*system ItsPkiItssSystem*/ {
// Local variables
var Oct32 v_private_key;
var Oct32 v_publicKeyX;
var Oct32 v_publicKeyY;
var Oct32 v_publicKeyCompressed;
var integer v_compressedMode;
var Oct32 v_private_key;
var Oct32 v_publicKeyX;
var Oct32 v_publicKeyY;
var Oct32 v_publicKeyCompressed;
var integer v_compressedMode;
var ItsPkiItss v_itss;
var ItsPki v_ea;
......@@ -140,17 +140,16 @@ module ItsPki_TestCases {
) runs on ItsPkiItss /*system ItsPkiItssSystem*/ {
// Local variables
var GeoNetworkingInd v_response;
var GeoNetworkingInd v_geoNwInd;
var EtsiTs103097Certificate v_initial_certificate;
// Test component configuration
f_cfUp_itss();
// Test adapter configuration
// Preamble
// Wait for current certificate
tc_ac.start;
tc_ac.start; // Wait for current certificate
alt {
[] geoNetworkingPort.receive(
mw_geoNwInd(
......@@ -173,12 +172,12 @@ module ItsPki_TestCases {
)
),
mw_geoNwShbPacket
))) -> value v_response {
))) -> value v_geoNwInd {
tc_ac.stop;
log("*** " & testcasename() & ": INFO: Receieve initial certificate");
// Extract the initial certificate
// TODO v_initial_certificate :=
v_initial_certificate := v_geoNwInd.msgIn.gnPacket.securedMsg.content.signedData.signer.certificate[0];
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
[] geoNetworkingPort.receive(
......@@ -192,7 +191,7 @@ module ItsPki_TestCases {
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_timeout);
}
}
} // End of 'alt' statement
// Test Body
......@@ -203,7 +202,7 @@ module ItsPki_TestCases {
mw_geoNwSecPdu(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
-,
mw_toBeSignedData(
mw_signedDataPayload,
mw_headerInfo_cam
......@@ -212,7 +211,7 @@ module ItsPki_TestCases {
v_initial_certificate
)
)
),
),
mw_geoNwShbPacket
))) {
log("*** " & testcasename() & ": INFO: IUT still using initial certificate ***");
......@@ -223,7 +222,7 @@ module ItsPki_TestCases {
mw_geoNwSecPdu(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
-,
mw_toBeSignedData(
mw_signedDataPayload,
mw_headerInfo_gn
......@@ -234,6 +233,7 @@ module ItsPki_TestCases {
))) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: IUT uses new certificate ***");
// TODO Check that is the expected one
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
[] geoNetworkingPort.receive(
......@@ -261,9 +261,14 @@ module ItsPki_TestCases {
in octetstring p_publicKeyY,
in octetstring p_publicKeyCompressed,
in integer p_compressedMode
) runs on ItsPki /*system ItsPkiItssSystem*/ {
) runs on ItsPki /*system ItsPkiSystem*/ {
// Local variables
// Test component configuration
LibItsPki_Functions.f_cfUp();
// Test adapter configuration
// Preamble
tc_ac.start;
alt {
......@@ -328,12 +333,174 @@ module ItsPki_TestCases {
* @reference ETSI TS 102 941, clause 6.1.3
*/
testcase TC_SEC_PKI_ITSS_ENR_BV_02() runs on ItsMtc /*system ItsPkiItssSystem*/ {
// Local variables
var Oct32 v_private_key;
var Oct32 v_publicKeyX;
var Oct32 v_publicKeyY;
var Oct32 v_publicKeyCompressed;
var integer v_compressedMode;
var ItsPkiItss v_itss;
var ItsPkiHttp v_ea;
// Test control
if (not PICS_IUT_ITS_S_ROLE) {
log("*** " & testcasename() & ": PICS_IUT_ITS_S_ROLE required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
if (f_generate_key_pair_nistp256(v_private_key, v_publicKeyX, v_publicKeyY, v_publicKeyCompressed, v_compressedMode) == false) {
log("*** " & testcasename() & ": FAIL: Failed to setup InnerEcRequest message ***")
setverdict(inconc);
stop;
}
v_itss.start(f_TC_SEC_PKI_ITSS_ENR_BV_02_itss(cc_taCert_A, v_private_key, v_publicKeyX, v_publicKeyY, v_publicKeyCompressed, v_compressedMode));
v_ea.start(f_TC_SEC_PKI_ITSS_ENR_BV_02_pki(cc_taCert_A, v_private_key, v_publicKeyX, v_publicKeyY, v_publicKeyCompressed, v_compressedMode));
// Synchronization
f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone});
// Cleanup
} // End of TC_SEC_PKI_ITSS_ENR_BV_02
group f_TC_SEC_PKI_ITSS_ENR_BV_02 {
function f_TC_SEC_PKI_ITSS_ENR_BV_02_itss(
in charstring p_certificate_id,
in octetstring p_private_key,
in octetstring p_publicKeyX,
in octetstring p_publicKeyY,
in octetstring p_publicKeyCompressed,
in integer p_compressedMode
) runs on ItsPkiItss /*system ItsPkiItssSystem*/ {
// Local variables
// Test component configuration
f_cfUp_itss();
// Test adapter configuration
// Preamble
tc_ac.start; // Wait for current certificate
alt {
[] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwSecPdu(
mw_etsiTs103097Data_signed(
mw_signedData(
-,
mw_toBeSignedData(
mw_signedDataPayload,
mw_headerInfo_cam
),
mw_signerIdentifier_certificate(
mw_etsiTs103097Certificate(
-,
mw_toBeSignedCertificate_at(
{ mw_appPermissions(c_its_aid_CAM) }
)
)
)
)
),
mw_geoNwShbPacket
))) {
tc_ac.stop;
log("*** " & testcasename() & ": INFO: Receieve initial certificate");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
[] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwSecPdu(
mw_etsiTs103097Data_signed
))) {
log("*** " & testcasename() & ": DEBUG: Still waiting for certificate");
repeat;
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected CA message not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_timeout);
}
} // End of 'alt' statement
// Test Body
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
// Postamble
f_cfDown_itss();
} // End of testcase f_TC_SEC_PKI_ITSS_ENR_BV_02_itss
function f_TC_SEC_PKI_ITSS_ENR_BV_02_pki(
in charstring p_certificate_id,
in octetstring p_private_key,
in octetstring p_publicKeyX,
in octetstring p_publicKeyY,
in octetstring p_publicKeyCompressed,
in integer p_compressedMode
) runs on ItsPkiHttp /*system ItsPkiHttpSystem*/ {
// Local variable
var HttpMessage v_response;
var EtsiTs102941Data v_etsi_ts_102941_data;
var InnerEcRequest v_inner_ec_request;
// Test component configuration
f_cfHttpUp();
// Test adapter configuration
// Preamble
f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_success);
// Test Body
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_ieee1609dot2_data(
mw_enrolmentRequestMessage(
mw_encryptedData(
-,
mw_SymmetricCiphertext_aes128ccm
))))))) -> value v_response {
tc_ac.stop;
if (f_verify_pki_message(vc_eaPrivateEncKey, int2oct(0, 32), vc_eaCertificate, v_response.response.body.binary_body.ieee1609dot2_data, false, v_etsi_ts_102941_data) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify PKI message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
} else {
log("*** " & testcasename() & ": LOG: Receive ", v_etsi_ts_102941_data, " ***");
log("*** " & testcasename() & ": DEBUG: match ", match(v_etsi_ts_102941_data.content, mw_enrolmentRequest(mw_innerEcRequestSignedForPop(mw_signedData))), " ***"); // TODO In TITAN, this is the oly way to get the unmatching in log
if (match(v_etsi_ts_102941_data.content, mw_enrolmentRequest(mw_innerEcRequestSignedForPop(mw_signedData)))) {
// TODO Verify signature of mw_innerEcRequestSignedForPop
log("*** " & testcasename() & ": PASS: InnerEcRequestSignedForPop received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
log("*** " & testcasename() & ": FAIL: Unexpected message received ***");
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();
} // End of testcase f_TC_SEC_PKI_ITSS_ENR_BV_02_pki
} // End of TC_SEC_PKI_ITSS_ENR_BV_01
} // End of f_TC_SEC_PKI_ITSS_ENR_BV_01
} // End of group itss_manufacturing
} // End of group itss_behavior
group ea_behavior {
......@@ -499,7 +666,7 @@ module ItsPki_TestCases {
mw_SymmetricCiphertext_aes128ccm
))))))) -> value v_response {
tc_ac.stop;
if (f_verify_pki_message(vc_eaPrivateEncKey, vc_eaPeerWholeHash, vc_peerEaCertificate, v_response.response.body.binary_body.ieee1609dot2_data, false, v_etsi_ts_102941_data) == false) {
log("*** " & testcasename() & ": FAIL: Failed to verify PKI message ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
......
Subproject commit 8e744cf391c13c37d39cb7de10b6d265e94d5013
Subproject commit 4f886d5386270e1172f354bebb75c2808a9638ac
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment