Commit 2a61e6eb authored by Yann Garcia's avatar Yann Garcia
Browse files

Add PKI support to RSU simumlator

parent 49f0336f
......@@ -127,9 +127,6 @@ module ItsRSUsSimulator_Functions {
map(self:acPort, system:acPort);
map(self:cfPort, system:cfPort);
map(self:geoNetworkingPort, system:geoNetworkingPort);
if (vc_pki == true) {
map(self:httpPort, system:httpPort);
}
// Connect
f_connect4SelfOrClientSync();
......@@ -137,7 +134,7 @@ module ItsRSUsSimulator_Functions {
// Initialise secured mode
LibItsGeoNetworking_Functions.f_initialiseSecuredMode();
//Initialze the Config module
//cfPort.send(CfInitialize:{});
......@@ -160,9 +157,6 @@ module ItsRSUsSimulator_Functions {
unmap(self:acPort, system:acPort);
unmap(self:cfPort, system:cfPort);
unmap(self:geoNetworkingPort, system:geoNetworkingPort);
if (vc_pki == true) {
unmap(self:httpPort, system:httpPort);
}
// Disconnect
f_disconnect4SelfOrClientSync();
......@@ -1064,18 +1058,22 @@ module ItsRSUsSimulator_Functions {
cfPort.send(UtDenmResults: { utDenmInitializeResult := true } );
repeat;
}
[vc_denm == true] cfPort.receive(UtDenmInitialize:?) {
cfPort.send(UtDenmResults: { utDenmInitializeResult := true });
repeat;
}
[vc_pki == true] cfPort.receive(UtPkiInitialize:?) -> value v_utPkiInitialize {
log("v_utPkiInitialize = ", v_utPkiInitialize);
cfPort.send(UtPkiResults: { utPkiInitializeResult := true } );
repeat;
}
[vc_pki == true] cfPort.receive(UtPkiTrigger:?) -> value v_utPkiTrigger {
var ItsPkiHttp v_pki;
cfPort.send(UtPkiResults: { utPkiTriggerResult := true } );
f_trigger_enrolment_request_await_response();
v_pki := ItsPkiHttp.create("TriggeredEc") alive;
v_pki.start(f_trigger_enrolment_request_await_response(
vc_reenrolment,
vc_ec_certificates_counter,
vc_ec_certificates
));
//v_pki.done;
repeat;
}
[] cfPort.receive {
......@@ -1085,7 +1083,11 @@ module ItsRSUsSimulator_Functions {
}
} // End of 'altstep' statement
function f_trigger_enrolment_request_await_response() runs on ItsRSUsSimulator {
function f_trigger_enrolment_request_await_response(
inout boolean p_reenrolment,
inout integer p_ec_certificates_counter,
inout SequenceOfCertificate p_ec_certificates
) runs on ItsPkiHttp {
// Local variables
var Oct32 v_private_key;
var Oct32 v_compressed_public_key;
......@@ -1104,6 +1106,8 @@ module ItsRSUsSimulator_Functions {
log(">>> f_trigger_enrolment_request_await_response");
f_cfHttpUp(PICS_TS_EA_CERTIFICATE_ID);
f_http_build_inner_ec_request(v_private_key, v_compressed_public_key, v_compressed_mode, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash);
f_init_default_headers_list(-, "inner_ec_request", v_headers);
httpPort.send(
......@@ -1142,10 +1146,10 @@ module ItsRSUsSimulator_Functions {
if (f_verify_ec_certificate(v_etsi_ts_102941_data.content.enrolmentResponse.certificate, vc_eaCertificate, v_compressed_public_key, v_compressed_mode)) {
log("f_trigger_enrolment_request_await_response: Well-secured EA certificate received ***");
log("p_inner_ec_response= ", v_inner_ec_response);
vc_reenrolment := true;
p_reenrolment := true;
// Store the new certificate
vc_ec_certificates[vc_ec_certificates_counter] := v_inner_ec_response.certificate;
vc_ec_certificates_counter := vc_ec_certificates_counter + 1;
p_ec_certificates[p_ec_certificates_counter] := v_inner_ec_response.certificate;
p_ec_certificates_counter := p_ec_certificates_counter + 1;
} else {
log("f_trigger_enrolment_request_await_response: Cannot verify EC certificate signature ***");
}
......@@ -1154,10 +1158,13 @@ module ItsRSUsSimulator_Functions {
}
}
}
[] tc_ac.timeout {
[] v_t.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
}
} // End of 'alt' statement
f_cfHttpDown();
log("<<< f_trigger_enrolment_request_await_response");
}
} // End of module ItsRSUsSimulator_Functions
......@@ -119,9 +119,9 @@ module ItsRSUsSimulator_TestSystem {
var boolean vc_reenrolment := false;
var integer vc_ec_certificates_counter := 0;
var SequenceOfCertificate vc_ec_certificates;
var SequenceOfCertificate vc_ec_certificates := {};
var integer vc_at_certificates_counter := 0;
var SequenceOfCertificate vc_at_certificates;
var SequenceOfCertificate vc_at_certificates := {};
} // End of component ItsRSUsSimulator
/**
......
Subproject commit 5be823f1a8fdd1ab14ae0c0e75f4c313d73bc0fc
Subproject commit eb78a6e8deb33a581db65cfbf18aa98d2da9b8bc
Supports Markdown
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