From bf548622aec06cafeb5615f4750d5ef980a118bf Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 16 Mar 2022 16:53:00 +0100 Subject: [PATCH 1/4] Validate ITS-S enrolment/authorization --- ttcn/Http/LibItsHttp_BinaryMessageBodyTypes.ttcn | 1 + ttcn/Http/LibItsHttp_BinaryTemplates.ttcn | 12 ++++++++++++ ttcn/Http/LibItsHttp_Templates.ttcn | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/ttcn/Http/LibItsHttp_BinaryMessageBodyTypes.ttcn b/ttcn/Http/LibItsHttp_BinaryMessageBodyTypes.ttcn index 8b2b26d0..fc2f78be 100644 --- a/ttcn/Http/LibItsHttp_BinaryMessageBodyTypes.ttcn +++ b/ttcn/Http/LibItsHttp_BinaryMessageBodyTypes.ttcn @@ -26,6 +26,7 @@ module LibItsHttp_BinaryMessageBodyTypes { type union BinaryBody { // TODO Add here your custom variants Ieee1609Dot2Data ieee1609dot2_data, + Certificate ieee1609dot2_certificate, octetstring raw } with { variant "" diff --git a/ttcn/Http/LibItsHttp_BinaryTemplates.ttcn b/ttcn/Http/LibItsHttp_BinaryTemplates.ttcn index d988cfad..a50f50b8 100644 --- a/ttcn/Http/LibItsHttp_BinaryTemplates.ttcn +++ b/ttcn/Http/LibItsHttp_BinaryTemplates.ttcn @@ -47,4 +47,16 @@ module LibItsHttp_BinaryTemplates { ieee1609dot2_data := p_ieee1609dot2_data } // End of template mw_binary_body_ieee1609dot2_data + template (value) BinaryBody m_binary_body_ieee1609dot2_certificate( + in template (value) CertificateBase p_ieee1609dot2_certificate + ) := { + ieee1609dot2_certificate := p_ieee1609dot2_certificate + } // End of template m_binary_body_ieee1609dot2_certificate + + template (present) BinaryBody mw_binary_body_ieee1609dot2_certificate( + template (present) CertificateBase p_ieee1609dot2_certificate := ? + ) := { + ieee1609dot2_certificate := p_ieee1609dot2_certificate + } // End of template mw_binary_body_ieee1609dot2_certificate + } // End of module LibItsHttp_BinaryTemplates diff --git a/ttcn/Http/LibItsHttp_Templates.ttcn b/ttcn/Http/LibItsHttp_Templates.ttcn index a8c27d76..cfd589dd 100644 --- a/ttcn/Http/LibItsHttp_Templates.ttcn +++ b/ttcn/Http/LibItsHttp_Templates.ttcn @@ -257,6 +257,13 @@ module LibItsHttp_Templates { body := omit } // End of template m_http_response_ko_no_body + template (value) Response m_http_response_500_internal_error( + in template (value) Headers p_header, + in template (value) integer p_statuscode := 500, + in template (value) charstring p_statustext := "Internal Error" + ) modifies m_http_response_ko_no_body := { + } // End of template m_http_response_ko + template (present) Response mw_http_response_ko_no_body( template (present) Headers p_header := ?, template (present) integer p_statuscode := 404, -- GitLab From 5e2726ae7230c722263dc1d875db10893f6a073e Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 31 Mar 2022 15:19:09 +0200 Subject: [PATCH 2/4] CV2X#3 Validation against PKIs --- ttcn/Http/LibItsHttp_Functions.ttcn | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ttcn/Http/LibItsHttp_Functions.ttcn b/ttcn/Http/LibItsHttp_Functions.ttcn index c1abcf32..dbe069db 100644 --- a/ttcn/Http/LibItsHttp_Functions.ttcn +++ b/ttcn/Http/LibItsHttp_Functions.ttcn @@ -145,6 +145,32 @@ module LibItsHttp_Functions { } // End of 'for' statement } // End of function f_get_header + /** + * @desc Check HTTP response headers + * @param p_headers The HTTP headers + * @param p_value the expected va;ue + * @return true on success, false otherwise + */ + function f_check_headers( + in Headers p_headers, + in charstring p_header_name := "Location", + in template (present) charstring p_value := ? + ) return boolean { + // Local variables + var boolean v_header_matched := false; + + for (var integer v_idx := 0; v_idx < lengthof(p_headers); v_idx := v_idx + 1) { + if (p_headers[v_idx].header_name == p_header_name) { + if (match(p_headers[v_idx].header_value[0], p_value) == true) { + v_header_matched := true; + } // else, nothing to do + break; + } + } // End of 'for' statement + + return v_header_matched; + } // End of function f_check_headers + } // End of group http_headers } // End of module LibItsHttp_Functions -- GitLab From 735e79877b87097c2476bdcf4a71bf48fafdc737 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Fri, 22 Apr 2022 16:04:32 +0200 Subject: [PATCH 3/4] CV2X#3 Validation against PKIs (Remote) --- ttcn/Common/LibItsCommon_TypesAndValues.ttcn | 1 + 1 file changed, 1 insertion(+) diff --git a/ttcn/Common/LibItsCommon_TypesAndValues.ttcn b/ttcn/Common/LibItsCommon_TypesAndValues.ttcn index 4bf65e49..2057961a 100644 --- a/ttcn/Common/LibItsCommon_TypesAndValues.ttcn +++ b/ttcn/Common/LibItsCommon_TypesAndValues.ttcn @@ -204,6 +204,7 @@ module LibItsCommon_TypesAndValues { const integer c_its_aid_TLS := 140; const integer c_its_aid_GN := 141; const integer c_its_aid_SCR := 623; // Secured Certificate Request, https://standards.ieee.org/products-services/regauth/psid/public.html + const integer c_its_aid_CPOC := 624; // ETSI TS 102 941 Clause 6.4 Generation and distribution of TLM / RCA Link Certificates } } with { -- GitLab From d4311521a528842673b0b0c0404cfe38649f16ed Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 27 Apr 2022 16:28:24 +0200 Subject: [PATCH 4/4] CV2X#3 Validation against PKIs (Remote) --- ttcn/Common/LibItsCommon_Functions.ttcn | 2 +- ttcn/Common/LibItsCommon_TypesAndValues.ttcn | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ttcn/Common/LibItsCommon_Functions.ttcn b/ttcn/Common/LibItsCommon_Functions.ttcn index 9df9cb57..7424c484 100644 --- a/ttcn/Common/LibItsCommon_Functions.ttcn +++ b/ttcn/Common/LibItsCommon_Functions.ttcn @@ -119,7 +119,7 @@ module LibItsCommon_Functions { /** * @desc Gets the current time since 01/01/1970 in UTC format - * @return The current time since 01/01/1970 in UTC format + * @return The current time since 01/01/1970 in UTC format in milliseconds */ function f_getCurrentTimeUtc() return UInt64 { var UInt64 v_time := 0; diff --git a/ttcn/Common/LibItsCommon_TypesAndValues.ttcn b/ttcn/Common/LibItsCommon_TypesAndValues.ttcn index 2057961a..33179129 100644 --- a/ttcn/Common/LibItsCommon_TypesAndValues.ttcn +++ b/ttcn/Common/LibItsCommon_TypesAndValues.ttcn @@ -203,6 +203,7 @@ module LibItsCommon_TypesAndValues { const integer c_its_aid_TLC := 140; const integer c_its_aid_TLS := 140; const integer c_its_aid_GN := 141; + const integer c_its_aid_CRL := 622; // ETSI TS 102 941 Clause 6.4 Generation and distribution of TLM / RCA Link Certificates const integer c_its_aid_SCR := 623; // Secured Certificate Request, https://standards.ieee.org/products-services/regauth/psid/public.html const integer c_its_aid_CPOC := 624; // ETSI TS 102 941 Clause 6.4 Generation and distribution of TLM / RCA Link Certificates } -- GitLab