Loading ttcn/GeoNetworking/LibItsGeoNetworking_Functions.ttcn +39 −37 Original line number Diff line number Diff line Loading @@ -2342,57 +2342,57 @@ module LibItsGeoNetworking_Functions { * @desc Wait for GN message with security containing certificate as a signer info * @return the certificate used for sign received message */ function f_waitForCertificate () function f_waitForCertificate (out Certificate p_cert) runs on ItsGeoNetworking return Certificate { return boolean { var SecuredMessage v_recv; var Certificate v_cert; var boolean v_ret := false; alt { [] a_securedMessageWithCertificate(v_recv){ var SignerInfo v_si; f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_cert := v_si.signerInfo.certificate if(f_getMsgSignerInfo(v_recv, v_si)){ p_cert := v_si.signerInfo.certificate; v_ret := true; } } } return v_cert; return v_ret; } /** * @desc Wait for GN message with security containing certificate chain as a signer info * @return the certificate used for sign received message */ function f_waitForCertificateChain () function f_waitForCertificateChain (out CertificateChain p_chain) runs on ItsGeoNetworking return CertificateChain { return boolean { var SecuredMessage v_recv; var CertificateChain v_chain; var boolean v_ret := false; alt { [] a_securedMessageWithCertificateChain(v_recv){ var SignerInfo v_si; f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_chain := v_si.signerInfo.certificates; if(f_getMsgSignerInfo(v_recv, v_si)){ p_chain := v_si.signerInfo.certificates; v_ret := true; } } } return v_chain; 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 () function f_askAndWaitForCertificateChain (out CertificateChain p_chain) runs on ItsGeoNetworking return CertificateChain { var CertificateChain v_chain := null; return boolean { var SecuredMessage v_recv; var SignerInfo v_si; var boolean v_ret := false; alt { [] a_securedMessageWithCertificate(v_recv) { f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_si := f_getCertificateSignerInfo(v_si.signerInfo.certificate); 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); if(tc_ac.running){ Loading @@ -2402,34 +2402,36 @@ module LibItsGeoNetworking_Functions { } } } } [] a_securedMessageWithCertificateChain(v_recv){ f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_chain := v_si.signerInfo.certificates; if(f_getMsgSignerInfo(v_recv, v_si)){ p_chain := v_si.signerInfo.certificates; v_ret := true; } } } return v_chain; 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 */ function f_waitForDigest () function f_waitForDigest ( out HashedId8 p_digest) runs on ItsGeoNetworking return HashedId8 { return boolean { var SecuredMessage v_recv; var HashedId8 v_digest; var boolean v_ret := false; alt { [] a_securedMessageWithDigest(v_recv){ var SignerInfo v_si; f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_digest := v_si.signerInfo.digest; if(f_getMsgSignerInfo(v_recv, v_si)) { p_digest := v_si.signerInfo.digest; v_ret := true; } } } return v_digest; return v_ret; } } Loading ttcn/Security/LibItsSecurity_Functions.ttcn3 +33 −33 Original line number Diff line number Diff line Loading @@ -557,20 +557,18 @@ module LibItsSecurity_Functions { */ function f_getMsgHeaderField( in template (value) SecuredMessage p_securedMessage, in HeaderFieldType p_headerFieldType ) return HeaderField { var HeaderField v_return; in HeaderFieldType p_headerFieldType, out HeaderField p_return ) return boolean { var integer v_length := lengthof(p_securedMessage.header_fields); var integer v_index; for (v_index := 0; v_index < v_length; v_index := v_index + 1) { if (valueof(p_securedMessage).header_fields[v_index].type_ == p_headerFieldType) { v_return := valueof(p_securedMessage).header_fields[v_index]; break; for (var integer i := 0; i < v_length; i := i + 1) { if (valueof(p_securedMessage).header_fields[i].type_ == p_headerFieldType) { p_return := valueof(p_securedMessage).header_fields[i]; return true; } } return v_return; return false; } /** Loading @@ -579,12 +577,15 @@ module LibItsSecurity_Functions { function f_getMsgSignerInfo ( in template (value) SecuredMessage p_securedMessage, out SignerInfo p_signerInfo ) { var HeaderField v_hf := f_getMsgHeaderField(p_securedMessage, e_signer_info); if (isbound(v_hf)) { ) return boolean { var HeaderField v_hf; if(f_getMsgHeaderField(p_securedMessage, e_signer_info, v_hf)){ if(isbound(v_hf.headerField.signer)){ p_signerInfo := v_hf.headerField.signer; return true; } } return false; } }// End of group messageGetters Loading @@ -593,29 +594,28 @@ module LibItsSecurity_Functions { function f_getCertificateValidityRestriction( in template (value) Certificate p_cert, in ValidityRestrictionType p_type ) return ValidityRestriction { var ValidityRestriction v_return; var integer v_length := lengthof(p_cert.validity_restrictions); var integer v_index; for (v_index := 0; v_index < v_length; v_index := v_index + 1) { if (valueof(p_cert).validity_restrictions[v_index].type_ == p_type ) { v_return := valueof(p_cert).validity_restrictions[v_index]; break; 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; } } return v_return; return false; } function f_getCertificateSignerInfo ( in template (value) Certificate p_cert ) return SignerInfo { var SignerInfo ret; if (lengthof(p_cert.signer_infos) > 0) { ret := valueof(p_cert).signer_infos[0]; in template (value) Certificate p_cert, out SignerInfo p_si ) return boolean { if( isbound(valueof(p_cert).signer_infos) and lengthof(p_cert.signer_infos) > 0) { p_si := valueof(p_cert).signer_infos[0]; return true; } return ret; return false; } }// End of group certificateGetters Loading Loading
ttcn/GeoNetworking/LibItsGeoNetworking_Functions.ttcn +39 −37 Original line number Diff line number Diff line Loading @@ -2342,57 +2342,57 @@ module LibItsGeoNetworking_Functions { * @desc Wait for GN message with security containing certificate as a signer info * @return the certificate used for sign received message */ function f_waitForCertificate () function f_waitForCertificate (out Certificate p_cert) runs on ItsGeoNetworking return Certificate { return boolean { var SecuredMessage v_recv; var Certificate v_cert; var boolean v_ret := false; alt { [] a_securedMessageWithCertificate(v_recv){ var SignerInfo v_si; f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_cert := v_si.signerInfo.certificate if(f_getMsgSignerInfo(v_recv, v_si)){ p_cert := v_si.signerInfo.certificate; v_ret := true; } } } return v_cert; return v_ret; } /** * @desc Wait for GN message with security containing certificate chain as a signer info * @return the certificate used for sign received message */ function f_waitForCertificateChain () function f_waitForCertificateChain (out CertificateChain p_chain) runs on ItsGeoNetworking return CertificateChain { return boolean { var SecuredMessage v_recv; var CertificateChain v_chain; var boolean v_ret := false; alt { [] a_securedMessageWithCertificateChain(v_recv){ var SignerInfo v_si; f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_chain := v_si.signerInfo.certificates; if(f_getMsgSignerInfo(v_recv, v_si)){ p_chain := v_si.signerInfo.certificates; v_ret := true; } } } return v_chain; 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 () function f_askAndWaitForCertificateChain (out CertificateChain p_chain) runs on ItsGeoNetworking return CertificateChain { var CertificateChain v_chain := null; return boolean { var SecuredMessage v_recv; var SignerInfo v_si; var boolean v_ret := false; alt { [] a_securedMessageWithCertificate(v_recv) { f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_si := f_getCertificateSignerInfo(v_si.signerInfo.certificate); 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); if(tc_ac.running){ Loading @@ -2402,34 +2402,36 @@ module LibItsGeoNetworking_Functions { } } } } [] a_securedMessageWithCertificateChain(v_recv){ f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_chain := v_si.signerInfo.certificates; if(f_getMsgSignerInfo(v_recv, v_si)){ p_chain := v_si.signerInfo.certificates; v_ret := true; } } } return v_chain; 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 */ function f_waitForDigest () function f_waitForDigest ( out HashedId8 p_digest) runs on ItsGeoNetworking return HashedId8 { return boolean { var SecuredMessage v_recv; var HashedId8 v_digest; var boolean v_ret := false; alt { [] a_securedMessageWithDigest(v_recv){ var SignerInfo v_si; f_getMsgSignerInfo(v_recv, v_si); if (isbound(v_si)) { v_digest := v_si.signerInfo.digest; if(f_getMsgSignerInfo(v_recv, v_si)) { p_digest := v_si.signerInfo.digest; v_ret := true; } } } return v_digest; return v_ret; } } Loading
ttcn/Security/LibItsSecurity_Functions.ttcn3 +33 −33 Original line number Diff line number Diff line Loading @@ -557,20 +557,18 @@ module LibItsSecurity_Functions { */ function f_getMsgHeaderField( in template (value) SecuredMessage p_securedMessage, in HeaderFieldType p_headerFieldType ) return HeaderField { var HeaderField v_return; in HeaderFieldType p_headerFieldType, out HeaderField p_return ) return boolean { var integer v_length := lengthof(p_securedMessage.header_fields); var integer v_index; for (v_index := 0; v_index < v_length; v_index := v_index + 1) { if (valueof(p_securedMessage).header_fields[v_index].type_ == p_headerFieldType) { v_return := valueof(p_securedMessage).header_fields[v_index]; break; for (var integer i := 0; i < v_length; i := i + 1) { if (valueof(p_securedMessage).header_fields[i].type_ == p_headerFieldType) { p_return := valueof(p_securedMessage).header_fields[i]; return true; } } return v_return; return false; } /** Loading @@ -579,12 +577,15 @@ module LibItsSecurity_Functions { function f_getMsgSignerInfo ( in template (value) SecuredMessage p_securedMessage, out SignerInfo p_signerInfo ) { var HeaderField v_hf := f_getMsgHeaderField(p_securedMessage, e_signer_info); if (isbound(v_hf)) { ) return boolean { var HeaderField v_hf; if(f_getMsgHeaderField(p_securedMessage, e_signer_info, v_hf)){ if(isbound(v_hf.headerField.signer)){ p_signerInfo := v_hf.headerField.signer; return true; } } return false; } }// End of group messageGetters Loading @@ -593,29 +594,28 @@ module LibItsSecurity_Functions { function f_getCertificateValidityRestriction( in template (value) Certificate p_cert, in ValidityRestrictionType p_type ) return ValidityRestriction { var ValidityRestriction v_return; var integer v_length := lengthof(p_cert.validity_restrictions); var integer v_index; for (v_index := 0; v_index < v_length; v_index := v_index + 1) { if (valueof(p_cert).validity_restrictions[v_index].type_ == p_type ) { v_return := valueof(p_cert).validity_restrictions[v_index]; break; 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; } } return v_return; return false; } function f_getCertificateSignerInfo ( in template (value) Certificate p_cert ) return SignerInfo { var SignerInfo ret; if (lengthof(p_cert.signer_infos) > 0) { ret := valueof(p_cert).signer_infos[0]; in template (value) Certificate p_cert, out SignerInfo p_si ) return boolean { if( isbound(valueof(p_cert).signer_infos) and lengthof(p_cert.signer_infos) > 0) { p_si := valueof(p_cert).signer_infos[0]; return true; } return ret; return false; } }// End of group certificateGetters Loading