Loading lib_system/LibItsPki_Functions.ttcn +100 −38 Original line number Diff line number Diff line Loading @@ -87,6 +87,8 @@ module LibItsPki_Functions { connect(p_pki:syncPort, self:syncPort); connect(p_pki:infoPort, p_itss:infoPort); activate(a_default_mtc()); } // End of function f_cfMtcUp01 function f_cfMtcUp02( Loading @@ -99,6 +101,7 @@ module LibItsPki_Functions { connect(self:syncPort, mtc:syncPort); connect(p_itss:syncPort, self:syncPort); connect(p_ea:syncPort, self:syncPort); activate(a_default_mtc()); } // End of function f_cfMtcUp02 function f_cfMtcUp03( Loading @@ -111,6 +114,7 @@ module LibItsPki_Functions { connect(self:syncPort, mtc:syncPort); connect(p_itss:syncPort, self:syncPort); connect(p_tlm:syncPort, self:syncPort); activate(a_default_mtc()); } // End of function f_cfMtcUp03 function f_cfMtcUp04( Loading @@ -123,6 +127,7 @@ module LibItsPki_Functions { connect(self:syncPort, mtc:syncPort); connect(p_itss:syncPort, self:syncPort); connect(p_dc:syncPort, self:syncPort); activate(a_default_mtc()); } // End of function f_cfMtcUp04 /** Loading Loading @@ -357,12 +362,16 @@ module LibItsPki_Functions { } } // End of function f_cfHttpUp_ea function f_cfUp_itss() runs on ItsPkiItss system ItsPkiItssSystem { function f_cfUp_itss( in charstring p_cert_id := "" ) runs on ItsPkiItss system ItsPkiItssSystem { map(self:geoNetworkingPort, system:geoNetworkingPort); map(self:utPort, system:utPort); //map(self:acPort, system:acPort); activate(a_default_itss()); //map(self:acPort, system:acPort); vc_hashedId8ToBeUsed := p_cert_id; f_initializeState(); // activate(a_default_pki()); TOTO Defualt from geoNet Loading Loading @@ -1623,6 +1632,66 @@ module LibItsPki_Functions { return true; } // End of function f_http_build_authorization_request_with_wrong_parameters function f_http_build_common_authorization_response( inout InnerAtResponse p_inner_at_response, in Oct16 p_request_hash, in octetstring p_private_key := ''O, in octetstring p_digest := ''O, in Oct16 p_aes_sym_key, out Ieee1609Dot2Data p_ieee1609dot2_signed_and_encrypted_data ) return boolean { var octetstring v_msg; var Oct12 v_nonce; var boolean v_result := false; // Secure the response log("f_http_build_common_authorization_response: p_inner_at_response= ", p_inner_at_response); v_msg := bit2oct(encvalue(m_etsiTs102941Data_inner_at_response(p_inner_at_response))); v_nonce := substr(f_hashWithSha256(int2oct((f_getCurrentTimeUtc() * 1000), 16)), 0, 12); // Random value // TODO Consider Sha384: m_signerIdentifier_digest(f_hashedId8FromSha384(p_digest)) if (f_build_pki_secured_response_message(p_private_key, valueof(m_signerIdentifier_digest(f_hashedId8FromSha256(p_digest))),// in SignerIdentifier p_signer_identifier, v_msg, p_aes_sym_key, v_nonce, p_ieee1609dot2_signed_and_encrypted_data ) == false) { log("f_http_build_common_authorization_response: Failed to generate the certificate"); p_inner_at_response := valueof( m_innerAtResponse_ko( p_request_hash, its_aa_deniedpermissions ) ); } else { v_result := true; } log("<<< f_http_build_common_authorization_response: v_result= ", v_result); log("<<< f_http_build_common_authorization_response: p_inner_at_response= ", p_inner_at_response); return v_result; } function f_http_build_error_authorization_response( in AuthorizationResponseCode p_responseCode := unknownits, in Oct16 p_request_hash, in octetstring p_private_key := ''O, in octetstring p_digest := ''O, in Oct16 p_aes_sym_key, out Ieee1609Dot2Data p_ieee1609dot2_signed_and_encrypted_data ) return boolean { var InnerAtResponse v_inner_at_response; v_inner_at_response := valueof( m_innerAtResponse_ko( p_request_hash, p_responseCode ) ); return f_http_build_common_authorization_response ( v_inner_at_response, p_request_hash, p_private_key, p_digest, p_aes_sym_key, p_ieee1609dot2_signed_and_encrypted_data ); } function f_http_build_authorization_response( in template (omit) InnerAtRequest p_inner_at_request := omit, in AuthorizationResponseCode p_responseCode := ok, Loading @@ -1634,10 +1703,6 @@ module LibItsPki_Functions { out Ieee1609Dot2Data p_ieee1609dot2_signed_and_encrypted_data ) return boolean { // Local variables var bitstring v_msg_bit; var octetstring v_msg; var Oct12 v_nonce; var Ieee1609Dot2Data v_ieee1609dot2_signed_data; var EtsiTs103097Certificate v_at_certificate; var boolean v_result := false; Loading Loading @@ -1677,32 +1742,9 @@ module LibItsPki_Functions { } } // Secure the response log("f_http_build_authorization_response: p_inner_at_response= ", p_inner_at_response); v_msg := bit2oct(encvalue(m_etsiTs102941Data_inner_at_response(p_inner_at_response))); v_nonce := substr(f_hashWithSha256(int2oct((f_getCurrentTimeUtc() * 1000), 16)), 0, 12); // Random value // TODO Consider Sha384: m_signerIdentifier_digest(f_hashedId8FromSha384(p_digest)) if (f_build_pki_secured_response_message(p_private_key, valueof(m_signerIdentifier_digest(f_hashedId8FromSha256(p_digest))),// in SignerIdentifier p_signer_identifier, v_msg, p_aes_sym_key, v_nonce, p_ieee1609dot2_signed_and_encrypted_data ) == false) { log("f_http_build_authorization_response: Failed to generate the certificate"); p_inner_at_response := valueof( m_innerAtResponse_ko( p_request_hash, its_aa_deniedpermissions ) ); } else { v_result := true; } log("<<< f_http_build_authorization_response: v_result= ", v_result); log("<<< f_http_build_authorization_response: p_inner_at_response= ", p_inner_at_response); return v_result; return f_http_build_common_authorization_response ( p_inner_at_response, p_request_hash, p_private_key, p_digest, p_aes_sym_key, p_ieee1609dot2_signed_and_encrypted_data ); } // End of function f_http_build_authorization_response function f_http_build_authorization_validation_request( Loading Loading @@ -5444,12 +5486,16 @@ module LibItsPki_Functions { f_http_build_inner_ec_response(p_inner_ec_request, p_response_code, v_request_hash, vc_eaPrivateKey, vc_eaWholeHash, v_aes_enc_key, v_ec_certificate, v_ec_certificate_hashed_id8, p_inner_ec_response, v_response_message); vc_ec_hashed_id8[vc_ec_counter] := v_ec_certificate_hashed_id8; vc_ec_certificates[vc_ec_counter] := v_ec_certificate; vc_ec_counter := vc_ec_counter + 1; v_response := m_http_response( m_http_response_ok( m_http_message_body_binary( m_binary_body_ieee1609dot2_data(v_response_message) ), v_headers)); } else { v_response := m_http_response(m_http_response_500_internal_error(v_headers)); } Loading Loading @@ -6605,6 +6651,22 @@ module LibItsPki_Functions { group altsteps { altstep a_default_mtc() runs on ServerSyncComp { [] a_shutdown() { log("*** a_default_mtc: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***"); all component . done; stop; } } altstep a_default_itss() runs on ItsPkiItss { [] a_shutdown() { log("*** a_default_itss: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***"); f_cfDown_itss(); stop; } } altstep a_default_pki_http() runs on ItsPkiHttp { [not(PICS_MULTIPLE_END_POINT)] httpPort.receive( mw_http_response( Loading Loading
lib_system/LibItsPki_Functions.ttcn +100 −38 Original line number Diff line number Diff line Loading @@ -87,6 +87,8 @@ module LibItsPki_Functions { connect(p_pki:syncPort, self:syncPort); connect(p_pki:infoPort, p_itss:infoPort); activate(a_default_mtc()); } // End of function f_cfMtcUp01 function f_cfMtcUp02( Loading @@ -99,6 +101,7 @@ module LibItsPki_Functions { connect(self:syncPort, mtc:syncPort); connect(p_itss:syncPort, self:syncPort); connect(p_ea:syncPort, self:syncPort); activate(a_default_mtc()); } // End of function f_cfMtcUp02 function f_cfMtcUp03( Loading @@ -111,6 +114,7 @@ module LibItsPki_Functions { connect(self:syncPort, mtc:syncPort); connect(p_itss:syncPort, self:syncPort); connect(p_tlm:syncPort, self:syncPort); activate(a_default_mtc()); } // End of function f_cfMtcUp03 function f_cfMtcUp04( Loading @@ -123,6 +127,7 @@ module LibItsPki_Functions { connect(self:syncPort, mtc:syncPort); connect(p_itss:syncPort, self:syncPort); connect(p_dc:syncPort, self:syncPort); activate(a_default_mtc()); } // End of function f_cfMtcUp04 /** Loading Loading @@ -357,12 +362,16 @@ module LibItsPki_Functions { } } // End of function f_cfHttpUp_ea function f_cfUp_itss() runs on ItsPkiItss system ItsPkiItssSystem { function f_cfUp_itss( in charstring p_cert_id := "" ) runs on ItsPkiItss system ItsPkiItssSystem { map(self:geoNetworkingPort, system:geoNetworkingPort); map(self:utPort, system:utPort); //map(self:acPort, system:acPort); activate(a_default_itss()); //map(self:acPort, system:acPort); vc_hashedId8ToBeUsed := p_cert_id; f_initializeState(); // activate(a_default_pki()); TOTO Defualt from geoNet Loading Loading @@ -1623,6 +1632,66 @@ module LibItsPki_Functions { return true; } // End of function f_http_build_authorization_request_with_wrong_parameters function f_http_build_common_authorization_response( inout InnerAtResponse p_inner_at_response, in Oct16 p_request_hash, in octetstring p_private_key := ''O, in octetstring p_digest := ''O, in Oct16 p_aes_sym_key, out Ieee1609Dot2Data p_ieee1609dot2_signed_and_encrypted_data ) return boolean { var octetstring v_msg; var Oct12 v_nonce; var boolean v_result := false; // Secure the response log("f_http_build_common_authorization_response: p_inner_at_response= ", p_inner_at_response); v_msg := bit2oct(encvalue(m_etsiTs102941Data_inner_at_response(p_inner_at_response))); v_nonce := substr(f_hashWithSha256(int2oct((f_getCurrentTimeUtc() * 1000), 16)), 0, 12); // Random value // TODO Consider Sha384: m_signerIdentifier_digest(f_hashedId8FromSha384(p_digest)) if (f_build_pki_secured_response_message(p_private_key, valueof(m_signerIdentifier_digest(f_hashedId8FromSha256(p_digest))),// in SignerIdentifier p_signer_identifier, v_msg, p_aes_sym_key, v_nonce, p_ieee1609dot2_signed_and_encrypted_data ) == false) { log("f_http_build_common_authorization_response: Failed to generate the certificate"); p_inner_at_response := valueof( m_innerAtResponse_ko( p_request_hash, its_aa_deniedpermissions ) ); } else { v_result := true; } log("<<< f_http_build_common_authorization_response: v_result= ", v_result); log("<<< f_http_build_common_authorization_response: p_inner_at_response= ", p_inner_at_response); return v_result; } function f_http_build_error_authorization_response( in AuthorizationResponseCode p_responseCode := unknownits, in Oct16 p_request_hash, in octetstring p_private_key := ''O, in octetstring p_digest := ''O, in Oct16 p_aes_sym_key, out Ieee1609Dot2Data p_ieee1609dot2_signed_and_encrypted_data ) return boolean { var InnerAtResponse v_inner_at_response; v_inner_at_response := valueof( m_innerAtResponse_ko( p_request_hash, p_responseCode ) ); return f_http_build_common_authorization_response ( v_inner_at_response, p_request_hash, p_private_key, p_digest, p_aes_sym_key, p_ieee1609dot2_signed_and_encrypted_data ); } function f_http_build_authorization_response( in template (omit) InnerAtRequest p_inner_at_request := omit, in AuthorizationResponseCode p_responseCode := ok, Loading @@ -1634,10 +1703,6 @@ module LibItsPki_Functions { out Ieee1609Dot2Data p_ieee1609dot2_signed_and_encrypted_data ) return boolean { // Local variables var bitstring v_msg_bit; var octetstring v_msg; var Oct12 v_nonce; var Ieee1609Dot2Data v_ieee1609dot2_signed_data; var EtsiTs103097Certificate v_at_certificate; var boolean v_result := false; Loading Loading @@ -1677,32 +1742,9 @@ module LibItsPki_Functions { } } // Secure the response log("f_http_build_authorization_response: p_inner_at_response= ", p_inner_at_response); v_msg := bit2oct(encvalue(m_etsiTs102941Data_inner_at_response(p_inner_at_response))); v_nonce := substr(f_hashWithSha256(int2oct((f_getCurrentTimeUtc() * 1000), 16)), 0, 12); // Random value // TODO Consider Sha384: m_signerIdentifier_digest(f_hashedId8FromSha384(p_digest)) if (f_build_pki_secured_response_message(p_private_key, valueof(m_signerIdentifier_digest(f_hashedId8FromSha256(p_digest))),// in SignerIdentifier p_signer_identifier, v_msg, p_aes_sym_key, v_nonce, p_ieee1609dot2_signed_and_encrypted_data ) == false) { log("f_http_build_authorization_response: Failed to generate the certificate"); p_inner_at_response := valueof( m_innerAtResponse_ko( p_request_hash, its_aa_deniedpermissions ) ); } else { v_result := true; } log("<<< f_http_build_authorization_response: v_result= ", v_result); log("<<< f_http_build_authorization_response: p_inner_at_response= ", p_inner_at_response); return v_result; return f_http_build_common_authorization_response ( p_inner_at_response, p_request_hash, p_private_key, p_digest, p_aes_sym_key, p_ieee1609dot2_signed_and_encrypted_data ); } // End of function f_http_build_authorization_response function f_http_build_authorization_validation_request( Loading Loading @@ -5444,12 +5486,16 @@ module LibItsPki_Functions { f_http_build_inner_ec_response(p_inner_ec_request, p_response_code, v_request_hash, vc_eaPrivateKey, vc_eaWholeHash, v_aes_enc_key, v_ec_certificate, v_ec_certificate_hashed_id8, p_inner_ec_response, v_response_message); vc_ec_hashed_id8[vc_ec_counter] := v_ec_certificate_hashed_id8; vc_ec_certificates[vc_ec_counter] := v_ec_certificate; vc_ec_counter := vc_ec_counter + 1; v_response := m_http_response( m_http_response_ok( m_http_message_body_binary( m_binary_body_ieee1609dot2_data(v_response_message) ), v_headers)); } else { v_response := m_http_response(m_http_response_500_internal_error(v_headers)); } Loading Loading @@ -6605,6 +6651,22 @@ module LibItsPki_Functions { group altsteps { altstep a_default_mtc() runs on ServerSyncComp { [] a_shutdown() { log("*** a_default_mtc: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***"); all component . done; stop; } } altstep a_default_itss() runs on ItsPkiItss { [] a_shutdown() { log("*** a_default_itss: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***"); f_cfDown_itss(); stop; } } altstep a_default_pki_http() runs on ItsPkiHttp { [not(PICS_MULTIPLE_END_POINT)] httpPort.receive( mw_http_response( Loading