Loading ttcn/Security/LibItsSecurity_Functions.ttcn3 +20 −6 Original line number Original line Diff line number Diff line Loading @@ -75,11 +75,25 @@ module LibItsSecurity_Functions { /** /** * @desc Calculate digest over the certificate * @desc Calculate digest over the certificate * @param cert The certificate * @param p_cert The certificate * @return the digest * @return the digest * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.13 HashedId8 */ */ function f_calculateDigest(in Certificate cert) return HashedId8 { function f_calculateDigest(in Certificate p_cert) return HashedId8 { return '0000000000000000'O; var octetstring v_toBeHashedData; var octetstring v_hash; var integer v_counter; // Search for digest in the signer_infos field first for (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_ecdsap256) { return p_cert.signer_infos[v_counter].signerInfo.digest; } } // End of 'for' statement // digest not found, compute it v_toBeHashedData := bit2oct(encvalue(p_cert)); v_hash := f_hashWithSha256(v_toBeHashedData); return substr(v_hash, lengthof(v_hash) - 8, 8); } } group hostSignatureHelpers { group hostSignatureHelpers { Loading Loading @@ -397,9 +411,9 @@ module LibItsSecurity_Functions { v_secPayload := bit2oct(encvalue(v_toBeSignedCertificate)); v_secPayload := bit2oct(encvalue(v_toBeSignedCertificate)); // Calculate the hash of the SecuredMessage payload to be signed // // Calculate the hash of the SecuredMessage payload to be signed v_hash := fx_hashWithSha256(v_secPayload); // v_hash := fx_hashWithSha256(v_secPayload); // // Verify payload // Verify payload v_signedData := v_signedData := '0000'O & '0000'O & Loading Loading
ttcn/Security/LibItsSecurity_Functions.ttcn3 +20 −6 Original line number Original line Diff line number Diff line Loading @@ -75,11 +75,25 @@ module LibItsSecurity_Functions { /** /** * @desc Calculate digest over the certificate * @desc Calculate digest over the certificate * @param cert The certificate * @param p_cert The certificate * @return the digest * @return the digest * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.13 HashedId8 */ */ function f_calculateDigest(in Certificate cert) return HashedId8 { function f_calculateDigest(in Certificate p_cert) return HashedId8 { return '0000000000000000'O; var octetstring v_toBeHashedData; var octetstring v_hash; var integer v_counter; // Search for digest in the signer_infos field first for (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_ecdsap256) { return p_cert.signer_infos[v_counter].signerInfo.digest; } } // End of 'for' statement // digest not found, compute it v_toBeHashedData := bit2oct(encvalue(p_cert)); v_hash := f_hashWithSha256(v_toBeHashedData); return substr(v_hash, lengthof(v_hash) - 8, 8); } } group hostSignatureHelpers { group hostSignatureHelpers { Loading Loading @@ -397,9 +411,9 @@ module LibItsSecurity_Functions { v_secPayload := bit2oct(encvalue(v_toBeSignedCertificate)); v_secPayload := bit2oct(encvalue(v_toBeSignedCertificate)); // Calculate the hash of the SecuredMessage payload to be signed // // Calculate the hash of the SecuredMessage payload to be signed v_hash := fx_hashWithSha256(v_secPayload); // v_hash := fx_hashWithSha256(v_secPayload); // // Verify payload // Verify payload v_signedData := v_signedData := '0000'O & '0000'O & Loading