Loading ttcn/Security/LibItsSecurity_Functions.ttcn3 +141 −131 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ module LibItsSecurity_Functions { function f_buildSecuredMessagePayloadToBeSigned( in boolean p_includeCertificate := false ) runs on ItsSecurityBaseComponent return ToBeSignedSecuredMessage { // Local variables var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage; Loading @@ -147,7 +148,7 @@ module LibItsSecurity_Functions { ) }, // End of field HeaderFields { m_payload_unsecured( m_payload_signed( 'AAAAAAAAAA'O // To be replaced by TA with real payload ) }, // End of field HeaderFields Loading @@ -168,7 +169,7 @@ module LibItsSecurity_Functions { ) }, // End of field HeaderFields { m_payload_unsecured( m_payload_signed( 'AAAAAAAAAA'O // To be replaced by TA with real payload ) }, // End of field HeaderFields Loading @@ -195,6 +196,7 @@ module LibItsSecurity_Functions { in template (omit) HeaderFields p_headerFields := omit, in UInt8 p_securityProfile := 0 ) runs on ItsSecurityBaseComponent return boolean { // Local variables var octetstring v_secPayload, v_signature; var Oct32 v_hash; Loading @@ -206,8 +208,7 @@ module LibItsSecurity_Functions { // Prepare headers if (not(ispresent(p_headerFields))) { v_headerFields := p_mandatoryHeaders; } else { } else { // Merge p_headerFields and v_mandatoryHeaders into v_headerFields i := 0; // index for p_headerFields Loading @@ -228,7 +229,7 @@ module LibItsSecurity_Functions { // mandatory header already in p_HeaderFields break; } } } // End of 'for' statement if (n >= lengthof(p_headerFields)) { if (p_mandatoryHeaders[j].type_ != e_signer_info) { // Add headers from p_headerFields having lower number than mandatory header Loading @@ -243,14 +244,14 @@ module LibItsSecurity_Functions { k := k + 1; j := j + 1; } } } // End of 'for' statement // Add remaining headers from p_HeaderFields for ( i := i; i < lengthof(p_headerFields); i := i + 1) { // Add headers from p_headerFields having lower number than mandatory header v_headerFields[k] := valueof(p_headerFields[i]); k := k + 1; } } // End of 'for' statement } // Prepare payloads to be signed Loading @@ -258,7 +259,7 @@ module LibItsSecurity_Functions { if (p_payloadFields[i].type_ == e_signed or p_payloadFields[i].type_ == e_signed_and_encrypted) { v_toBeSignedPayloads[lengthof(v_toBeSignedPayloads)] := p_payloadFields[i]; } } } // End of 'for' statement v_toBeSignedSecuredMessage := m_toBeSignedSecuredMessage( p_securityProfile, Loading Loading @@ -317,6 +318,7 @@ module LibItsSecurity_Functions { in template (omit) charstring p_certificateName := omit, in boolean p_addMissingHeaders := true ) runs on ItsSecurityBaseComponent return boolean { // Local variables var Certificate v_aaCertificate, v_atCertificate; var HeaderFields v_mandatoryHeaders := {}; Loading Loading @@ -362,7 +364,7 @@ module LibItsSecurity_Functions { return f_buildGnSecuredMessage(p_securedMessage, p_payloadFields, v_mandatoryHeaders, p_headerFields, c_security_profileCAMs); } // end f_buildGnSecuredCam } // End of function f_buildGnSecuredCam /** * @desc This function build and sign the SecureMessage part covered by the signature process Loading @@ -384,6 +386,7 @@ module LibItsSecurity_Functions { in template (omit) charstring p_certificateName := omit, in boolean p_addMissingHeaders := true ) runs on ItsSecurityBaseComponent return boolean { // Local variables var Certificate v_aaCertificate, v_atCertificate; var HeaderFields v_mandatoryHeaders := {}; Loading Loading @@ -432,7 +435,7 @@ module LibItsSecurity_Functions { // Build the secured message and return it return f_buildGnSecuredMessage(p_securedMessage, p_payloadFields, v_mandatoryHeaders, p_headerFields, c_security_profileDENMs); } // end f_buildGnSecuredDenm } // End of function f_buildGnSecuredDenm /** * @desc This function build and sign the SecureMessage part covered by the signature process Loading Loading @@ -644,9 +647,8 @@ module LibItsSecurity_Functions { in template (value) SecuredMessage p_securedMessage, in template (value) Certificate p_certificate ) return boolean { var integer v_counter; for (v_counter := 0; v_counter < lengthof(p_certificate.subject_attributes); v_counter := v_counter + 1) { for (var integer v_counter := 0; v_counter < lengthof(p_certificate.subject_attributes); v_counter := v_counter + 1) { var SubjectAttribute v_subjectAttribute := valueof(p_certificate.subject_attributes[v_counter]); // log("f_verifyGnSecuredMessageSignatureWithCertificate: processing ", v_subjectAttribute); Loading Loading @@ -814,12 +816,14 @@ module LibItsSecurity_Functions { in ValidityRestrictionType p_type, out ValidityRestriction p_return ) return boolean { for (var integer i := 0; i < lengthof(p_cert.validity_restrictions); i := i + 1) { if (valueof(p_cert).validity_restrictions[i].type_ == p_type ) { p_return := valueof(p_cert).validity_restrictions[i]; return true; } } } // End of 'for' statement return false; } // End of function f_getCertificateValidityRestriction Loading Loading @@ -1032,13 +1036,16 @@ module LibItsSecurity_Functions { in template (value) RectangularRegion p_r1, in template (value) RectangularRegion p_r2 ) return boolean { return not ( valueof(p_r2).northwest.longitude > valueof(p_r1).southeast.longitude or valueof(p_r2).southeast.longitude < valueof(p_r1).northwest.longitude or valueof(p_r2).southeast.latitude > valueof(p_r1).northwest.latitude or valueof(p_r2).northwest.latitude < valueof(p_r1).southeast.latitude); return not ( valueof(p_r2).northwest.longitude > valueof(p_r1).southeast.longitude or valueof(p_r2).southeast.longitude < valueof(p_r1).northwest.longitude or valueof(p_r2).southeast.latitude > valueof(p_r1).northwest.latitude or valueof(p_r2).northwest.latitude < valueof(p_r1).southeast.latitude ); } // End of function f_isRectangularRegionsIntersected function f_isContinuousRectangularRegions(in template (value) RectangularRegions regions function f_isContinuousRectangularRegions( in template (value) RectangularRegions regions ) return boolean { // TODO: call external function return true; Loading Loading @@ -1149,7 +1156,8 @@ module LibItsSecurity_Functions { * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideCircularRegion(in template (value) CircularRegion p_region, function f_isLocationInsideCircularRegion( in template (value) CircularRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { // Sanity check Loading @@ -1175,8 +1183,8 @@ module LibItsSecurity_Functions { if (not isbound(p_region) or not isbound(p_location) or (lengthof(p_region) == 0)) { return false; } log("f_isLocationInsideRectangularRegion: p_polygonalArea: ", p_region); log("f_isLocationInsideRectangularRegion: p_location: ", p_location); // log("f_isLocationInsideRectangularRegion: p_polygonalArea: ", p_region); // log("f_isLocationInsideRectangularRegion: p_location: ", p_location); return fx_isLocationInsideRectangularRegion(valueof(p_region), valueof(p_location)); } // End of function f_isLocationInsideRectangularRegion Loading Loading @@ -1270,8 +1278,9 @@ module LibItsSecurity_Functions { * @return The converted latitude * @verdict Unchanged */ function f_ddlat2int(in float p_latitude) return WGSLatitude { function f_ddlat2int( in float p_latitude ) return WGSLatitude { return float2int(p_latitude * 10000000.0); // Significand length shall be 7 digits length } Loading @@ -1281,8 +1290,9 @@ module LibItsSecurity_Functions { * @return The converted longitude * @verdict Unchanged */ function f_ddlon2int(in float p_longitude) return WGSLongitude { function f_ddlon2int( in float p_longitude ) return WGSLongitude { return float2int(p_longitude * 1000000.0); // Significand length shall be 6 digits length } Loading ttcn/Security/LibItsSecurity_Pixits.ttcn3 +0 −8 Original line number Diff line number Diff line Loading @@ -7,14 +7,6 @@ */ module LibItsSecurity_Pixits { // LibCommon import from LibCommon_BasicTypesAndValues all; import from LibCommon_DataStrings all; // LibItsSecurity import from LibItsSecurity_TypesAndValues all; import from LibItsSecurity_Templates all; /** * @desc Root path to access certificate stored in files, identified by certficate ID */ Loading Loading
ttcn/Security/LibItsSecurity_Functions.ttcn3 +141 −131 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ module LibItsSecurity_Functions { function f_buildSecuredMessagePayloadToBeSigned( in boolean p_includeCertificate := false ) runs on ItsSecurityBaseComponent return ToBeSignedSecuredMessage { // Local variables var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage; Loading @@ -147,7 +148,7 @@ module LibItsSecurity_Functions { ) }, // End of field HeaderFields { m_payload_unsecured( m_payload_signed( 'AAAAAAAAAA'O // To be replaced by TA with real payload ) }, // End of field HeaderFields Loading @@ -168,7 +169,7 @@ module LibItsSecurity_Functions { ) }, // End of field HeaderFields { m_payload_unsecured( m_payload_signed( 'AAAAAAAAAA'O // To be replaced by TA with real payload ) }, // End of field HeaderFields Loading @@ -195,6 +196,7 @@ module LibItsSecurity_Functions { in template (omit) HeaderFields p_headerFields := omit, in UInt8 p_securityProfile := 0 ) runs on ItsSecurityBaseComponent return boolean { // Local variables var octetstring v_secPayload, v_signature; var Oct32 v_hash; Loading @@ -206,8 +208,7 @@ module LibItsSecurity_Functions { // Prepare headers if (not(ispresent(p_headerFields))) { v_headerFields := p_mandatoryHeaders; } else { } else { // Merge p_headerFields and v_mandatoryHeaders into v_headerFields i := 0; // index for p_headerFields Loading @@ -228,7 +229,7 @@ module LibItsSecurity_Functions { // mandatory header already in p_HeaderFields break; } } } // End of 'for' statement if (n >= lengthof(p_headerFields)) { if (p_mandatoryHeaders[j].type_ != e_signer_info) { // Add headers from p_headerFields having lower number than mandatory header Loading @@ -243,14 +244,14 @@ module LibItsSecurity_Functions { k := k + 1; j := j + 1; } } } // End of 'for' statement // Add remaining headers from p_HeaderFields for ( i := i; i < lengthof(p_headerFields); i := i + 1) { // Add headers from p_headerFields having lower number than mandatory header v_headerFields[k] := valueof(p_headerFields[i]); k := k + 1; } } // End of 'for' statement } // Prepare payloads to be signed Loading @@ -258,7 +259,7 @@ module LibItsSecurity_Functions { if (p_payloadFields[i].type_ == e_signed or p_payloadFields[i].type_ == e_signed_and_encrypted) { v_toBeSignedPayloads[lengthof(v_toBeSignedPayloads)] := p_payloadFields[i]; } } } // End of 'for' statement v_toBeSignedSecuredMessage := m_toBeSignedSecuredMessage( p_securityProfile, Loading Loading @@ -317,6 +318,7 @@ module LibItsSecurity_Functions { in template (omit) charstring p_certificateName := omit, in boolean p_addMissingHeaders := true ) runs on ItsSecurityBaseComponent return boolean { // Local variables var Certificate v_aaCertificate, v_atCertificate; var HeaderFields v_mandatoryHeaders := {}; Loading Loading @@ -362,7 +364,7 @@ module LibItsSecurity_Functions { return f_buildGnSecuredMessage(p_securedMessage, p_payloadFields, v_mandatoryHeaders, p_headerFields, c_security_profileCAMs); } // end f_buildGnSecuredCam } // End of function f_buildGnSecuredCam /** * @desc This function build and sign the SecureMessage part covered by the signature process Loading @@ -384,6 +386,7 @@ module LibItsSecurity_Functions { in template (omit) charstring p_certificateName := omit, in boolean p_addMissingHeaders := true ) runs on ItsSecurityBaseComponent return boolean { // Local variables var Certificate v_aaCertificate, v_atCertificate; var HeaderFields v_mandatoryHeaders := {}; Loading Loading @@ -432,7 +435,7 @@ module LibItsSecurity_Functions { // Build the secured message and return it return f_buildGnSecuredMessage(p_securedMessage, p_payloadFields, v_mandatoryHeaders, p_headerFields, c_security_profileDENMs); } // end f_buildGnSecuredDenm } // End of function f_buildGnSecuredDenm /** * @desc This function build and sign the SecureMessage part covered by the signature process Loading Loading @@ -644,9 +647,8 @@ module LibItsSecurity_Functions { in template (value) SecuredMessage p_securedMessage, in template (value) Certificate p_certificate ) return boolean { var integer v_counter; for (v_counter := 0; v_counter < lengthof(p_certificate.subject_attributes); v_counter := v_counter + 1) { for (var integer v_counter := 0; v_counter < lengthof(p_certificate.subject_attributes); v_counter := v_counter + 1) { var SubjectAttribute v_subjectAttribute := valueof(p_certificate.subject_attributes[v_counter]); // log("f_verifyGnSecuredMessageSignatureWithCertificate: processing ", v_subjectAttribute); Loading Loading @@ -814,12 +816,14 @@ module LibItsSecurity_Functions { in ValidityRestrictionType p_type, out ValidityRestriction p_return ) return boolean { for (var integer i := 0; i < lengthof(p_cert.validity_restrictions); i := i + 1) { if (valueof(p_cert).validity_restrictions[i].type_ == p_type ) { p_return := valueof(p_cert).validity_restrictions[i]; return true; } } } // End of 'for' statement return false; } // End of function f_getCertificateValidityRestriction Loading Loading @@ -1032,13 +1036,16 @@ module LibItsSecurity_Functions { in template (value) RectangularRegion p_r1, in template (value) RectangularRegion p_r2 ) return boolean { return not ( valueof(p_r2).northwest.longitude > valueof(p_r1).southeast.longitude or valueof(p_r2).southeast.longitude < valueof(p_r1).northwest.longitude or valueof(p_r2).southeast.latitude > valueof(p_r1).northwest.latitude or valueof(p_r2).northwest.latitude < valueof(p_r1).southeast.latitude); return not ( valueof(p_r2).northwest.longitude > valueof(p_r1).southeast.longitude or valueof(p_r2).southeast.longitude < valueof(p_r1).northwest.longitude or valueof(p_r2).southeast.latitude > valueof(p_r1).northwest.latitude or valueof(p_r2).northwest.latitude < valueof(p_r1).southeast.latitude ); } // End of function f_isRectangularRegionsIntersected function f_isContinuousRectangularRegions(in template (value) RectangularRegions regions function f_isContinuousRectangularRegions( in template (value) RectangularRegions regions ) return boolean { // TODO: call external function return true; Loading Loading @@ -1149,7 +1156,8 @@ module LibItsSecurity_Functions { * @return true on success, false otherwise * @verdict Unchanged */ function f_isLocationInsideCircularRegion(in template (value) CircularRegion p_region, function f_isLocationInsideCircularRegion( in template (value) CircularRegion p_region, in template (value) ThreeDLocation p_location ) return boolean { // Sanity check Loading @@ -1175,8 +1183,8 @@ module LibItsSecurity_Functions { if (not isbound(p_region) or not isbound(p_location) or (lengthof(p_region) == 0)) { return false; } log("f_isLocationInsideRectangularRegion: p_polygonalArea: ", p_region); log("f_isLocationInsideRectangularRegion: p_location: ", p_location); // log("f_isLocationInsideRectangularRegion: p_polygonalArea: ", p_region); // log("f_isLocationInsideRectangularRegion: p_location: ", p_location); return fx_isLocationInsideRectangularRegion(valueof(p_region), valueof(p_location)); } // End of function f_isLocationInsideRectangularRegion Loading Loading @@ -1270,8 +1278,9 @@ module LibItsSecurity_Functions { * @return The converted latitude * @verdict Unchanged */ function f_ddlat2int(in float p_latitude) return WGSLatitude { function f_ddlat2int( in float p_latitude ) return WGSLatitude { return float2int(p_latitude * 10000000.0); // Significand length shall be 7 digits length } Loading @@ -1281,8 +1290,9 @@ module LibItsSecurity_Functions { * @return The converted longitude * @verdict Unchanged */ function f_ddlon2int(in float p_longitude) return WGSLongitude { function f_ddlon2int( in float p_longitude ) return WGSLongitude { return float2int(p_longitude * 1000000.0); // Significand length shall be 6 digits length } Loading
ttcn/Security/LibItsSecurity_Pixits.ttcn3 +0 −8 Original line number Diff line number Diff line Loading @@ -7,14 +7,6 @@ */ module LibItsSecurity_Pixits { // LibCommon import from LibCommon_BasicTypesAndValues all; import from LibCommon_DataStrings all; // LibItsSecurity import from LibItsSecurity_TypesAndValues all; import from LibItsSecurity_Templates all; /** * @desc Root path to access certificate stored in files, identified by certficate ID */ Loading