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