Loading ttcn/CAM/LibItsCam_Functions.ttcn +17 −0 Original line number Diff line number Diff line Loading @@ -245,4 +245,21 @@ module LibItsCam_Functions { } // end group camPositionFunctions group camGenerators { function f_generateDefaultCam() return octetstring { return bit2oct( encvalue( m_camReq( m_camMsg_vehicle( f_getTsStationId(), f_getCurrentTime(), // FIXIT: must be deltatime m_tsPosition ) ) ) ); } } // end of group camGenerators } // end LibItsCam_Functions No newline at end of file ttcn/GeoNetworking/LibItsGeoNetworking_Functions.ttcn +67 −18 Original line number Diff line number Diff line Loading @@ -2379,11 +2379,12 @@ module LibItsGeoNetworking_Functions { } return v_ret; } /** * @desc Ask for the certificate chain and wait for GN message with security containing certificate chain as a signer info * @return the certificate chain used for sign received message */ function f_askAndWaitForCertificateChain (out CertificateChain p_chain) function f_askForCertificateChain (in template(value) octetstring p_CamPayload) runs on ItsGeoNetworking return boolean { var SecuredMessage v_recv; Loading @@ -2394,7 +2395,34 @@ module LibItsGeoNetworking_Functions { if(f_getMsgSignerInfo(v_recv, v_si)) { if(f_getCertificateSignerInfo(v_si.signerInfo.certificate, v_si)) { if(match (v_si.type_, e_certificate_digest_with_ecdsap256)) { f_askForCertificate(v_si.signerInfo.digest); f_sendCertificateRequest(v_si.signerInfo.digest, p_CamPayload); if(tc_ac.running){ tc_ac.stop;tc_ac.start; } v_ret := true; } } } } } return v_ret; } /** * @desc Ask for the certificate chain and wait for GN message with security containing certificate chain as a signer info * @return the certificate chain used for sign received message */ function f_askAndWaitForCertificateChain (out CertificateChain p_chain, in template(value) octetstring p_CamPayload) runs on ItsGeoNetworking return boolean { var SecuredMessage v_recv; var SignerInfo v_si; var boolean v_ret := false; alt { [] a_securedMessageWithCertificate(v_recv) { if(f_getMsgSignerInfo(v_recv, v_si)) { if(f_getCertificateSignerInfo(v_si.signerInfo.certificate, v_si)) { if(match (v_si.type_, e_certificate_digest_with_ecdsap256)) { f_sendCertificateRequest(v_si.signerInfo.digest, p_CamPayload); if(tc_ac.running){ tc_ac.stop;tc_ac.start; } Loading @@ -2413,6 +2441,7 @@ module LibItsGeoNetworking_Functions { return v_ret; } /** * @desc Wait for GN message with security containing digest as a signer info * @return the digest of the certificate been used to sign received message Loading @@ -2438,23 +2467,43 @@ module LibItsGeoNetworking_Functions { group CertRequests{ function f_askForCertificate (in template (value) HashedId8 p_digest) { // FIXME Move to GeoNet // Send CAM message with insert the request_unrecognized_certificate // header containing specified digest /* TODO: Waiting Alex to understand how to send message var SecuredMessage v_msg; function f_sendCertificateRequest ( in template (value) HashedId8 p_digest, in template (value) octetstring p_payload ) runs on ItsGeoNetworking { var GeoNetworkingReq v_gnReq; var GnNonSecuredPacket v_gnNonSecuredPacket; var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage; var template (value) SecuredMessage v_securedMessage; // Build signed SecuredMessage v_gnNonSecuredPacket := m_geoNwShbPacket( f_getPosition(c_compMTC) ); // Add CAM payload v_gnNonSecuredPacket.payload := f_adaptPayload_m(p_payload); f_buildGnSecuredCam( v_securedMessage, bit2oct(encvalue(v_gnNonSecuredPacket)), true, { m_header_field_digest(f_HashedId3FromHashedId8(p_digest)) } ); if ( f_buildGnSecuredCam (v_msg, in octetstring p_unsecuredPayload, in ThreeDLocation p_threeDLocation, in template (omit) HeaderFields p_headerFileds := omit )) { // Build secured Gn packet v_gnReq := m_geoNwReq_linkLayerBroadcast( m_geoNwSecPdu( v_gnNonSecuredPacket, v_securedMessage ) // End of template m_geoNwSecPdu ); // End of template m_geoNwReq_linkLayerBroadcast // Send Message f_sendGeoNetMessage(v_gnReq); } */ } // End of function f_askForCertificate } // End of function f_sendCertificateRequest } // End of group CertRequests Loading ttcn/Security/LibItsSecurity_Functions.ttcn3 +2 −9 Original line number Diff line number Diff line Loading @@ -164,7 +164,6 @@ module LibItsSecurity_Functions { function f_buildGnSecuredCam( out template (value) SecuredMessage p_securedMessage, in octetstring p_unsecuredPayload, in ThreeDLocation p_threeDLocation, in template (omit) boolean p_addCertificate := false, in template (omit) HeaderFields p_headerFields := omit ) return boolean { Loading @@ -175,7 +174,7 @@ module LibItsSecurity_Functions { var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage; // Create SecuredMessage payload to be signed if (valueof(p_addCertificate) == true) { // Add the AA certificate if (valueof(p_addCertificate) == true) { // Add the AT certificate v_toBeSignedSecuredMessage := m_toBeSignedSecuredMessage( c_security_profileCAMs, { // Field HeaderFields Loading @@ -185,9 +184,6 @@ module LibItsSecurity_Functions { ) // End of template m_signerInfo_certificate ), // End of template m_header_field_signer_info m_header_field_generation_time(f_getCurrentTime()), m_header_field_generation_location( p_threeDLocation ), m_header_field_message_type(c_messageType_CAM) }, // End of field HeaderFields { Loading @@ -197,7 +193,7 @@ module LibItsSecurity_Functions { }, // End of field HeaderFields e_signature ); } else { // Add the AA certificate digest } else { // Add the AT certificate digest v_toBeSignedSecuredMessage := m_toBeSignedSecuredMessage( c_security_profileCAMs, { // Field HeaderFields Loading @@ -207,9 +203,6 @@ module LibItsSecurity_Functions { ) // End of template m_signerInfo_digest ), // End of template m_header_field_digest m_header_field_generation_time(f_getCurrentTime()), m_header_field_generation_location( p_threeDLocation ), m_header_field_message_type(c_messageType_CAM) }, // End of field HeaderFields { Loading Loading
ttcn/CAM/LibItsCam_Functions.ttcn +17 −0 Original line number Diff line number Diff line Loading @@ -245,4 +245,21 @@ module LibItsCam_Functions { } // end group camPositionFunctions group camGenerators { function f_generateDefaultCam() return octetstring { return bit2oct( encvalue( m_camReq( m_camMsg_vehicle( f_getTsStationId(), f_getCurrentTime(), // FIXIT: must be deltatime m_tsPosition ) ) ) ); } } // end of group camGenerators } // end LibItsCam_Functions No newline at end of file
ttcn/GeoNetworking/LibItsGeoNetworking_Functions.ttcn +67 −18 Original line number Diff line number Diff line Loading @@ -2379,11 +2379,12 @@ module LibItsGeoNetworking_Functions { } return v_ret; } /** * @desc Ask for the certificate chain and wait for GN message with security containing certificate chain as a signer info * @return the certificate chain used for sign received message */ function f_askAndWaitForCertificateChain (out CertificateChain p_chain) function f_askForCertificateChain (in template(value) octetstring p_CamPayload) runs on ItsGeoNetworking return boolean { var SecuredMessage v_recv; Loading @@ -2394,7 +2395,34 @@ module LibItsGeoNetworking_Functions { if(f_getMsgSignerInfo(v_recv, v_si)) { if(f_getCertificateSignerInfo(v_si.signerInfo.certificate, v_si)) { if(match (v_si.type_, e_certificate_digest_with_ecdsap256)) { f_askForCertificate(v_si.signerInfo.digest); f_sendCertificateRequest(v_si.signerInfo.digest, p_CamPayload); if(tc_ac.running){ tc_ac.stop;tc_ac.start; } v_ret := true; } } } } } return v_ret; } /** * @desc Ask for the certificate chain and wait for GN message with security containing certificate chain as a signer info * @return the certificate chain used for sign received message */ function f_askAndWaitForCertificateChain (out CertificateChain p_chain, in template(value) octetstring p_CamPayload) runs on ItsGeoNetworking return boolean { var SecuredMessage v_recv; var SignerInfo v_si; var boolean v_ret := false; alt { [] a_securedMessageWithCertificate(v_recv) { if(f_getMsgSignerInfo(v_recv, v_si)) { if(f_getCertificateSignerInfo(v_si.signerInfo.certificate, v_si)) { if(match (v_si.type_, e_certificate_digest_with_ecdsap256)) { f_sendCertificateRequest(v_si.signerInfo.digest, p_CamPayload); if(tc_ac.running){ tc_ac.stop;tc_ac.start; } Loading @@ -2413,6 +2441,7 @@ module LibItsGeoNetworking_Functions { return v_ret; } /** * @desc Wait for GN message with security containing digest as a signer info * @return the digest of the certificate been used to sign received message Loading @@ -2438,23 +2467,43 @@ module LibItsGeoNetworking_Functions { group CertRequests{ function f_askForCertificate (in template (value) HashedId8 p_digest) { // FIXME Move to GeoNet // Send CAM message with insert the request_unrecognized_certificate // header containing specified digest /* TODO: Waiting Alex to understand how to send message var SecuredMessage v_msg; function f_sendCertificateRequest ( in template (value) HashedId8 p_digest, in template (value) octetstring p_payload ) runs on ItsGeoNetworking { var GeoNetworkingReq v_gnReq; var GnNonSecuredPacket v_gnNonSecuredPacket; var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage; var template (value) SecuredMessage v_securedMessage; // Build signed SecuredMessage v_gnNonSecuredPacket := m_geoNwShbPacket( f_getPosition(c_compMTC) ); // Add CAM payload v_gnNonSecuredPacket.payload := f_adaptPayload_m(p_payload); f_buildGnSecuredCam( v_securedMessage, bit2oct(encvalue(v_gnNonSecuredPacket)), true, { m_header_field_digest(f_HashedId3FromHashedId8(p_digest)) } ); if ( f_buildGnSecuredCam (v_msg, in octetstring p_unsecuredPayload, in ThreeDLocation p_threeDLocation, in template (omit) HeaderFields p_headerFileds := omit )) { // Build secured Gn packet v_gnReq := m_geoNwReq_linkLayerBroadcast( m_geoNwSecPdu( v_gnNonSecuredPacket, v_securedMessage ) // End of template m_geoNwSecPdu ); // End of template m_geoNwReq_linkLayerBroadcast // Send Message f_sendGeoNetMessage(v_gnReq); } */ } // End of function f_askForCertificate } // End of function f_sendCertificateRequest } // End of group CertRequests Loading
ttcn/Security/LibItsSecurity_Functions.ttcn3 +2 −9 Original line number Diff line number Diff line Loading @@ -164,7 +164,6 @@ module LibItsSecurity_Functions { function f_buildGnSecuredCam( out template (value) SecuredMessage p_securedMessage, in octetstring p_unsecuredPayload, in ThreeDLocation p_threeDLocation, in template (omit) boolean p_addCertificate := false, in template (omit) HeaderFields p_headerFields := omit ) return boolean { Loading @@ -175,7 +174,7 @@ module LibItsSecurity_Functions { var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage; // Create SecuredMessage payload to be signed if (valueof(p_addCertificate) == true) { // Add the AA certificate if (valueof(p_addCertificate) == true) { // Add the AT certificate v_toBeSignedSecuredMessage := m_toBeSignedSecuredMessage( c_security_profileCAMs, { // Field HeaderFields Loading @@ -185,9 +184,6 @@ module LibItsSecurity_Functions { ) // End of template m_signerInfo_certificate ), // End of template m_header_field_signer_info m_header_field_generation_time(f_getCurrentTime()), m_header_field_generation_location( p_threeDLocation ), m_header_field_message_type(c_messageType_CAM) }, // End of field HeaderFields { Loading @@ -197,7 +193,7 @@ module LibItsSecurity_Functions { }, // End of field HeaderFields e_signature ); } else { // Add the AA certificate digest } else { // Add the AT certificate digest v_toBeSignedSecuredMessage := m_toBeSignedSecuredMessage( c_security_profileCAMs, { // Field HeaderFields Loading @@ -207,9 +203,6 @@ module LibItsSecurity_Functions { ) // End of template m_signerInfo_digest ), // End of template m_header_field_digest m_header_field_generation_time(f_getCurrentTime()), m_header_field_generation_location( p_threeDLocation ), m_header_field_message_type(c_messageType_CAM) }, // End of field HeaderFields { Loading