Loading ttcn/Security/LibItsSecurity_Functions.ttcn3 +17 −10 Original line number Diff line number Diff line Loading @@ -105,10 +105,12 @@ module LibItsSecurity_Functions { var octetstring v_toBeHashedData; var octetstring v_hash; // Search for digest in the signer_info field first if (p_cert.signer_info.type_ == e_certificate_digest_with_sha256) { return p_cert.signer_info.signerInfo.digest; // Search for digest in the signer_infos field first for (var integer v_counter := 0; v_counter < lengthof(p_cert.signer_infos); v_counter := v_counter + 1) { if (p_cert.signer_infos[v_counter].type_ == e_certificate_digest_with_sha256) { return p_cert.signer_infos[v_counter].signerInfo.digest; } } // End of 'for' statement // Digest not found, compute it log ("f_calculateDigestFromCertificate: Not found in certificate, compute it"); Loading Loading @@ -154,7 +156,7 @@ module LibItsSecurity_Functions { { // Field HeaderFields m_header_field_signer_info( m_signerInfo_digest( vc_atCertificate.signer_info.signerInfo.digest vc_atCertificate.signer_infos[0].signerInfo.digest ) // End of template m_signerInfo_certificate ), // End of template m_header_field_signer_info m_header_field_generation_time(oct2int('BBBBBBBB'O)), // To be replaced by TA with generation time Loading Loading @@ -354,7 +356,7 @@ module LibItsSecurity_Functions { v_signerInfo := valueof( m_header_field_signer_info( m_signerInfo_digest( v_atCertificate.signer_info.signerInfo.digest v_atCertificate.signer_infos[0].signerInfo.digest ))); } v_mandatoryHeaders := { Loading Loading @@ -433,7 +435,7 @@ module LibItsSecurity_Functions { v_signerInfo := valueof( m_header_field_signer_info( m_signerInfo_digest( v_atCertificate.signer_info.signerInfo.digest v_atCertificate.signer_infos[0].signerInfo.digest ))); } v_mandatoryHeaders := { Loading Loading @@ -514,7 +516,7 @@ module LibItsSecurity_Functions { v_signerInfo := valueof( m_header_field_signer_info( m_signerInfo_digest( v_atCertificate.signer_info.signerInfo.digest v_atCertificate.signer_infos[0].signerInfo.digest ))); } v_mandatoryHeaders := { Loading Loading @@ -855,8 +857,13 @@ module LibItsSecurity_Functions { function f_getCertificateSignerInfo( in template (value) Certificate p_cert, out SignerInfo p_si ) { p_si := valueof(p_cert).signer_info; ) 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 false; } function f_getCertificateSubjectAttribute( Loading ttcn/Security/LibItsSecurity_Templates.ttcn3 +67 −21 Original line number Diff line number Diff line Loading @@ -852,7 +852,9 @@ module LibItsSecurity_Templates { * @desc Send template for 'unsecured' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_unsecured(in template (omit) octetstring p_data := omit) := { template (value) SecPayload m_payload_unsecured( in template (omit) octetstring p_data := omit ) := { type_ := e_unsecured, data := p_data } // End of template m_payload_signed Loading @@ -861,7 +863,9 @@ module LibItsSecurity_Templates { * @desc Send template for 'signed' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_signed(in template (value) octetstring p_data) := { template (value) SecPayload m_payload_signed( in template (value) octetstring p_data ) := { type_ := e_signed, data := p_data } // End of template m_payload_signed Loading @@ -870,27 +874,33 @@ module LibItsSecurity_Templates { * @desc Send template for 'signed_external' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_signed_external(in template (omit) octetstring p_data := omit) := { template (value) SecPayload m_payload_signed_external( in template (omit) octetstring p_data := omit ) := { type_ := e_signed_external, data := omit data := p_data } // End of template m_payload_signed_external /** * @desc Send template for 'encrypted' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_encrypted(in template (value) octetstring p_data) := { template (value) SecPayload m_payload_encrypted( in template (value) octetstring p_data ) := { type_ := e_encrypted, data := omit data := p_data } // End of template m_payload_encrypted /** * @desc Send template for 'signed_external' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_signed_and_encrypted(in template (omit) octetstring p_data := omit) := { template (value) SecPayload m_payload_signed_and_encrypted( in template (value) octetstring p_data ) := { type_ := e_signed_and_encrypted, data := omit data := p_data } // End of template m_payload_signed_and_encrypted template (value) SecPayload m_data_payload( Loading @@ -912,7 +922,8 @@ module LibItsSecurity_Templates { * @desc Receive template for SecPayload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (present) SecPayload mw_payload (in template (present) SecPayloadType p_type, template (present) SecPayload mw_payload ( in template (present) SecPayloadType p_type, in template (present) octetstring p_data := ? ):= { type_ := p_type, Loading Loading @@ -1280,6 +1291,41 @@ module LibItsSecurity_Templates { } } // End of template mw_header_field_signer_info_digest /** * @desc Receive template for HeaderField with VerificationAdvice set to recommended * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.4 HeaderField */ template (value) HeaderField mw_header_field_verification_advice_recommended := { type_ := e_verification_advice, headerField := { verification_advice := e_recommended } } // End of template mw_header_field_verification_advice_recommended /** * @desc Receive template for HeaderField with VerificationAdvice set to required * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.4 HeaderField */ template (value) HeaderField mw_header_field_verification_advice_required := { type_ := e_verification_advice, headerField := { verification_advice := e_required } } // End of template mw_header_field_verification_advice_required /** * @desc Receive template for HeaderField with ItsAid information * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.4 HeaderField */ template (value) HeaderField mw_header_field_its_aid( in template (present) IntX p_its_aid := ? ) := { type_ := e_its_aid, headerField := { its_aid := p_its_aid } } // End of template mw_header_field_its_aid } // End of group headerFieldsRecv } // End of group headerFields Loading Loading @@ -1444,7 +1490,7 @@ module LibItsSecurity_Templates { */ template (present) Certificate mw_certificate_dummy := { version := c_certificate_version, signer_info := ?, signer_infos := ?, subject_info := ?, subject_attributes := ?, validity_restrictions := ?, Loading Loading @@ -1477,14 +1523,14 @@ module LibItsSecurity_Templates { * @see Draft ETSI TS 103 097 V1.1.9 Clause 6.1 Certificate */ template (value) Certificate m_certificate( in template (value) SignerInfo p_signer_info, in template (value) SignerInfos p_signer_infos, in template (value) SubjectInfo p_subject_info, in template (value) SubjectAttributes p_subject_attributes, in template (value) ValidityRestrictions p_validity_restrictions, in template (value) Signature p_signature ) := { version := c_certificate_version, signer_info := p_signer_info, signer_infos := p_signer_infos, subject_info := p_subject_info, subject_attributes := p_subject_attributes, validity_restrictions := p_validity_restrictions, Loading Loading @@ -1653,14 +1699,14 @@ module LibItsSecurity_Templates { group certificatesRecv { template (present) Certificate mw_certificate( in template (present) SignerInfo p_signer_info := ?, in template (present) SignerInfos p_signer_infos := ?, in template (present) SubjectInfo p_subject_info := ?, in template (present) SubjectAttributes p_subject_attributes := ?, in template (present) ValidityRestrictions p_validity_restrictions := ?, in template (present) Signature p_signature :=? ) := { version := c_certificate_version, signer_info := p_signer_info, signer_infos := p_signer_infos, subject_info := p_subject_info, subject_attributes := p_subject_attributes, validity_restrictions := p_validity_restrictions, Loading @@ -1674,7 +1720,7 @@ module LibItsSecurity_Templates { in template (present) Signature p_signature :=? ) := { version := c_certificate_version, signer_info := p_signer_info, signer_infos := { p_signer_info }, subject_info := { subject_type := e_authorization_authority, subject_name := ? Loading @@ -1691,7 +1737,7 @@ module LibItsSecurity_Templates { in template (present) Signature p_signature :=? ) := { version := c_certificate_version, signer_info := p_signer_info, signer_infos := { p_signer_info }, subject_info := { subject_type := e_authorization_ticket, subject_name := ? Loading Loading @@ -2115,7 +2161,7 @@ module LibItsSecurity_Templates { in template (value) Certificate p_certificate ) := { version := p_certificate.version, signer_info := p_certificate.signer_info, signer_infos := p_certificate.signer_infos, subject_info := p_certificate.subject_info, subject_attributes := p_certificate.subject_attributes, validity_restrictions := p_certificate.validity_restrictions Loading ttcn/Security/LibItsSecurity_TypesAndValues.ttcn3 +8 −2 Original line number Diff line number Diff line Loading @@ -633,13 +633,19 @@ module LibItsSecurity_TypesAndValues { */ type record Certificate { UInt8 version, SignerInfo signer_info, SignerInfos signer_infos, SubjectInfo subject_info, SubjectAttributes subject_attributes, ValidityRestrictions validity_restrictions, Signature signature_ } // End of type Certificate /** * @desc Defines an ordered list of SignerInfo * @remark TTCN-3 language does not provide feature suach as superset for the. In consequence, the is replaced here by a set of */ type set of SignerInfo SignerInfos; /** * @desc Defines an ordered list of Certificate * @remark TTCN-3 language does not provide feature suach as superset for the. In consequence, the is replaced here by a set of Loading Loading @@ -912,7 +918,7 @@ module LibItsSecurity_TypesAndValues { */ type record ToBeSignedCertificate { UInt8 version, SignerInfo signer_info, SignerInfos signer_infos, SubjectInfo subject_info, SubjectAttributes subject_attributes, ValidityRestrictions validity_restrictions Loading Loading
ttcn/Security/LibItsSecurity_Functions.ttcn3 +17 −10 Original line number Diff line number Diff line Loading @@ -105,10 +105,12 @@ module LibItsSecurity_Functions { var octetstring v_toBeHashedData; var octetstring v_hash; // Search for digest in the signer_info field first if (p_cert.signer_info.type_ == e_certificate_digest_with_sha256) { return p_cert.signer_info.signerInfo.digest; // Search for digest in the signer_infos field first for (var integer v_counter := 0; v_counter < lengthof(p_cert.signer_infos); v_counter := v_counter + 1) { if (p_cert.signer_infos[v_counter].type_ == e_certificate_digest_with_sha256) { return p_cert.signer_infos[v_counter].signerInfo.digest; } } // End of 'for' statement // Digest not found, compute it log ("f_calculateDigestFromCertificate: Not found in certificate, compute it"); Loading Loading @@ -154,7 +156,7 @@ module LibItsSecurity_Functions { { // Field HeaderFields m_header_field_signer_info( m_signerInfo_digest( vc_atCertificate.signer_info.signerInfo.digest vc_atCertificate.signer_infos[0].signerInfo.digest ) // End of template m_signerInfo_certificate ), // End of template m_header_field_signer_info m_header_field_generation_time(oct2int('BBBBBBBB'O)), // To be replaced by TA with generation time Loading Loading @@ -354,7 +356,7 @@ module LibItsSecurity_Functions { v_signerInfo := valueof( m_header_field_signer_info( m_signerInfo_digest( v_atCertificate.signer_info.signerInfo.digest v_atCertificate.signer_infos[0].signerInfo.digest ))); } v_mandatoryHeaders := { Loading Loading @@ -433,7 +435,7 @@ module LibItsSecurity_Functions { v_signerInfo := valueof( m_header_field_signer_info( m_signerInfo_digest( v_atCertificate.signer_info.signerInfo.digest v_atCertificate.signer_infos[0].signerInfo.digest ))); } v_mandatoryHeaders := { Loading Loading @@ -514,7 +516,7 @@ module LibItsSecurity_Functions { v_signerInfo := valueof( m_header_field_signer_info( m_signerInfo_digest( v_atCertificate.signer_info.signerInfo.digest v_atCertificate.signer_infos[0].signerInfo.digest ))); } v_mandatoryHeaders := { Loading Loading @@ -855,8 +857,13 @@ module LibItsSecurity_Functions { function f_getCertificateSignerInfo( in template (value) Certificate p_cert, out SignerInfo p_si ) { p_si := valueof(p_cert).signer_info; ) 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 false; } function f_getCertificateSubjectAttribute( Loading
ttcn/Security/LibItsSecurity_Templates.ttcn3 +67 −21 Original line number Diff line number Diff line Loading @@ -852,7 +852,9 @@ module LibItsSecurity_Templates { * @desc Send template for 'unsecured' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_unsecured(in template (omit) octetstring p_data := omit) := { template (value) SecPayload m_payload_unsecured( in template (omit) octetstring p_data := omit ) := { type_ := e_unsecured, data := p_data } // End of template m_payload_signed Loading @@ -861,7 +863,9 @@ module LibItsSecurity_Templates { * @desc Send template for 'signed' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_signed(in template (value) octetstring p_data) := { template (value) SecPayload m_payload_signed( in template (value) octetstring p_data ) := { type_ := e_signed, data := p_data } // End of template m_payload_signed Loading @@ -870,27 +874,33 @@ module LibItsSecurity_Templates { * @desc Send template for 'signed_external' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_signed_external(in template (omit) octetstring p_data := omit) := { template (value) SecPayload m_payload_signed_external( in template (omit) octetstring p_data := omit ) := { type_ := e_signed_external, data := omit data := p_data } // End of template m_payload_signed_external /** * @desc Send template for 'encrypted' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_encrypted(in template (value) octetstring p_data) := { template (value) SecPayload m_payload_encrypted( in template (value) octetstring p_data ) := { type_ := e_encrypted, data := omit data := p_data } // End of template m_payload_encrypted /** * @desc Send template for 'signed_external' Payload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (value) SecPayload m_payload_signed_and_encrypted(in template (omit) octetstring p_data := omit) := { template (value) SecPayload m_payload_signed_and_encrypted( in template (value) octetstring p_data ) := { type_ := e_signed_and_encrypted, data := omit data := p_data } // End of template m_payload_signed_and_encrypted template (value) SecPayload m_data_payload( Loading @@ -912,7 +922,8 @@ module LibItsSecurity_Templates { * @desc Receive template for SecPayload * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.2 Payload */ template (present) SecPayload mw_payload (in template (present) SecPayloadType p_type, template (present) SecPayload mw_payload ( in template (present) SecPayloadType p_type, in template (present) octetstring p_data := ? ):= { type_ := p_type, Loading Loading @@ -1280,6 +1291,41 @@ module LibItsSecurity_Templates { } } // End of template mw_header_field_signer_info_digest /** * @desc Receive template for HeaderField with VerificationAdvice set to recommended * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.4 HeaderField */ template (value) HeaderField mw_header_field_verification_advice_recommended := { type_ := e_verification_advice, headerField := { verification_advice := e_recommended } } // End of template mw_header_field_verification_advice_recommended /** * @desc Receive template for HeaderField with VerificationAdvice set to required * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.4 HeaderField */ template (value) HeaderField mw_header_field_verification_advice_required := { type_ := e_verification_advice, headerField := { verification_advice := e_required } } // End of template mw_header_field_verification_advice_required /** * @desc Receive template for HeaderField with ItsAid information * @see Draft ETSI TS 103 097 V1.1.9 Clause 5.4 HeaderField */ template (value) HeaderField mw_header_field_its_aid( in template (present) IntX p_its_aid := ? ) := { type_ := e_its_aid, headerField := { its_aid := p_its_aid } } // End of template mw_header_field_its_aid } // End of group headerFieldsRecv } // End of group headerFields Loading Loading @@ -1444,7 +1490,7 @@ module LibItsSecurity_Templates { */ template (present) Certificate mw_certificate_dummy := { version := c_certificate_version, signer_info := ?, signer_infos := ?, subject_info := ?, subject_attributes := ?, validity_restrictions := ?, Loading Loading @@ -1477,14 +1523,14 @@ module LibItsSecurity_Templates { * @see Draft ETSI TS 103 097 V1.1.9 Clause 6.1 Certificate */ template (value) Certificate m_certificate( in template (value) SignerInfo p_signer_info, in template (value) SignerInfos p_signer_infos, in template (value) SubjectInfo p_subject_info, in template (value) SubjectAttributes p_subject_attributes, in template (value) ValidityRestrictions p_validity_restrictions, in template (value) Signature p_signature ) := { version := c_certificate_version, signer_info := p_signer_info, signer_infos := p_signer_infos, subject_info := p_subject_info, subject_attributes := p_subject_attributes, validity_restrictions := p_validity_restrictions, Loading Loading @@ -1653,14 +1699,14 @@ module LibItsSecurity_Templates { group certificatesRecv { template (present) Certificate mw_certificate( in template (present) SignerInfo p_signer_info := ?, in template (present) SignerInfos p_signer_infos := ?, in template (present) SubjectInfo p_subject_info := ?, in template (present) SubjectAttributes p_subject_attributes := ?, in template (present) ValidityRestrictions p_validity_restrictions := ?, in template (present) Signature p_signature :=? ) := { version := c_certificate_version, signer_info := p_signer_info, signer_infos := p_signer_infos, subject_info := p_subject_info, subject_attributes := p_subject_attributes, validity_restrictions := p_validity_restrictions, Loading @@ -1674,7 +1720,7 @@ module LibItsSecurity_Templates { in template (present) Signature p_signature :=? ) := { version := c_certificate_version, signer_info := p_signer_info, signer_infos := { p_signer_info }, subject_info := { subject_type := e_authorization_authority, subject_name := ? Loading @@ -1691,7 +1737,7 @@ module LibItsSecurity_Templates { in template (present) Signature p_signature :=? ) := { version := c_certificate_version, signer_info := p_signer_info, signer_infos := { p_signer_info }, subject_info := { subject_type := e_authorization_ticket, subject_name := ? Loading Loading @@ -2115,7 +2161,7 @@ module LibItsSecurity_Templates { in template (value) Certificate p_certificate ) := { version := p_certificate.version, signer_info := p_certificate.signer_info, signer_infos := p_certificate.signer_infos, subject_info := p_certificate.subject_info, subject_attributes := p_certificate.subject_attributes, validity_restrictions := p_certificate.validity_restrictions Loading
ttcn/Security/LibItsSecurity_TypesAndValues.ttcn3 +8 −2 Original line number Diff line number Diff line Loading @@ -633,13 +633,19 @@ module LibItsSecurity_TypesAndValues { */ type record Certificate { UInt8 version, SignerInfo signer_info, SignerInfos signer_infos, SubjectInfo subject_info, SubjectAttributes subject_attributes, ValidityRestrictions validity_restrictions, Signature signature_ } // End of type Certificate /** * @desc Defines an ordered list of SignerInfo * @remark TTCN-3 language does not provide feature suach as superset for the. In consequence, the is replaced here by a set of */ type set of SignerInfo SignerInfos; /** * @desc Defines an ordered list of Certificate * @remark TTCN-3 language does not provide feature suach as superset for the. In consequence, the is replaced here by a set of Loading Loading @@ -912,7 +918,7 @@ module LibItsSecurity_TypesAndValues { */ type record ToBeSignedCertificate { UInt8 version, SignerInfo signer_info, SignerInfos signer_infos, SubjectInfo subject_info, SubjectAttributes subject_attributes, ValidityRestrictions validity_restrictions Loading