diff --git a/.TITAN_properties b/.TITAN_properties index 4edb12fd5f331487aef1d9f52c1fa771a57d2929..76dec310556dd7633179cbf698019c32da19014b 100644 --- a/.TITAN_properties +++ b/.TITAN_properties @@ -23,7 +23,7 @@ ./bin ./src/bin ./src/bin/asn1 - C:\OpenSSL-Win64\include + C:\ProgramFiles\OpenSSL-Win64\include C:\npcap-sdk-0.1\Include /Users/yann/Documents/wireshark/cygwin64/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++ diff --git a/.gitignore b/.gitignore index 44d19f0ed3892a26222bf130b5a360f929429a26..7aa329180aeb1ac9e943069655333d7efc713030 100755 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ data/certificates/ data/v3/certificates/ data/v3/temp/ data/v3/xer/ +/bin/ diff --git a/ccsrc/Externals/LibItsSecurity_externals.cc b/ccsrc/Externals/LibItsSecurity_externals.cc index 4b945235eff28332596dbccbdbacd1404b160829..ef370c4b01c305b68e8a10e16d1b942defd29478 100644 --- a/ccsrc/Externals/LibItsSecurity_externals.cc +++ b/ccsrc/Externals/LibItsSecurity_externals.cc @@ -1149,7 +1149,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the specified certificate - * \param p_certificateId the certificate identifier + * \param p_certificate_id the certificate identifier * \param p_certificate the expected certificate * \return true on success, false otherwise */ @@ -1181,7 +1181,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the specified certificate digest - * \param p_certificateId the certificate identifier + * \param p_certificate_id the certificate identifier * \param p_digest the expected certificate * \return true on success, false otherwise */ @@ -1200,7 +1200,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the whole-hash of the certificate - * \param p_certificateId the certificate identifier + * \param p_certificate_id the certificate identifier * \param p_hash the expected certificate * \return true on success, false otherwise */ @@ -1219,7 +1219,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the private keys for the specified certificate - * \param p_certificateId the keys identifier + * \param p_certificate_id the keys identifier * \param p_signingPrivateKey the signing private key * \return true on success, false otherwise */ diff --git a/ccsrc/Framework/converter.hh b/ccsrc/Framework/converter.hh index 8ff5e8f1b7d7350d621e3a65250b4df5e5601e22..7c9d4623d250d1993252545ef362d5666a363edb 100644 --- a/ccsrc/Framework/converter.hh +++ b/ccsrc/Framework/converter.hh @@ -338,6 +338,22 @@ public: */ std::string trim(const std::string& p_value, const std::string& p_trim_chars = " \t"); + /*! + * \brief Convert the provided string into a list of arguments + * \param[in] p_value The string value + * \param[in] p_separator The separator sequence to use for the spliting process + * \return The item list + * \code{.cc} + * std::string str = "This is a test for spliting a string with a white spave"; + * std::vector tokens = converter::get_instance().split(str, " "); + * std::clog << "Tokens: " << std::endl; + * for (auto it = tokens.begin(); it != tokens.end(); ++it) { + * std::clog << " " << *it << std::endl; + * } + * \endcode + */ + std::vector split(const std::string & p_value, const std::string& p_separator); + /*! * \brief Convert the provided string into a list of arguments * \param[in] p_value The string value @@ -352,6 +368,6 @@ public: * \endcode */ std::vector split_arguments_line(const std::string & p_value); - + static const std::string lut; }; // End of class converter diff --git a/ccsrc/Framework/src/converter.cc b/ccsrc/Framework/src/converter.cc index 265b9b64d53aea5e602a39c71401e506ce310c93..77cfaf427a739b4d720db0748a670fcaf9087743 100644 --- a/ccsrc/Framework/src/converter.cc +++ b/ccsrc/Framework/src/converter.cc @@ -97,7 +97,21 @@ std::string converter::trim(const std::string& str, const std::string& whitespac return str.substr(strBegin, strRange); } - + +std::vector converter::split(const std::string & p_value, const std::string& p_separator) { + std::vector output; + std::size_t current, previous = 0; + current = p_value.find(p_separator); + while (current != std::string::npos) { + output.push_back(p_value.substr(previous, current - previous)); + previous = current + 1; + current = p_value.find(p_separator, previous); + } + output.push_back(p_value.substr(previous, current - previous)); + + return output; +} + std::vector converter::split_arguments_line(const std::string & p_value) { std::vector output; std::string line = trim(p_value); diff --git a/ccsrc/Framework/src/params.cc b/ccsrc/Framework/src/params.cc index c4fb7c76aa948ad929e8e26e87b8e75e51bb4d1e..513913e403462df90fbe77c240ba764c5849c62c 100644 --- a/ccsrc/Framework/src/params.cc +++ b/ccsrc/Framework/src/params.cc @@ -71,6 +71,8 @@ const std::string& params::interface_id = std::string("interface_id"); const std::string& params::server = std::string("server"); const std::string& params::port = std::string("port"); +const std::string& params::server_mode = std::string("server_mode"); +const std::string& params::local_port = std::string("local_port"); const std::string& params::use_ssl = std::string("use_ssl"); const std::string& params::method = std::string("method"); const std::string& params::uri = std::string("uri"); diff --git a/ccsrc/Protocols/Http/http_codec.cc b/ccsrc/Protocols/Http/http_codec.cc index 38eb3a107068ac75a55f07d778d156e368c41844..63118481b824de2fc60dd5aac33c2e71d6de3916 100644 --- a/ccsrc/Protocols/Http/http_codec.cc +++ b/ccsrc/Protocols/Http/http_codec.cc @@ -12,8 +12,6 @@ #include "LibItsHttp_MessageBodyTypes.hh" #include "LibItsHttp_XmlMessageBodyTypes.hh" -#include "http_etsi_ieee1609dot2_codec.hh" // FIXME Work-around, to be removed - int http_codec::encode (const LibItsHttp__TypesAndValues::HttpMessage& msg, OCTETSTRING& data) { loggers::get_instance().log_msg(">>> http_codec::encode: ", (const Base_Type&)msg); @@ -367,7 +365,12 @@ int http_codec::decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValue // Save the the body length loggers::get_instance().log("http_codec::decode_header: decoded Content-Length %s", m[2].str().c_str()); _dc.length = std::stoi(m[2].str()); + } else if (m[1].str().compare("Transfer-Encoding") == 0) { + if (m[2].str().find("chunked") != std::string::npos) { + _dc.chunked = true; + } } + return 0; } catch(const std::logic_error& e) { @@ -377,7 +380,6 @@ int http_codec::decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValue int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody& p_message_body, OCTETSTRING& p_encoding_buffer, const std::string& p_content_type) { loggers::get_instance().log_msg(">>> http_codec::encode_body: ", (const Base_Type&)p_message_body); - loggers::get_instance().log("http_codec::encode_body: # of codecs=%d - %p", _codecs.size(), this); // Sanity check if (p_content_type.empty()) { @@ -509,8 +511,29 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod counter += 1; } } - loggers::get_instance().log("http_codec::decode_body: Counter=%d", counter); + loggers::get_instance().log("http_codec::decode_body: counter=%d", counter); body = OCTETSTRING(body.lengthof() - counter, static_cast(body)); + if (_dc.chunked) { + // Extract the size of the chunk \r[\n] + counter = 0; + while (counter < body.lengthof()) { + if ((body[counter].get_octet() == '\r') || (body[counter].get_octet() == '\n')) { + break; + } + counter += 1; + } // End of 'while' statement + loggers::get_instance().log("http_codec::decode_body: Chunked: counter=%d", counter); + if (counter < body.lengthof()) { // Skip additional \n + OCTETSTRING os(counter - 1, static_cast(body)); + loggers::get_instance().log_msg("http_codec::decode_body: os: ", os); + int len = oct2int(os); + loggers::get_instance().log("http_codec::decode_body: Chunk len: %d", len); + if (body[counter].get_octet() == '\n') { + counter += 1; + } + body = OCTETSTRING(len, counter + static_cast(body)); + } + } loggers::get_instance().log_msg("http_codec::decode_body: Finalised body=", body); // Check if HTTP message body contains binary characters for (int i = 0; i < body.lengthof(); i++) { @@ -561,12 +584,13 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod // Convert into string params p; p["decode_str"] = std::string(static_cast(body), body.lengthof() + static_cast(body)); + loggers::get_instance().log("http_codec::decode_body: decode_str: %s", p["decode_str"].c_str()); // Try to identify xml if (p["decode_str"].find("" - if (p["decode_str"].find("xmlns=\"urn:ietf:params:xml:ns:geopriv:held\">") != std::string::npos) { + if (p["decode_str"].find("xmlns=\"urn:ietf:params:xml:ns:geopriv:held\"") != std::string::npos) { loggers::get_instance().log("http_codec::decode_body: Find 'urn:ietf:params:xml:ns:geopriv:held'"); if (_codecs["held"].get() != nullptr) { loggers::get_instance().log("http_codec::decode_body: Call 'held_codec'"); @@ -582,8 +606,8 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod xml_body.raw() = CHARSTRING(body.lengthof(), (char*)static_cast(body)); } message_body.xml__body() = xml_body; - } else if (p["decode_str"].find("xmlns=\"urn:ietf:params:xml:ns:lost1\">") != std::string::npos) { - loggers::get_instance().log("http_codec::decode_body: Find 'urn:ietf:params:xml:ns:loat1'"); + } else if (p["decode_str"].find("xmlns=\"urn:ietf:params:xml:ns:lost1\"") != std::string::npos) { + loggers::get_instance().log("http_codec::decode_body: Find 'urn:ietf:params:xml:ns:lost1'"); if (_codecs["lost"].get() != nullptr) { loggers::get_instance().log("http_codec::decode_body: Call 'lost_codec'"); if (_codecs["lost"]->decode(body, (Record_Type&)xml_body, &p) == -1) { @@ -598,7 +622,11 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod xml_body.raw() = CHARSTRING(body.lengthof(), (char*)static_cast(body)); } message_body.xml__body() = xml_body; - } + } else { + loggers::get_instance().warning("http_codec::decode_body: No XML codec found"); + xml_body.raw() = CHARSTRING(body.lengthof(), (char*)static_cast(body)); + message_body.xml__body() = xml_body; + } } else if (p["decode_str"].find("") != std::string::npos) { // Try to identify HTML loggers::get_instance().log("http_codec::decode_body: Find html message"); LibItsHttp__MessageBodyTypes::HtmlBody html_body; diff --git a/ccsrc/Protocols/Http/http_codec.hh b/ccsrc/Protocols/Http/http_codec.hh index 87b061767da32736e468b87250b97ae7ffa13ac8..4e8c077f2adcb3c6e5259f3a0b5c0191a3aaae28 100644 --- a/ccsrc/Protocols/Http/http_codec.hh +++ b/ccsrc/Protocols/Http/http_codec.hh @@ -32,9 +32,10 @@ struct encoding_context { struct decoding_context { unsigned int length; unsigned char is_binary; + bool chunked; decoding_context() { reset(); }; - void reset() { length = -1; is_binary = 0x00; }; + void reset() { length = -1; is_binary = 0x00; chunked = false; }; }; class http_codec: public codec < @@ -46,7 +47,7 @@ LibItsHttp__TypesAndValues::HttpMessage> std::map > > _codecs; public: explicit http_codec() : codec(), _ec(), _dc(), _codecs() { }; - virtual ~http_codec() { _codecs.clear(); }; + virtual ~http_codec() { }; virtual int encode (const LibItsHttp__TypesAndValues::HttpMessage&, OCTETSTRING& data); virtual int decode (const OCTETSTRING& data, LibItsHttp__TypesAndValues::HttpMessage&, params* params = NULL); @@ -60,7 +61,7 @@ private: int decode_headers(TTCN_Buffer& decoding_buffer, LibItsHttp__TypesAndValues::HeaderLines& headers); int decode_header(CHARSTRING& header_line, LibItsHttp__TypesAndValues::HeaderLine& header); - int decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody& message_body, const std::string& p_content_type); + int decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBodyTypes::HttpMessageBody& message_body); int get_line(TTCN_Buffer& buffer, CHARSTRING& to, const bool concatenate_header_lines = false); }; // End of class http_codec diff --git a/ccsrc/Protocols/Http/http_layer_factory.hh b/ccsrc/Protocols/Http/http_layer_factory.hh index bb136e43441d9ee4ca59c65dcd4ee7396bdd24df..b6ebebdf7e377825f63961f0f710fa372ee22d66 100644 --- a/ccsrc/Protocols/Http/http_layer_factory.hh +++ b/ccsrc/Protocols/Http/http_layer_factory.hh @@ -23,7 +23,7 @@ class http_layer_factory : public layer_factory { public: //! \publicsection /*! * \brief Default constructor - * Create a new instance of the udp_layer_factory class + * Create a new instance of the http_layer_factory class * \remark The HTTP layer identifier is HTTP */ http_layer_factory() { diff --git a/ttcn/AtsPki/ItsPki_TestCases.ttcn b/ttcn/AtsPki/ItsPki_TestCases.ttcn index 5c4683407c0df82da2e05aab142bce8445f11c59..cd902ba23962f06ae0d64b68e2586f9c3f534913 100644 --- a/ttcn/AtsPki/ItsPki_TestCases.ttcn +++ b/ttcn/AtsPki/ItsPki_TestCases.ttcn @@ -100,10 +100,10 @@ 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_public_key_x; + var Oct32 v_public_key_y; + var Oct32 v_public_compressed_key; + var integer v_compressed_mode; var ItsPkiItss v_itss; var ItsPkiHttp v_ea; @@ -116,13 +116,13 @@ module ItsPki_TestCases { // Test component configuration - if (f_generate_key_pair_nistp256(v_private_key, v_publicKeyX, v_publicKeyY, v_publicKeyCompressed, v_compressedMode) == false) { + if (f_generate_key_pair_nistp256(v_private_key, v_public_key_x, v_public_key_y, v_public_compressed_key, v_compressed_mode) == false) { log("*** " & testcasename() & ": FAIL: Failed to setup InnerEcRequest message ***") setverdict(inconc); stop; } - v_itss.start(f_TC_SEC_PKI_ITSS_ENR_BV_01_itss(cc_taCert_A, v_private_key, v_publicKeyCompressed, v_compressedMode)); - v_ea.start(f_TC_SEC_PKI_ITSS_ENR_BV_01_pki(cc_taCert_A, v_private_key, v_publicKeyCompressed, v_compressedMode)); + v_itss.start(f_TC_SEC_PKI_ITSS_ENR_BV_01_itss(cc_taCert_A, v_private_key, v_public_compressed_key, v_compressed_mode)); + v_ea.start(f_TC_SEC_PKI_ITSS_ENR_BV_01_pki(cc_taCert_A, v_private_key, v_public_compressed_key, v_compressed_mode)); // Synchronization f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone}); @@ -137,7 +137,7 @@ module ItsPki_TestCases { in charstring p_certificate_id, in octetstring p_private_key, in octetstring p_publicKeyCompressed, - in integer p_compressedMode + in integer p_compressed_mode ) runs on ItsPkiItss /*system ItsPkiItssSystem*/ { // Local variables @@ -147,7 +147,7 @@ module ItsPki_TestCases { // Test adapter configuration // Preamble - f_sendUtTriggerPrimitive(PICS_ITS_S_CANONICAL_ID, '00'O, p_private_key, p_publicKeyCompressed, p_compressedMode); + f_sendUtTriggerPrimitive(PICS_ITS_S_CANONICAL_ID, '00'O, p_private_key, p_publicKeyCompressed, p_compressed_mode); f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); // Test Body @@ -161,7 +161,7 @@ module ItsPki_TestCases { in charstring p_certificate_id, in octetstring p_private_key, in octetstring p_publicKeyCompressed, - in integer p_compressedMode + in integer p_compressed_mode ) runs on ItsPkiHttp /*system ItsPkiHttpSystem*/ { // Local variable var HttpMessage v_response; @@ -253,10 +253,10 @@ module ItsPki_TestCases { 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 Oct32 v_public_key_x; + var Oct32 v_public_key_y; + var Oct32 v_public_compressed_key; + var integer v_compressed_mode; var ItsPkiItss v_itss; var ItsPkiHttp v_ea; @@ -269,13 +269,13 @@ module ItsPki_TestCases { // Test component configuration - if (f_generate_key_pair_nistp256(v_private_key, v_publicKeyX, v_publicKeyY, v_publicKeyCompressed, v_compressedMode) == false) { + if (f_generate_key_pair_nistp256(v_private_key, v_public_key_x, v_public_key_y, v_public_compressed_key, v_compressed_mode) == 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_publicKeyCompressed, v_compressedMode)); - v_ea.start(f_TC_SEC_PKI_ITSS_ENR_BV_02_pki(cc_taCert_A, v_private_key, v_publicKeyCompressed, v_compressedMode)); + v_itss.start(f_TC_SEC_PKI_ITSS_ENR_BV_02_itss(cc_taCert_A, v_private_key, v_public_compressed_key, v_compressed_mode)); + v_ea.start(f_TC_SEC_PKI_ITSS_ENR_BV_02_pki(cc_taCert_A, v_private_key, v_public_compressed_key, v_compressed_mode)); // Synchronization f_serverSync2ClientsAndStop({c_prDone, c_tbDone, c_poDone}); @@ -290,7 +290,7 @@ module ItsPki_TestCases { in charstring p_certificate_id, in octetstring p_private_key, in octetstring p_publicKeyCompressed, - in integer p_compressedMode + in integer p_compressed_mode ) runs on ItsPkiItss /*system ItsPkiItssSystem*/ { // Local variables @@ -300,7 +300,7 @@ module ItsPki_TestCases { // Test adapter configuration // Preamble - f_sendUtTriggerPrimitive(PICS_ITS_S_CANONICAL_ID, '00'O, p_private_key, p_publicKeyCompressed, p_compressedMode); + f_sendUtTriggerPrimitive(PICS_ITS_S_CANONICAL_ID, '00'O, p_private_key, p_publicKeyCompressed, p_compressed_mode); f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); // Test Body @@ -314,7 +314,7 @@ module ItsPki_TestCases { in charstring p_certificate_id, in octetstring p_private_key, in octetstring p_publicKeyCompressed, - in integer p_compressedMode + in integer p_compressed_mode ) runs on ItsPkiHttp /*system ItsPkiHttpSystem*/ { // Local variable var HttpMessage v_response; @@ -406,8 +406,8 @@ module ItsPki_TestCases { testcase TC_SEC_PKI_SND_EA_BV_01() runs on ItsPkiHttp system ItsPkiHttpSystem { // Local variables var Oct32 v_private_key; - var Oct32 v_publicKeyCompressed; - var integer v_compressedMode; + var Oct32 v_public_compressed_key; + var integer v_compressed_mode; var Oct32 v_request_hash; var Oct16 v_encrypted_sym_key; var Oct16 v_aes_sym_key; @@ -432,7 +432,7 @@ module ItsPki_TestCases { // Test adapter configuration // Preamble - f_http_build_inner_ec_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_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); f_init_default_headers_list(-, "inner_ec_request", v_headers); f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); @@ -521,8 +521,8 @@ module ItsPki_TestCases { testcase TC_SEC_PKI_SND_EA_BV_02() runs on ItsPkiHttp system ItsPkiHttpSystem { // Local variables var Oct32 v_private_key; - var Oct32 v_publicKeyCompressed; - var integer v_compressedMode; + var Oct32 v_public_compressed_key; + var integer v_compressed_mode; var Oct32 v_request_hash; var Oct16 v_encrypted_sym_key; var Oct16 v_aes_sym_key; @@ -547,7 +547,7 @@ module ItsPki_TestCases { // Test adapter configuration // Preamble - f_http_build_inner_ec_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_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); f_init_default_headers_list(-, "inner_ec_request", v_headers); f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); @@ -641,8 +641,8 @@ module ItsPki_TestCases { testcase TC_SEC_PKI_SND_EA_BV_03() runs on ItsPkiHttp system ItsPkiHttpSystem { // Local variables var Oct32 v_private_key; - var Oct32 v_publicKeyCompressed; - var integer v_compressedMode; + var Oct32 v_public_compressed_key; + var integer v_compressed_mode; var Oct32 v_request_hash; var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data; var Oct16 v_aes_sym_key; @@ -667,7 +667,7 @@ module ItsPki_TestCases { // Test adapter configuration // Preamble - f_http_build_inner_ec_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_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); f_init_default_headers_list(-, "inner_ec_request", v_headers); httpPort.send( m_http_request( @@ -757,8 +757,8 @@ module ItsPki_TestCases { testcase TC_SEC_PKI_SND_EA_BV_04() runs on ItsPkiHttp system ItsPkiHttpSystem { // Local variables var Oct32 v_private_key; - var Oct32 v_publicKeyCompressed; - var integer v_compressedMode; + var Oct32 v_public_compressed_key; + var integer v_compressed_mode; var Oct32 v_request_hash; var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data; var Oct16 v_aes_sym_key; @@ -783,7 +783,7 @@ module ItsPki_TestCases { // Test adapter configuration // Preamble - f_http_build_inner_ec_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_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); f_init_default_headers_list(-, "inner_ec_request", v_headers); httpPort.send( m_http_request( @@ -818,7 +818,7 @@ module ItsPki_TestCases { log("*** " & testcasename() & ": LOG: Receive ", v_etsi_ts_102941_data, " ***"); log("*** " & testcasename() & ": DEBUG: match ", match(v_etsi_ts_102941_data.content, mw_enrolmentResponse(mw_innerEcResponse_ok(substr(v_request_hash, 0, 16)))), " ***"); // 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))))) { - if (f_verify_ea_certificate(v_etsi_ts_102941_data.content.enrolmentResponse.certificate, v_publicKeyCompressed, v_compressedMode)) { + if (f_verify_ea_certificate(v_etsi_ts_102941_data.content.enrolmentResponse.certificate, v_public_compressed_key, v_compressed_mode)) { log("*** " & testcasename() & ": PASS: Well-secured EA certificate received ***"); f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); } else { @@ -843,7 +843,7 @@ module ItsPki_TestCases { } // End of testcase TC_SEC_PKI_SND_EA_BV_04 /** - * @desc Within the headerInfo of the tbsData, the psid shall be set to “secured certificate request” as assigned in + * @desc Within the headerInfo of the tbsData, the psid shall be set to “secured certificate requestâ€� as assigned in * ETSI TS 102 965 and the generationTime shall be present. *
        * Pics Selection: PICS_IUT_EA_ROLE
