diff --git a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc index 1b4fde411ce48f9591e4d7098aea0e5c8b8fc75f..1cd5377480e9bb738b6e625e4d33366408923a51 100644 --- a/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc +++ b/ccsrc/Ports/LibIts_ports/RSUsSimulator_ports/ConfigRsuSimulatorLayer.cc @@ -622,6 +622,14 @@ int ConfigRsuSimulatorLayer::process_ut_pki_trigger(const OCTETSTRING& data, par p.triggerEnrolmentRequest().encAlgorithm() = OCTETSTRING(0, nullptr); // No parameter used p.triggerEnrolmentRequest().privateKey() = OCTETSTRING(0, nullptr); // No parameter used p.triggerEnrolmentRequest().compressedPublickey() = OCTETSTRING(0, nullptr); // No parameter used + } else if (msg_id == 0xbc/*uppertester_pki_codec*/) { + // LibItsPki__TypesAndValues::TriggerAuthorizationRequest e; + // e.decode(*e.get_descriptor(), decoding_buffer, TTCN_EncDec::CT_RAW); + //p.triggerAuthorizationRequest() = e; + p.triggerAuthorizationRequest().cannonicalId() = OCTETSTRING(0, nullptr); // No parameter used + p.triggerAuthorizationRequest().encAlgorithm() = OCTETSTRING(0, nullptr); // No parameter used + p.triggerAuthorizationRequest().privateKey() = OCTETSTRING(0, nullptr); // No parameter used + p.triggerAuthorizationRequest().compressedPublickey() = OCTETSTRING(0, nullptr); // No parameter used } // Pass it to the ports if any diff --git a/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg b/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg index 23a97d8b594663bfd1a8ee00173ecc970d2a00da..96232f7c5a3bdc4d53a64542e765bcd9fe0af473 100644 --- a/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg +++ b/etc/AtsRSUsSimulator/AtsRSUSimulator.cfg @@ -43,7 +43,7 @@ ItsRSUsSimulator_Pics.PICS_GENERATE_MAPEM := false ItsRSUsSimulator_Pics.PICS_GENERATE_SPATEM := false ItsRSUsSimulator_Pics.PICS_GENERATE_SSEM := false -ItsRSUsSimulator_Pics.PICS_ITS_S_ROLE := true; +ItsRSUsSimulator_Pics.PICS_ITS_S_ROLE := false; ItsRSUsSimulator_Pics.PICS_PKI_SUPPORT := true ItsRSUsSimulator_Pics.PICS_BEACON_FREQUENCY := 1.0 @@ -57,12 +57,12 @@ ItsRSUsSimulator_Pics.PICS_SEND_DENM_INDICATION := true # Enable Security support LibItsGeoNetworking_Pics.PICS_GN_SECURITY := true # Root path to access certificate stored in files, identified by certficate ID -LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home/vagrant/tmp" +LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home/yann/tmp" # Configuration sub-directory to access certificate stored in files LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "asn1c_cert" LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request" -LibItsHttp_Pics.PICS_HEADER_HOST := "192.168.42.252" +LibItsHttp_Pics.PICS_HEADER_HOST := "192.168.42.25" LibItsPki_Pics.PICS_HTTP_POST_URI := "/ea/enrolment" LibItsPki_Pics.PICS_MULTIPLE_END_POINT := false @@ -75,6 +75,9 @@ LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D4954532D30303 LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "CERT_TS_A_EA" LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA" +LibItsPki_Pics.PICS_IUT_EA_CERTIFICATE_ID := "CERT_TS_A_EA" +LibItsPki_Pics.PICS_IUT_AA_CERTIFICATE_ID := "CERT_TS_A_AA" + [LOGGING] # In this section you can specify the name of the log file and the classes of events # you want to log into the file or display on console (standard error). @@ -160,23 +163,23 @@ LogEventTypes:= Yes # its_aid=36: CAM # its_aid=37: DENM # its_aid=141: GeoMet -system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=37,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=/home/vagrant/tmp/asn1c_cert)/ETH(mac_src=080027128a53)/PCAP(mac_src=080027128a53,nic=eth1,filter=and ether proto 0x8947)" +system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=36,secured_mode=1,certificate=CERT_IUT_A_AT,sec_db_path=/home/yann/tmp/asn1c_cert)/ETH(mac_src=080027128a53)/PCAP(mac_src=080027128a53,nic=wlan0,filter=and ether proto 0x8947)" # Commsignia -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=37,secured_mode=0,encrypted_mode=0,certificate=CERT_IUT_A_AT,peer_certificate=CERT_TS_A_AT,sec_db_path=/home/vagrant/tmp/asn1c_cert)/COMMSIGNIA(xport_mode=LTE-V2X,mac_src=080027F44E7D,interface_id=2,target_host=192.168.0.54)/UDP(dst_ip=192.168.0.54,src_port=9091,dst_port=7946)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,its_aid=37,secured_mode=0,encrypted_mode=0,certificate=CERT_IUT_A_AT,peer_certificate=CERT_TS_A_AT,sec_db_path=/home/yann/tmp/asn1c_cert)/COMMSIGNIA(xport_mode=LTE-V2X,mac_src=080027F44E7D,interface_id=2,target_host=192.168.0.54)/UDP(dst_ip=192.168.0.54,src_port=9091,dst_port=7946)" # Qualcom -#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=36747486,longitude=-4556772,distanceA=25,distanceB=25,its_aid=37,secured_mode=1,encrypted_mode=0,certificate=CERT_MICROSEC_AT_01,peer_certificate=CERT_TS_A_AT,sec_db_path=/home/vagrant/tmp/asn1c_cert)/QUALCOMM/UDP(dst_ip=10.200.1.113,src_port=9091,dst_port=4041)" +#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=36747486,longitude=-4556772,distanceA=25,distanceB=25,its_aid=37,secured_mode=1,encrypted_mode=0,certificate=CERT_MICROSEC_AT_01,peer_certificate=CERT_TS_A_AT,sec_db_path=/home/yann/tmp/asn1c_cert)/QUALCOMM/UDP(dst_ip=10.200.1.113,src_port=9091,dst_port=4041)" -#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.42.252,port=80)" -#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.1.252,port=80)" +#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.42.25,port=80)" +#system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.1.25,port=80)" system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=192.168.1.39,port=8080)" # Config port based on UDP -#system.cfPort.params := "CF(ut=pki)/UDP(dst_ip=192.168.42.252,src_port=12345)" +#system.cfPort.params := "CF(ut=pki)/UDP(dst_ip=192.168.42.25,src_port=12345)" #system.cfPort.params := "CF(ut=cam)/UDP(dst_ip=192.168.1.39,src_port=12345)" #system.cfPort.params := "CF(ut=cam)/UDP(dst_ip=172.28.4.87,src_port=12345,reuse_incoming_source_adddress=1)" #system.cfPort.params := "CF(ut=denm)/UDP(dst_ip=172.28.4.87,src_port=12345,reuse_incoming_source_adddress=1)" -#system.cfPort.params := "CF(ut=gn)/UDP(dst_ip=172.28.4.87,src_port=12345,reuse_incoming_source_adddress=1)" -system.cfPort.params := "CF(ut=pki)/UDP(dst_ip=172.28.4.87,src_port=12345,reuse_incoming_source_adddress=1)" +#system.cfPort.params := "CF(ut=gn)/UDP(dst_ip=192.168.1.39,src_port=12345,reuse_incoming_source_adddress=1)" +system.cfPort.params := "CF(ut=pki)/UDP(src_port=12345,reuse_incoming_source_adddress=1)" [EXECUTE] ItsRSUsSimulator_TestCases.TC_RSUSIMU_BV_01 diff --git a/ttcn/AtsPki/ItsPki_TestCases.ttcn b/ttcn/AtsPki/ItsPki_TestCases.ttcn index f839f108970212898e179da5566d46b4a8a0b932..5828bfcf6968c86ab9b46660bbc7325886c85e7f 100644 --- a/ttcn/AtsPki/ItsPki_TestCases.ttcn +++ b/ttcn/AtsPki/ItsPki_TestCases.ttcn @@ -2375,7 +2375,7 @@ module ItsPki_TestCases { // Preamble f_http_build_inner_ec_request(v_private_key, v_public_compressed_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); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_ec_request", v_headers); f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); @@ -5123,7 +5123,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_validation_request(v_inner_at_request, v_public_compressed_key_at, v_compressed_key_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_atv_request", v_headers); f_http_send( v_headers, @@ -5260,7 +5260,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_validation_request(v_inner_at_request, v_public_compressed_key_at, v_compressed_key_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_atv_request", v_headers); f_http_send( v_headers, @@ -5410,7 +5410,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_validation_request(v_inner_at_request, v_public_compressed_key_at, v_compressed_key_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_atv_request", v_headers); f_http_send( v_headers, @@ -5544,7 +5544,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_validation_request(v_inner_at_request, v_public_compressed_key_at, v_compressed_key_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_atv_request", v_headers); f_http_send( v_headers, @@ -5683,7 +5683,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_validation_request(v_inner_at_request, v_public_compressed_key_at, v_compressed_key_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_atv_request", v_headers); f_http_send( v_headers, @@ -5822,7 +5822,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_validation_request(v_inner_at_request, v_public_compressed_key_at, v_compressed_key_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_atv_request", v_headers); f_http_send( v_headers, @@ -5959,7 +5959,7 @@ module ItsPki_TestCases { // Test Body f_http_build_invalid_authorization_validation_request(v_inner_at_request, v_public_compressed_key_at, v_compressed_key_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_atv_request", v_headers); f_http_send( v_headers, @@ -6093,7 +6093,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_validation_request(v_inner_at_request, v_public_compressed_key_at, v_compressed_key_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_atv_request", v_headers); f_http_send( v_headers, @@ -6341,7 +6341,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request(v_ec_certificate, v_private_key_ec, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -6503,7 +6503,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request(v_inner_ec_response.certificate, v_private_key_ec, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -6647,7 +6647,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, true, -, -, -, -, -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -6787,7 +6787,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_private_key(v_inner_ec_response.certificate, v_private_key_ec, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -6922,7 +6922,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, -, true, -, -, -, -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -7070,7 +7070,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, true, -, -, -, -, -, -, -, -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -7225,7 +7225,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, true, -, -, -, -, -, -, -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -7345,7 +7345,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, true, -, -, -, -, -, -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -7471,7 +7471,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, -, -, true, -, -, -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -7597,7 +7597,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, -, -, -, -, -, f_getCurrentTime() / 2, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -7723,7 +7723,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, -, -, -, -, -, f_getCurrentTime() * 2, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -7849,7 +7849,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, -, -, -, vc_eaCertificate.toBeSigned.validityPeriod.start_ / 2, m_duration_in_hours(PX_GENERATED_CERTIFICATE_DURATION), -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -7975,7 +7975,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, -, -, -, vc_eaCertificate.toBeSigned.validityPeriod.start_ / 2, m_duration_years(50), -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -8101,7 +8101,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, -, -, -, f_getCurrentTime() / 1000, m_duration_years(100), -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -8227,7 +8227,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, -, -, -, 2 * f_getCurrentTime() / 1000, m_duration_years(1), -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -8353,7 +8353,7 @@ module ItsPki_TestCases { // Test Body f_http_build_authorization_request_with_wrong_parameters(v_inner_ec_response.certificate, v_private_key_ec, -, -, -, -, -, -, f_getCurrentTime() / 1000, m_duration_in_hours(15*24/* ts_102941v010301 Clause7.2.1*/), -, v_private_key_at, v_public_compressed_key_at, p_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -8512,7 +8512,7 @@ module ItsPki_TestCases { f_generate_ec_certificate_for_inner_ec_response(v_inner_ec_request, v_private_key_ec, vc_eaWholeHash, v_ec_certificate); // Send AuthorizationRequest f_http_build_authorization_request(v_ec_certificate, v_private_key_ec, v_private_key_at, v_public_compressed_key_at, v_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, @@ -8749,7 +8749,7 @@ module ItsPki_TestCases { f_generate_ec_certificate_for_inner_ec_response(v_inner_ec_request, v_private_key_ec, vc_eaWholeHash, v_ec_certificate) // Send AuthorizationRequest f_http_build_authorization_request(v_ec_certificate, v_private_key_ec, v_private_key_at, v_public_compressed_key_at, v_compressed_mode_at, v_private_enc_key_at, v_public_compressed_enc_key_at, v_compressed_enc_mode_at, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - v_aes_sym_key_hashed_id8 := f_HashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to macth the response f_init_default_headers_list(-, "inner_at_request", v_headers); f_http_send( v_headers, diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn index 7f13b3aa05aed765d9b9f030725d1bdb986df583..64e6bfceab6b338362d0faa43a32798d08783b48 100644 --- a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn @@ -1357,38 +1357,88 @@ module ItsRSUsSimulator_Functions { if (oct2int(v_utPkiInitialize.hashedId8) != 0) { var charstring v_certificate_id; var EtsiTs103097Certificate v_certificate; + log("a_process_cf_ut_command: Looking for certificate ", v_utPkiInitialize.hashedId8); f_getCertificateFromDigest(v_utPkiInitialize.hashedId8, v_certificate, v_certificate_id); log("a_process_cf_ut_command (pki): Change certificate to ", v_certificate_id); f_acTriggerSecEvent(m_acEnableSecurity(v_certificate_id)); + vc_security_state := 0; // 0: initial + vc_reenrolment := false; + vc_ec_counter := 0; + vc_ec_certificates := {}; + vc_at_counter := 0; + vc_at_certificates := {}; + tc_cam.stop; } cfPort.send(UtPkiResults: { utPkiInitializeResult := true } ); repeat; } [vc_pki == true] cfPort.receive(UtPkiTrigger: { triggerEnrolmentRequest := ? }) -> value v_utPkiTrigger { - var ItsPkiHttp v_pki; + var ItsPkiHttpRsuSimulator v_pki; + var EcData v_ec_data; log("a_process_cf_ut_command: v_utPkiTrigger=", v_utPkiTrigger); cfPort.send(UtPkiResults: { utPkiTriggerResult := true } ); - v_pki := ItsPkiHttp.create("TriggeredEc") alive; - v_pki.start(f_trigger_enrolment_request_await_response( - vc_reenrolment, - vc_ec_counter, - vc_ec_certificates - )); + v_pki := ItsPkiHttpRsuSimulator.create("TriggeredEc") alive; + connect(v_pki:resultPort, self:resultPort); + v_pki.start(f_trigger_enrolment_request_await_response()); + tc_wait.start; + alt { + [] resultPort.receive(EcData:?) -> value v_ec_data { + tc_wait.stop; + vc_ec_certificates[vc_ec_counter] := v_ec_data; + vc_ec_counter := vc_ec_counter + 1; + vc_reenrolment := true; + vc_security_state := 1; // 1:enrolled + } + [] tc_wait.timeout { + log("a_process_cf_ut_command: Failed to retrieve EcData"); + vc_reenrolment := false; + vc_security_state := 0; // 0: initial + } + } // End of 'alt' statement + disconnect(v_pki:resultPort, self:resultPort); + v_pki.done; + v_pki.kill; repeat; } [vc_pki == true] cfPort.receive(UtPkiTrigger: { triggerAuthorizationRequest := ? }) -> value v_utPkiTrigger { - var ItsPkiHttp v_pki; + var ItsPkiHttpRsuSimulator v_pki; + var AtData v_at_data; cfPort.send(UtPkiResults: { utPkiTriggerResult := true } ); - v_pki := ItsPkiHttp.create("TriggeredAt") alive; + v_pki := ItsPkiHttpRsuSimulator.create("TriggeredAt") alive; + connect(v_pki:resultPort, self:resultPort); v_pki.start(f_trigger_authorization_request_await_response( vc_ec_counter, - vc_ec_certificates, - vc_at_counter, - vc_at_certificates + vc_ec_certificates )); + tc_wait.start; + alt { + [] resultPort.receive(AtData:?) -> value v_at_data { + tc_wait.stop; + vc_at_certificates[vc_at_counter] := v_at_data; + vc_at_counter := vc_at_counter + 1; + vc_security_state := 2; // 2: authorization + } + [] tc_wait.timeout { + log("a_process_cf_ut_command: Failed to retrieve AtData"); + vc_security_state := 1; // 1: enrolled + } + } // End of 'alt' statement + disconnect(v_pki:resultPort, self:resultPort); + v_pki.done; + v_pki.kill; + if (vc_security_state == 2) { + log("a_process_cf_ut_command: triggerAuthorizationRequest: vc_at_counter=", vc_at_counter); + log("a_process_cf_ut_command: triggerAuthorizationRequest: vc_at_certificates=", vc_at_certificates); + // TODO Store the new certificate + + // TODO Update the Test System + + // Enrolled & Authorize, start CAM emission + tc_cam.start(vc_cam_timer_value); + } repeat; } [] cfPort.receive { @@ -1398,11 +1448,7 @@ module ItsRSUsSimulator_Functions { } } // End of 'altstep' statement - function f_trigger_enrolment_request_await_response( - inout boolean p_reenrolment, - inout integer p_ec_counter, - inout SequenceOfEcData p_ec_certificates - ) runs on ItsPkiHttp { + function f_trigger_enrolment_request_await_response() runs on ItsPkiHttpRsuSimulator { // Local variables var Oct32 v_private_key; var Oct32 v_compressed_public_key; @@ -1421,7 +1467,7 @@ module ItsRSUsSimulator_Functions { log(">>> f_trigger_enrolment_request_await_response"); - f_cfHttpUp(PICS_TS_EA_CERTIFICATE_ID); + f_cfHttpUp(PICS_IUT_EA_CERTIFICATE_ID, PICS_IUT_AA_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); @@ -1449,23 +1495,25 @@ module ItsRSUsSimulator_Functions { ))))))) -> value v_response { v_t.stop; - log("f_trigger_enrolment_request_await_response: receive ", v_response); + log("f_trigger_enrolment_request_await_response: v_response=", v_response); if (f_verify_pki_response_message(v_private_key, v_aes_sym_key, v_authentication_vector, vc_eaWholeHash, v_response.response.body.binary_body.ieee1609dot2_data, false, -, v_etsi_ts_102941_data) == false) { log("f_trigger_enrolment_request_await_response: Failed to verify PKI message ***"); } else { - log("f_trigger_enrolment_request_await_response: Receive ", v_etsi_ts_102941_data, " ***"); + log("f_trigger_enrolment_request_await_response: v_etsi_ts_102941_data=", v_etsi_ts_102941_data); // Verify the received EC certificate log("f_trigger_enrolment_request_await_response: match ", match(v_etsi_ts_102941_data.content, mw_enrolmentResponse(mw_innerEcResponse_ok(substr(v_request_hash, 0, 16), mw_etsiTs103097Certificate(-, mw_toBeSignedCertificate_ec, -)))), " ***"); // TODO In TITAN, this is the only way to get the unmatching in log if (match(v_etsi_ts_102941_data.content, mw_enrolmentResponse(mw_innerEcResponse_ok(substr(v_request_hash, 0, 16), mw_etsiTs103097Certificate(-, mw_toBeSignedCertificate_ec, -))))) { var InnerEcResponse v_inner_ec_response := v_etsi_ts_102941_data.content.enrolmentResponse; 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); - // Store the new certificate - p_ec_certificates[p_ec_counter].private_key := v_private_key; - p_ec_certificates[p_ec_counter].aes_sym_key := v_aes_sym_key; - p_ec_certificates[p_ec_counter].certificate := v_inner_ec_response.certificate; - p_ec_counter := p_ec_counter + 1; + var EcData v_ec_data; + + log("f_trigger_enrolment_request_await_response: p_inner_ec_response= ", v_inner_ec_response); + // Send the new certificate for storing + v_ec_data.private_key := v_private_key; + v_ec_data.aes_sym_key := v_aes_sym_key; + v_ec_data.certificate := v_inner_ec_response.certificate; + log("f_trigger_enrolment_request_await_response: send v_ec_data=", v_ec_data); + resultPort.send(v_ec_data); } else { log("f_trigger_enrolment_request_await_response: Cannot verify EC certificate signature ***"); } @@ -1484,37 +1532,57 @@ module ItsRSUsSimulator_Functions { } function f_trigger_authorization_request_await_response( - inout integer p_ec_counter, - inout SequenceOfEcData p_ec_certificates, - inout integer p_at_counter, - inout SequenceOfAtData p_at_certificates - ) runs on ItsPkiHttp { + in integer p_ec_counter, + in SequenceOfEcData p_ec_certificates + ) runs on ItsPkiHttpRsuSimulator { // Local variables - var Oct32 v_private_key; - var Oct32 v_compressed_public_key; - var integer v_compressed_mode; - var Oct32 v_request_hash; + var Oct32 v_private_key_at; + var Oct32 v_public_compressed_key_at; + var integer p_compressed_mode_at; + var Oct32 v_private_enc_key_at; + var Oct32 v_public_compressed_enc_key_at; + var integer v_compressed_enc_mode_at; var Oct16 v_encrypted_sym_key; var Oct16 v_aes_sym_key; + var HashedId8 v_aes_sym_key_hashed_id8; var Oct16 v_authentication_vector; var Oct12 v_nonce; var octetstring v_salt; var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data; + var Oct32 v_request_hash; + var bitstring v_encoded_value; + var Ieee1609Dot2Data v_authorization_response; var HeaderLines v_headers; var HttpMessage v_response; var EtsiTs102941Data v_etsi_ts_102941_data; + var FncRetCode v_result; timer v_t := 5.0; - log(">>> f_trigger_authorization_request_await_response"); + f_cfHttpUp(PICS_IUT_EA_CERTIFICATE_ID, PICS_IUT_AA_CERTIFICATE_ID); - f_cfHttpUp(PICS_TS_EA_CERTIFICATE_ID, PICS_TS_AA_CERTIFICATE_ID); - - /*f_http_build_authorization_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_http_build_authorization_request( + p_ec_certificates[p_ec_counter - 1].certificate, + p_ec_certificates[p_ec_counter - 1].private_key, + v_private_key_at, + v_public_compressed_key_at, + p_compressed_mode_at, + v_private_enc_key_at, + v_public_compressed_enc_key_at, + v_compressed_enc_mode_at, + v_aes_sym_key, + v_encrypted_sym_key, + v_authentication_vector, + v_nonce, + v_salt, + v_ieee1609dot2_signed_and_encrypted_data, + v_request_hash); + log("f_trigger_authorization_request_await_response: v_ieee1609dot2_signed_and_encrypted_data=", v_ieee1609dot2_signed_and_encrypted_data); + v_aes_sym_key_hashed_id8 := f_hashedId8FromSha256(f_hashWithSha256('80'O & v_aes_sym_key)); // Used to match the response f_init_default_headers_list(-, "inner_at_request", v_headers); httpPort.send( m_http_request( m_http_request_post( - PICS_HTTP_POST_URI, + PICS_HTTP_POST_URI_AT, v_headers, m_http_message_body_binary( m_binary_body_ieee1609dot2_data( @@ -1535,27 +1603,28 @@ module ItsRSUsSimulator_Functions { ))))))) -> value v_response { v_t.stop; - log("f_trigger_enrolment_request_await_response: receive ", v_response); - if (f_verify_pki_response_message(v_private_key, v_aes_sym_key, v_authentication_vector, vc_eaWholeHash, v_response.response.body.binary_body.ieee1609dot2_data, false, v_etsi_ts_102941_data) == false) { - log("f_trigger_enrolment_request_await_response: Failed to verify PKI message ***"); + log("f_trigger_authorization_request_await_response: v_response=", v_response); + if (f_verify_pki_response_message(v_private_key_at, v_aes_sym_key, v_authentication_vector, v_request_hash, v_response.response.body.binary_body.ieee1609dot2_data, false, -, v_etsi_ts_102941_data) == false) { + log("f_trigger_authorization_request_await_response: Failed to verify PKI message"); } else { - log("f_trigger_enrolment_request_await_response: Receive ", v_etsi_ts_102941_data, " ***"); - // Verify the received EC certificate - log("f_trigger_enrolment_request_await_response: match ", match(v_etsi_ts_102941_data.content, mw_enrolmentResponse(mw_innerEcResponse_ok(substr(v_request_hash, 0, 16), mw_etsiTs103097Certificate(-, mw_toBeSignedCertificate_ec, -)))), " ***"); // TODO In TITAN, this is the only way to get the unmatching in log - if (match(v_etsi_ts_102941_data.content, mw_enrolmentResponse(mw_innerEcResponse_ok(substr(v_request_hash, 0, 16), mw_etsiTs103097Certificate(-, mw_toBeSignedCertificate_ec, -))))) { - var InnerEcResponse v_inner_at_response := v_etsi_ts_102941_data.content.enrolmentResponse; - if (f_verify_at_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_at_response= ", v_inner_at_response); - p_reenrolment := true; - // Store the new certificate - p_at_certificates[p_at_certificates_counter] := v_inner_at_response.certificate; - p_at_certificates_counter := p_at_xscertificates_counter + 1; - } else { - log("f_trigger_enrolment_request_await_response: Cannot verify EC certificate signature ***"); - } + log("f_trigger_authorization_request_await_response: v_etsi_ts_102941_data=", v_etsi_ts_102941_data); + // Verify the received AT certificate + log(match(v_etsi_ts_102941_data.content, mw_authorizationResponse(mw_innerAtResponse_ok(substr(v_request_hash, 0, 16), mw_etsiTs103097Certificate(-, mw_toBeSignedCertificate_at, -))))); // TODO In TITAN, this is the only way to get the unmatching in log + if (match(v_etsi_ts_102941_data.content, mw_authorizationResponse(mw_innerAtResponse_ok(substr(v_request_hash, 0, 16), mw_etsiTs103097Certificate(-, mw_toBeSignedCertificate_at, -)))) == true) { + var InnerAtResponse v_inner_at_response := v_etsi_ts_102941_data.content.authorizationResponse; + var AtData v_at_data; + + log("f_trigger_enrolment_request_await_response: p_inner_at_response= ", v_inner_at_response); + // Send the new certificate for storing + v_at_data.private_key := v_private_key_at; + v_at_data.aes_sym_key := v_aes_sym_key; + v_at_data.certificate := v_inner_at_response.certificate; + log("f_trigger_enrolment_request_await_response: send v_at_data=", v_at_data); + resultPort.send(v_at_data); + // TODO Provide the new certificate to the Test System + // TODO Start CAM emission } else { - log("f_trigger_enrolment_request_await_response: Unexpected message received ***"); + log("f_trigger_authorization_request_await_response: Cannot verify AT certificate signature ***"); } } } @@ -1565,7 +1634,7 @@ module ItsRSUsSimulator_Functions { } // End of 'alt' statement f_cfHttpDown(); - log("<<< f_trigger_authorization_request_await_response");*/ + log("<<< f_trigger_authorization_request_await_response"); } } // End of module ItsRSUsSimulator_Functions diff --git a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestSystem.ttcn b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestSystem.ttcn index e7687d63c075b482783576b4fc174de8ceef5467..4f4e485ad6bb19f9e5360ad6a5219ca7099b4b82 100644 --- a/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestSystem.ttcn +++ b/ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestSystem.ttcn @@ -30,7 +30,17 @@ module ItsRSUsSimulator_TestSystem { import from ItsRSUsSimulator_TypesAndValues all; import from ItsRSUsSimulator_Pics all; import from ItsRSUsSimulator_Pixits all; - + + type component ItsPkiHttpRsuSimulator extends ItsPkiHttp { + port ResultPort resultPort + } + + type port ResultPort message { + inout EcData, AtData + } with { + extension "internal" + } + /** * @desc Test component for ITS Network and Transport layer */ @@ -38,7 +48,11 @@ module ItsRSUsSimulator_TestSystem { /** * @desc RSUsimulator configuration port */ - port ConfigRsuSimulatorPort cfPort; + port ConfigRsuSimulatorPort cfPort; + /** + * @desc Internal communication port + */ + port ResultPort resultPort; /** Use httPort when EC and AT are served by the same end point */ port HttpPort httpEcPort; /** Enrolment end point */ port HttpPort httpAtVPort; /** Authorization Validation end point */ @@ -132,6 +146,7 @@ module ItsRSUsSimulator_TestSystem { timer tc_ivim := PICS_IVIM_FREQUENCY; //timer tc_evcsn := PICS_EVCSN_FREQUENCY; + var integer vc_security_state := 0; // 0: initial, 1: enrolled, 2:authorization var boolean vc_reenrolment := false; var integer vc_ec_counter := 0; var SequenceOfEcData vc_ec_certificates := {}; diff --git a/ttcn/LibIts b/ttcn/LibIts index 63ccaf6630a5e2f37f949f23cdeee2cfdbbe0f48..9c7f6e8cc5a2c56359f7732412d9c0c4977d93fa 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit 63ccaf6630a5e2f37f949f23cdeee2cfdbbe0f48 +Subproject commit 9c7f6e8cc5a2c56359f7732412d9c0c4977d93fa