@@ -870,8 +870,8 @@ module ItsPki_TestCases {
       testcase TC_SEC_PKI_SND_EA_BV_05() runs on ItsPkiHttp system ItsPkiHttpSystem {
         // Local variables
         var Oct32 v_private_key;
-        var Oct32 v_publicKeyCompressed;
-        var integer v_compressedMode;
+        var Oct32 v_public_compressed_key;
+        var integer v_compressed_mode;
         var Oct32 v_request_hash;
         var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
         var Oct16 v_aes_sym_key;
@@ -896,7 +896,7 @@ module ItsPki_TestCases {
         // Test adapter configuration
         
         // Preamble
-        f_http_build_inner_ec_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_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);
         f_init_default_headers_list(-, "inner_ec_request", v_headers);
         httpPort.send(
                       m_http_request(
@@ -931,7 +931,7 @@ module ItsPki_TestCases {
               log("*** " & testcasename() & ": LOG: Receive ", v_etsi_ts_102941_data, " ***");
               log("*** " & testcasename() & ": DEBUG: match ", match(v_etsi_ts_102941_data.content, mw_enrolmentResponse(mw_innerEcResponse_ok(substr(v_request_hash, 0, 16)))), " ***"); // 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))))) {
-                if (f_verify_ea_certificate(v_etsi_ts_102941_data.content.enrolmentResponse.certificate, v_publicKeyCompressed, v_compressedMode)) {
+                if (f_verify_ea_certificate(v_etsi_ts_102941_data.content.enrolmentResponse.certificate, v_public_compressed_key, v_compressed_mode)) {
                   log("*** " & testcasename() & ": PASS: Well-secured EA certificate received ***");
                   f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                 } else {
@@ -982,8 +982,8 @@ module ItsPki_TestCases {
       testcase TC_SEC_PKI_SND_EA_BV_06() runs on ItsPkiHttp system ItsPkiHttpSystem {
         // Local variables
         var Oct32 v_private_key;
-        var Oct32 v_publicKeyCompressed;
-        var integer v_compressedMode;
+        var Oct32 v_public_compressed_key;
+        var integer v_compressed_mode;
         var Oct32 v_request_hash;
         var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
         var Oct16 v_aes_sym_key;
@@ -1008,7 +1008,7 @@ module ItsPki_TestCases {
         // Test adapter configuration
         
         // Preamble
-        f_http_build_inner_ec_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_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);
         f_init_default_headers_list(-, "inner_ec_request", v_headers);
         httpPort.send(
                       m_http_request(
@@ -1043,7 +1043,7 @@ module ItsPki_TestCases {
               log("*** " & testcasename() & ": LOG: Receive ", v_etsi_ts_102941_data, " ***");
               log("*** " & testcasename() & ": DEBUG: match ", match(v_etsi_ts_102941_data.content, mw_enrolmentResponse(mw_innerEcResponse_ok(substr(v_request_hash, 0, 16)))), " ***"); // 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))))) {
-                if (f_verify_ea_certificate(v_etsi_ts_102941_data.content.enrolmentResponse.certificate, v_publicKeyCompressed, v_compressedMode)) {
+                if (f_verify_ea_certificate(v_etsi_ts_102941_data.content.enrolmentResponse.certificate, v_public_compressed_key, v_compressed_mode)) {
                   log("*** " & testcasename() & ": PASS: Well-secured EA certificate received ***");
                   f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                 } else {
@@ -1094,8 +1094,8 @@ module ItsPki_TestCases {
       testcase TC_SEC_PKI_SND_EA_BV_07() runs on ItsPkiHttp system ItsPkiHttpSystem {
         // Local variables
         var Oct32 v_private_key;
-        var Oct32 v_publicKeyCompressed;
-        var integer v_compressedMode;
+        var Oct32 v_public_compressed_key;
+        var integer v_compressed_mode;
         var Oct32 v_request_hash;
         var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
         var Oct16 v_aes_sym_key;
@@ -1120,7 +1120,7 @@ module ItsPki_TestCases {
         // Test adapter configuration
         
         // Preamble
-        f_http_build_inner_ec_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_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);
         f_init_default_headers_list(-, "inner_ec_request", v_headers);
         httpPort.send(
                       m_http_request(
@@ -1202,8 +1202,8 @@ module ItsPki_TestCases {
       testcase TC_SEC_PKI_SND_EA_BV_08() runs on ItsPkiHttp system ItsPkiHttpSystem {
         // Local variables
         var Oct32 v_private_key;
-        var Oct32 v_publicKeyCompressed;
-        var integer v_compressedMode;
+        var Oct32 v_public_compressed_key;
+        var integer v_compressed_mode;
         var Oct32 v_request_hash;
         var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
         var Oct16 v_aes_sym_key;
@@ -1228,7 +1228,7 @@ module ItsPki_TestCases {
         // Test adapter configuration
         
         // Preamble
-        f_http_build_inner_ec_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_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);
         f_init_default_headers_list(-, "inner_ec_request", v_headers);
         httpPort.send(
                       m_http_request(
@@ -1308,8 +1308,8 @@ module ItsPki_TestCases {
       testcase TC_SEC_PKI_SND_EA_BV_09() runs on ItsPkiHttp system ItsPkiHttpSystem {
         // Local variables
         var Oct32 v_private_key;
-        var Oct32 v_publicKeyCompressed;
-        var integer v_compressedMode;
+        var Oct32 v_public_compressed_key;
+        var integer v_compressed_mode;
         var Oct32 v_request_hash;
         var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
         var Oct16 v_aes_sym_key;
@@ -1334,7 +1334,7 @@ module ItsPki_TestCases {
         // Test adapter configuration
         
         // Preamble
-        f_http_build_inner_ec_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_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);
         f_init_default_headers_list(-, "inner_ec_request", v_headers);
         httpPort.send(
                       m_http_request(
@@ -1414,8 +1414,8 @@ module ItsPki_TestCases {
       testcase TC_SEC_PKI_SND_EA_BV_10() runs on ItsPkiHttp system ItsPkiHttpSystem {
         // Local variables
         var Oct32 v_private_key;
-        var Oct32 v_publicKeyCompressed;
-        var integer v_compressedMode;
+        var Oct32 v_public_compressed_key;
+        var integer v_compressed_mode;
         var Oct32 v_request_hash;
         var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
         var Oct16 v_aes_sym_key;
@@ -1440,7 +1440,7 @@ module ItsPki_TestCases {
         // Test adapter configuration
         
         // Preamble
-        f_http_build_invalid_enrolment_request(v_private_key, v_publicKeyCompressed, v_compressedMode, 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_invalid_enrolment_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);
         f_init_default_headers_list(-, "inner_ec_request", v_headers);
         httpPort.send(
                       m_http_request(
@@ -1495,7 +1495,7 @@ module ItsPki_TestCases {
       
     } // End of group enrolment_response
 
-    group authorization_vaidation_response {
+    group authorization_validation_response {
       
       /**
        * @desc The AuthorizationValidationResponse message shall be sent by the EA to the AA across the interface 
@@ -1524,8 +1524,8 @@ module ItsPki_TestCases {
       testcase TC_SEC_PKI_SND_EA_BV_11() runs on ItsPkiHttp system ItsPkiHttpSystem {
         // Local variables
         var Oct32 v_private_key;
-        var Oct32 v_publicKeyCompressed;
-        var integer v_compressedMode;
+        var Oct32 v_public_compressed_key;
+        var integer v_compressed_mode;
         var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
         var HeaderLines v_headers;
         var HttpMessage v_response;
@@ -1543,7 +1543,7 @@ module ItsPki_TestCases {
         // Test adapter configuration
         
         // Preamble
-        f_http_build_authorization_validation_request(v_private_key, v_publicKeyCompressed, v_compressedMode, v_ieee1609dot2_signed_and_encrypted_data);
+        f_http_build_authorization_validation_request(v_private_key, v_public_compressed_key, v_compressed_mode, v_ieee1609dot2_signed_and_encrypted_data);
         f_init_default_headers_list(-, "inner_ec_request", v_headers);
         httpPort.send(
                       m_http_request(
@@ -1611,8 +1611,8 @@ module ItsPki_TestCases {
       testcase TC_SEC_PKI_SND_EA_BV_12() runs on ItsPkiHttp system ItsPkiHttpSystem {
         // Local variables
         var Oct32 v_private_key;
-        var Oct32 v_publicKeyCompressed;
-        var integer v_compressedMode;
+        var Oct32 v_public_compressed_key;
+        var integer v_compressed_mode;
         var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
         var HeaderLines v_headers;
         var HttpMessage v_response;
@@ -1630,7 +1630,7 @@ module ItsPki_TestCases {
         // Test adapter configuration
         
         // Preamble
-        f_http_build_authorization_validation_request(v_private_key, v_publicKeyCompressed, v_compressedMode, v_ieee1609dot2_signed_and_encrypted_data);
+        f_http_build_authorization_validation_request(v_private_key, v_public_compressed_key, v_compressed_mode, v_ieee1609dot2_signed_and_encrypted_data);
         f_init_default_headers_list(-, "inner_ec_request", v_headers);
         httpPort.send(
                       m_http_request(
@@ -1671,25 +1671,87 @@ module ItsPki_TestCases {
         
       } // End of testcase TC_SEC_PKI_SND_EA_BV_12
       
-    } // End of group authorization_vaidation_response
+    } // End of group authorization_validation_response
     
   } // End of group ea_behavior
 
   group aa_behavior {
     
     group authorization_request {
-
-
-      testcase TC_SEC_PKI_SND_AA_BV_00() runs on ItsPkiHttp system ItsPkiHttpSystem {
+      
+      /**
+       * @desc Check that the EA/AA is able to decrypt the AuthorizationRequest message using the encryption private key corresponding to the recipient certificate
+       *       Check that the EA/AA is able to verify the inner signature
+       *       Check that the EA/AA is able to verify the request authenticity using the hmacKey verification
+       *       Check that the EA/AA sends the AuthorizationValidationRequest message to the correspondent EA
+       * 
+       * Pics Selection: PICS_IUT_COMBINED_EA_AA_ROLE
+       * Initial conditions: 
+       *     with {
+       *          the EA/AA in "operational state"
+       *              authorized with the certificate CERT_AA
+       *                  containing encryptionKey (AA_ENC_PUB_KEY)
+       *     }
+       * Expected behaviour:
+       *     ensure that {
+       *         when {
+       *            the IUT receives an EtsiTs103097Data message
+       *                containing content.encryptedData
+       *                    containing recipients
+       *                        containing the instance of RecipientInfo
+       *                            containing certRecipInfo
+       *                                containing recipientId
+       *                                    indicating HashedId8 of the certificate CERT_AA
+       *                                and containing encKey
+       *                                    indicating symmetric key (S_KEY)
+       *                                        encrypted with the private key correspondent to the AA_ENC_PUB_KEY
+       *                    and containing cyphertext (ENC_DATA)
+       *                        containing encrypted representation of the EtsiTs103097Data-Signed
+       *                            containing content.signedData
+       *                                containing hashId
+       *                                    indicating valid hash algorythm
+       *                and containing signer
+       *                    containing self
+       *                and containing tbsData (SIGNED_DATA)
+       *                    containing payload
+       *                        containing EtsiTs102941Data
+       *                            containing content.authorizationRequest
+       *                                containing publicKeys.verificationKey (V_KEY)
+       *                                and containing hmacKey (HMAC)
+       *                                and containing sharedAtRequest
+       *                                    containing keyTag (KEY_TAG)
+       *                                    and containing eaId (EA_ID)
+       (                                        indicating HashedId8 of the known EA certificate
+       *                and containing signature (SIGNATURE)
+       *         }
+       *         then {
+       *            the IUT is able to decrypt the S_KEY
+       *                using the private key
+       *                    corresponding to the AA_ENC_PUB_KEY
+       *            and the IUT is able to decrypt the cypthertext ENC_DATA
+       *                using the S_KEY
+       *            and the IUT is able to verify the signature SIGNATURE over the SIGNED_DATA
+       *                using the V_KEY
+       *            and the IUT is able to verify integrity of HMAC and KEY_TAG
+       *            and the IUT sends the AuthorizationValidationRequest message to the EA
+       *                identified by the EA_ID
+       *         }
+       *     }
+       * 
+ * + * @see ETSI TS ITS-00546v006 TP BV + * @reference ETSI TS 102 941, clause 6.2.3.3.1 + */ + testcase TC_SEC_PKI_SND_EA_AA_BV_01() runs on ItsPkiHttp system ItsPkiHttpSystem { var Oct32 v_private_key_ec; - var Oct32 v_publicKeyCompressed_ec; - var integer v_compressedMode_ec; + var Oct32 v_public_compressed_key_ec; + var integer v_compressed_mode_ec; var Oct32 v_private_key_at; - var Oct32 v_publicKeyCompressed_at; - var integer v_compressedMode_at; + var Oct32 v_public_compressed_key_at; + var integer p_compressed_mode_at; var Oct32 v_private_enc_key_at; - var Oct32 v_publicEncKeyCompressed_at; - var integer v_compressedEncMode_at; + var Oct32 v_public_compressed_enc_key_at; + var integer v_compressed_enc_mode_at; var Oct32 v_request_hash; var Oct16 v_encrypted_sym_key; var Oct16 v_aes_sym_key; @@ -1715,68 +1777,17 @@ module ItsPki_TestCases { // Test adapter configuration // Preamble - f_init_default_headers_list(-, "inner_ec_request", v_headers); - // TODO Create a f_await_http_inner_ec_request_response(v_private_key_ec, v_publicKeyCompressed_ec, v_compressedMode_ec, v_inner_ec_response); - f_http_build_inner_ec_request(v_private_key_ec, v_publicKeyCompressed_ec, v_compressedMode_ec, v_aes_sym_key, v_encrypted_sym_key, v_authentication_vector, v_nonce, v_salt, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - httpPort.send( - m_http_request( - m_http_request_post( - PICS_HTTP_POST_URI, - v_headers, - m_http_message_body_binary( - m_binary_body_ieee1609dot2_data( - v_ieee1609dot2_signed_and_encrypted_data - ))))); - tc_ac.start; - alt { - [] httpPort.receive( - mw_http_response( - mw_http_response_ok( - mw_http_message_body_binary( - mw_binary_body_ieee1609dot2_data( - mw_enrolmentResponseMessage( - mw_encryptedData( - -, - mw_SymmetricCiphertext_aes128ccm - ))))))) -> value v_response { - tc_ac.stop; - - if (f_verify_pki_message(v_private_key_ec, v_aes_sym_key, v_authentication_vector, vc_eaWholeHash, 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_prDone, e_timeout); - } else { - log("*** " & testcasename() & ": LOG: Receive ", v_etsi_ts_102941_data, " ***"); - log("*** " & testcasename() & ": DEBUG: match ", match(v_etsi_ts_102941_data.content, mw_enrolmentResponse(mw_innerEcResponse_ok(substr(v_request_hash, 0, 16), mw_etsiTs103097Certificate(mw_issuerIdentifier_self, mw_toBeSignedCertificate_ea, mw_signature_ecdsaNistP256)))), " ***"); // 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_issuerIdentifier_self, mw_toBeSignedCertificate_ea, mw_signature_ecdsaNistP256))))) { - v_inner_ec_response := v_etsi_ts_102941_data.content.enrolmentResponse; - log("*** " & testcasename() & ": INFO: Well-secured EA certificate received ***"); - log("v_inner_ec_response= ", v_inner_ec_response); - f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); - } else { - log("*** " & testcasename() & ": FAIL: Unexpected message received ***"); - f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_timeout); - } - } - } - [] httpPort.receive( - mw_http_response( - mw_http_response_ko - )) { - tc_ac.stop; - - log("*** " & testcasename() & ": FAIL: Unexpected message received ***"); - f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_timeout); - } - [] tc_ac.timeout { - log("*** " & testcasename() & ": INCONC: Expected message not received ***"); - f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_timeout); - } - } // End of 'alt' statement + if (f_await_http_inner_ec_request_response(v_private_key_ec, v_public_compressed_key_ec, v_compressed_mode_ec, v_inner_ec_response) == true) { + log("*** " & testcasename() & ": INFO: Enrolment succeed ***"); + f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_timeout); + } else { + log("*** " & testcasename() & ": INCONC: Enrolment failed ***"); + f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_timeout); + } // Test Body - f_http_build_authorization_request(v_inner_ec_response.certificate, v_private_key_ec, v_private_key_at, v_publicKeyCompressed_at, v_compressedMode_at, v_private_enc_key_at, v_publicEncKeyCompressed_at, v_compressedEncMode_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); + 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); f_set_headears_list({c_header_content_text}, {"authorization_request"}, v_headers); - log("v_headers= ", v_headers); httpPort.send( m_http_request( m_http_request_post( @@ -1825,9 +1836,7 @@ module ItsPki_TestCases { // Postamble f_cfHttpDown(); - - } - + } // End of testcase TC_SEC_PKI_SND_EA_AA_BV_01 /** * @desc Check that the AA is able to decrypt the AuthorizationRequest message using the encryption private key corresponding to the recipient certificate @@ -1893,12 +1902,24 @@ module ItsPki_TestCases { * @reference ETSI TS 102 941, clause 6.2.3.3.1 */ testcase TC_SEC_PKI_SND_AA_BV_01() runs on ItsPkiHttp system ItsPkiHttpSystem { - var Oct32 v_private_key; - var Oct32 v_publicKeyCompressed; - var integer v_compressedMode; + var Oct32 v_private_key_ec; + var Oct32 v_public_compressed_key_ec; + var integer v_compressed_mode_ec; + 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 Oct32 v_request_hash; + var Oct16 v_encrypted_sym_key; + var Oct16 v_aes_sym_key; + var Oct16 v_authentication_vector; + var Oct12 v_nonce; + var octetstring v_salt; var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data; var HeaderLines v_headers; + var InnerEcResponse v_inner_ec_response; var HttpMessage v_response; var EtsiTs102941Data v_etsi_ts_102941_data; @@ -1910,16 +1931,14 @@ module ItsPki_TestCases { } // Test component configuration - f_cfHttpUp( - PICS_TS_CERTIFICATE_ID, // TS role is ITS-S - PICS_IUT_AA_CERTIFICATE_ID // Peer certificate, IUT - ); + f_cfHttpUp(PICS_TS_EA_CERTIFICATE_ID, PICS_TS_AA_CERTIFICATE_ID); // Test adapter configuration // Preamble - // TODO f_http_build_inner_at_request(v_private_key, v_publicKeyCompressed, v_compressedMode, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); - f_init_default_headers_list(-, -, v_headers); + f_http_build_inner_ec_request(v_private_key_ec, v_public_compressed_key_ec, v_compressed_mode_ec, 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(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); + f_init_default_headers_list(-, "authorization_request", v_headers); httpPort.send( m_http_request( m_http_request_post( @@ -2024,8 +2043,8 @@ module ItsPki_TestCases { */ testcase TC_SEC_PKI_SND_AA_BV_02() runs on ItsPkiHttp system ItsPkiHttpSystem { var Oct32 v_private_key; - var Oct32 v_publicKeyCompressed; - var integer v_compressedMode; + var Oct32 v_public_compressed_key; + var integer v_compressed_mode; var Oct32 v_request_hash; var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data; var HeaderLines v_headers; @@ -2048,7 +2067,7 @@ module ItsPki_TestCases { // Test adapter configuration // Preamble - // TODO f_http_build_inner_at_request(v_private_key, v_publicKeyCompressed, v_compressedMode, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); + // TODO f_http_build_inner_at_request(v_private_key, v_public_compressed_key, v_compressed_mode, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( @@ -2138,8 +2157,8 @@ module ItsPki_TestCases { */ testcase TC_SEC_PKI_SND_AA_BV_03() runs on ItsPkiHttp system ItsPkiHttpSystem { var Oct32 v_private_key; - var Oct32 v_publicKeyCompressed; - var integer v_compressedMode; + var Oct32 v_public_compressed_key; + var integer v_compressed_mode; var Oct32 v_request_hash; var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data; var HeaderLines v_headers; @@ -2162,7 +2181,7 @@ module ItsPki_TestCases { // Test adapter configuration // Preamble - // TODO f_http_build_inner_at_request(v_private_key, v_publicKeyCompressed, v_compressedMode, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); + // TODO f_http_build_inner_at_request(v_private_key, v_public_compressed_key, v_compressed_mode, v_ieee1609dot2_signed_and_encrypted_data, v_request_hash); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( diff --git a/ttcn/AtsPki/ItsPki_TestControl.ttcn b/ttcn/AtsPki/ItsPki_TestControl.ttcn index b60cc5e37b45e1bed9a053a474d411d01d80e906..a37222f706c92cd444123acba7adca2bebcb27b9 100644 --- a/ttcn/AtsPki/ItsPki_TestControl.ttcn +++ b/ttcn/AtsPki/ItsPki_TestControl.ttcn @@ -12,7 +12,7 @@ module ItsPki_TestControl { execute(TC_SEC_PKI_ITSS_ENR_BV_01()); } - if (PICS_IUT_EA_ROLE) { + if (PICS_IUT_EA_ROLE or PICS_IUT_COMBINED_EA_AA_ROLE) { execute(TC_SEC_PKI_SND_EA_BV_01()); execute(TC_SEC_PKI_SND_EA_BV_02()); execute(TC_SEC_PKI_SND_EA_BV_03()); @@ -23,12 +23,17 @@ module ItsPki_TestControl { execute(TC_SEC_PKI_SND_EA_BV_08()); execute(TC_SEC_PKI_SND_EA_BV_09()); execute(TC_SEC_PKI_SND_EA_BV_10()); + execute(TC_SEC_PKI_SND_EA_BV_11()); + execute(TC_SEC_PKI_SND_EA_BV_12()); } - - if (PICS_IUT_AA_ROLE) { - execute(TC_SEC_PKI_SND_AA_BV_01()); - execute(TC_SEC_PKI_SND_AA_BV_02()); - execute(TC_SEC_PKI_SND_AA_BV_03()); + + if (PICS_IUT_COMBINED_EA_AA_ROLE) { + execute(TC_SEC_PKI_SND_EA_AA_BV_01()); + } + if (PICS_IUT_AA_ROLE) { + execute(TC_SEC_PKI_SND_AA_BV_01()); + execute(TC_SEC_PKI_SND_AA_BV_02()); + execute(TC_SEC_PKI_SND_AA_BV_03()); } } // End of 'control' statement diff --git a/ttcn/LibIts b/ttcn/LibIts index b745c0b23fc463ff118fc60c06831711651b77ec..b1e9bdd7e3007035abfa808cf21ea00c772aa127 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit b745c0b23fc463ff118fc60c06831711651b77ec +Subproject commit b1e9bdd7e3007035abfa808cf21ea00c772aa127 diff --git a/ttcn/TestCodec/TestCodec_Pki.ttcn b/ttcn/TestCodec/TestCodec_Pki.ttcn index b74b7b826ffbc8863ed8ac21471788209eb057a3..85690cbebde2240e0925db18a6b95be7874af09a 100644 --- a/ttcn/TestCodec/TestCodec_Pki.ttcn +++ b/ttcn/TestCodec/TestCodec_Pki.ttcn @@ -641,7 +641,7 @@ module TestCodec_Pki { setverdict(fail, "f_generate_ec_certificate"); stop; } - v_ret := false;//f_generate_inner_at_request(v_cert_iut_a_ea, v_hashed_id8_cert_iut_a_ea, v_ec_certificate, v_private_key, v_public_key_x, v_public_key_y, p_compressedMode, p_private_enc_key, v_publicEncKeyCompressed, v_compressedMode, v_inner_at_request); + v_ret := false;//f_generate_inner_at_request(v_cert_iut_a_ea, v_hashed_id8_cert_iut_a_ea, v_ec_certificate, v_private_key, v_public_key_x, v_public_key_y, p_compressed_mode, p_private_enc_key, v_publicEncKeyCompressed, v_compressedMode, v_inner_at_request); if (v_ret == true) { setverdict(pass); } else {