module test_LibItsSecurity_TypesAndValues { // LibCommon import from LibItsCommon_Functions {function f_getCurrentTime;} import from LibCommon_DataStrings all; // LibItsSecurity import from LibItsSecurity_TypesAndValues all; import from LibItsSecurity_Templates {template all;} import from LibItsSecurity_Functions all; import from LibItsSecurity_Pixits all; // TestUnits import from test_CommonCodec all; group LibItsSecurity_testCases { group securityAcPrimitives { /** * @desc Validate Security AcPrimitive */ testcase tc_acEnableSecurity() runs on TCType system TCType { var ToBeSignedSecuredMessage v_toBeSignedSecuredMessageDigest, v_toBeSignedSecuredMessageCertificate; f_loadCertificates("cfg01"); vc_location := { 22345, 54321, '0000'O }; v_toBeSignedSecuredMessageDigest := f_buildSecuredMessagePayloadToBeSigned(); v_toBeSignedSecuredMessageCertificate := f_buildSecuredMessagePayloadToBeSigned(true); test_PDU( m_enableSecurity( "TA_CERT_A" ), true, oct2bit('54415F434552545F41'O) ); } } // End of group securityAcPrimitives group basicFormatElements { /** * @desc Validate PublicKey/EccPoint * @verdict Pass on success, Fail otherwise */ testcase tc_PublicKey_eccPoint_01() runs on TCType system TCType { test_PDU( m_publicKey_eccPoint( m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O ) ) ); } // End of testcase tc_PublicKey_eccPoint_01 /** * @desc Validate PublicKey/EccPoint * @verdict Pass on success, Fail otherwise */ testcase tc_PublicKey_eccPoint_02() runs on TCType system TCType { test_PDU( m_publicKey_eccPoint( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ) ) ); } // End of testcase tc_PublicKey_eccPoint_02 /** * @desc Validate PublicKey/EccPoint * @verdict Pass on success, Fail otherwise */ testcase tc_PublicKey_aesccm_01() runs on TCType system TCType { test_PDU( m_publicKey_aesccm( m_aesccm( m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O ) ) ) ); } // End of testcase tc_PublicKey_aesccm_01 /** * @desc Validate PublicKey/EccPoint * @verdict Pass on success, Fail otherwise */ testcase tc_PublicKey_aesccm_02() runs on TCType system TCType { test_PDU( m_publicKey_aesccm( m_aesccm( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ) ) ) ); } // End of testcase tc_PublicKey_aesccm_02 /** * @desc Validate EcdsaSignature * @remark The EccPointType of R shall be set to x_coordinate_only * @verdict Pass on success, Fail otherwise */ testcase tc_EcdsaSignature_01() runs on TCType system TCType { test_PDU( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O ), '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ) ); } // End of testcase tc_EcdsaSignature_01 testcase tc_Duration_01() runs on TCType system TCType { test_PDU( m_duration_in_seconds( 456 ) ); } // End of testcase tc_Duration_01 /** * @desc Validate Time64WithStandardDeviation * @verdict Pass on success, Fail otherwise */ testcase tc_Time64WithStandardDeviation_01() runs on TCType system TCType { test_PDU( m_time64WithStandardDeviation( oct2int('FACEB00C'O), 128 ) ); } // End of testcase tc_Time64WithStandardDeviation_01 /** * @desc Validate TwoDLocation * @verdict Pass on success, Fail otherwise */ testcase tc_TwoDLocation_01() runs on TCType system TCType { test_PDU( m_twoDLocation( 22345, 54321 ) ); } // End of testcase tc_TwoDLocation_01 /** * @desc Validate ThreeDLocation * @verdict Pass on success, Fail otherwise */ testcase tc_ThreeDLocation_01() runs on TCType system TCType { test_PDU( m_threeDLocation( 12345, 54321, int2oct(1024, 2) ) ); } // End of testcase tc_ThreeDLocation_01 testcase tc_EncryptionParameters_01() runs on TCType system TCType { test_PDU( m_encryptionParameters_aes_128_ccm( '010203040506070808080808'O ) ); } // End of testcase tc_EncryptionParameters_01 testcase tc_GeographicRegion_01() runs on TCType system TCType { test_PDU( m_geographicRegion_circle( m_twoDLocation( 22345, 54321 ), 2550 ) ); } // End of testcase tc_EncryptionParameters_01 testcase tc_GeographicRegion_02() runs on TCType system TCType { test_PDU( m_geographicRegion_rectangle( m_twoDLocation( 22345, 54321 ), m_twoDLocation( 2*22345, 2*54321 ) ) ); } // End of testcase tc_EncryptionParameters_02 testcase tc_GeographicRegion_03() runs on TCType system TCType { test_PDU( m_geographicRegion_polygonial( { m_twoDLocation( 22345, 54321 ), m_twoDLocation( 2*22345, 2*54321 ) } ) ); } // End of testcase tc_EncryptionParameters_03 template (value) IdentifiedRegion m_identifiedRegion_01 := { region_dictionary := e_un_stats, region_identifier := 3, local_region := 10 } // End of template m_identifiedRegion_01 template (value) IdentifiedRegion m_identifiedRegion_02 := { region_dictionary := e_iso_3166_1, region_identifier := 4567, local_region := 78 } // End of template m_identifiedRegion_01 template (value) IdentifiedRegion m_identifiedRegion_03 := { region_dictionary := e_iso_3166_1, region_identifier := 2, local_region := 2184 } // End of template m_identifiedRegion_03 template (value) IdentifiedRegion m_identifiedRegion_04 := { region_dictionary := e_iso_3166_1, region_identifier := 2, local_region := 9 * 2184 } // End of template m_identifiedRegion_04 testcase tc_GeographicRegion_04() runs on TCType system TCType { test_PDU( m_geographicRegion_identifiedRegion( m_identifiedRegion_01 ) ); } // End of testcase tc_GeographicRegion_04 testcase tc_GeographicRegion_05() runs on TCType system TCType { test_PDU( m_geographicRegion_identifiedRegion( m_identifiedRegion_02 ) ); } // End of testcase tc_GeographicRegion_05 testcase tc_GeographicRegion_06() runs on TCType system TCType { test_PDU( m_geographicRegion_identifiedRegion( m_identifiedRegion_03 ) ); } // End of testcase tc_GeographicRegion_06 testcase tc_GeographicRegion_07() runs on TCType system TCType { test_PDU( m_geographicRegion_identifiedRegion( m_identifiedRegion_04 ) ); } // End of testcase tc_GeographicRegion_07 testcase tc_GeographicRegion_08() runs on TCType system TCType { test_PDU( m_geographicRegion_nonce ); } // End of testcase tc_GeographicRegion_08 } // End of group basicFormatElements group securityHeader { testcase tc_Payload_01() runs on TCType system TCType { test_PDU( m_payload_signed_external ); } // End of testcase tc_Payload_01 testcase tc_Payload_02() runs on TCType system TCType { test_PDU( m_payload_unsecured('DEEDBEEF'O) ); } // End of testcase tc_Payload_02 testcase tc_Payload_03() runs on TCType system TCType { test_PDU( m_payload_signed('DEEDBEEF'O) ); } // End of testcase tc_Payload_03 testcase tc_Payload_04() runs on TCType system TCType { test_PDU( m_payload_encrypted('DEEDBEEF'O) ); } // End of testcase tc_Payload_04 testcase tc_Payload_05() runs on TCType system TCType { test_PDU( m_payload_signed_and_encrypted('DEEDBEEF'O) ); } // End of testcase tc_Payload_05 testcase tc_HeaderField_01() runs on TCType system TCType { test_PDU( m_header_field_generation_time( 123456789 ) ); } // End of testcase tc_HeaderField_01 testcase tc_HeaderField_02() runs on TCType system TCType { test_PDU( m_header_field_generation_time_with_standard_deviation( m_time64WithStandardDeviation( oct2int('FACEB00C'O), 128 ) ) ); } // End of testcase tc_HeaderField_02 testcase tc_HeaderField_03() runs on TCType system TCType { test_PDU( m_header_field_expiry_time( 3600 ) ); } // End of testcase tc_HeaderField_03 testcase tc_HeaderField_04() runs on TCType system TCType { test_PDU( m_header_field_generation_location( m_threeDLocation( -12345, -54321, int2oct(1024, 2) ) ) ); } // End of testcase tc_HeaderField_04 testcase tc_HeaderField_05() runs on TCType system TCType { test_PDU( m_header_field_unrecognised_certificate( '060708'O ) ); } // End of testcase tc_HeaderField_05 testcase tc_HeaderField_06() runs on TCType system TCType { test_PDU( mw_header_field_its_aid(16512) ); } // End of testcase tc_HeaderField_06 testcase tc_HeaderField_07() runs on TCType system TCType { test_PDU( mw_header_field_its_aid(16513) ); } // End of testcase tc_HeaderField_07 testcase tc_HeaderField_08() runs on TCType system TCType { test_PDU( m_header_field_its_aid( 12345 ) ); } // End of testcase tc_HeaderField_08 testcase tc_HeaderField_09() runs on TCType system TCType { test_PDU( m_header_field_signer_info( m_signerInfo_self ) ); } // End of testcase tc_HeaderField_09 testcase tc_HeaderField_10() runs on TCType system TCType { test_PDU( m_header_field_enc_params( m_encryptionParameters_aes_128_ccm( '010203040506070808080808'O ) ) ); } // End of testcase tc_HeaderField_10 testcase tc_TrailerField_01() runs on TCType system TCType { test_PDU( m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ), '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ) ) ) ); } // End of testcase tc_TrailerField_01 testcase tc_SecuredMessage_01() runs on TCType system TCType { test_PDU( m_secureMessage_dummy ); } // End of testcase tc_SecuredMessage_01 template (value) SecuredMessage m_secureMessageCAMs_01 modifies m_secureMessage_dummy := { header_fields := { m_header_field_signer_info( m_signerInfo_digest('0102030405060708'O) ), m_header_field_signer_info( m_signerInfo_digest('1020304050607080'O) ) }, payload_field := m_payload_signed('DEEDBEEF01'O), trailer_fields := { m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ), '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ) ) ) } } // End of template tc_SecuredMessage_01 template (value) SecuredMessage m_secureMessage_02 modifies m_secureMessage_dummy := { header_fields := { m_header_field_signer_info( m_signerInfo_digest('0102030405060708'O) ), m_header_field_signer_info( m_signerInfo_digest('1020304050607080'O) ) }, payload_field := m_payload_signed('DEEDBEEF01'O), trailer_fields := { m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ), '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ) ) ), m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O, '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ), 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O ) ) ) } } // End of template m_secureMessage_02 template (value) SecuredMessage m_secureMessageCAMs modifies m_secureMessage_dummy := { header_fields := { m_header_field_signer_info( m_signerInfo_digest('0102030405060708'O) ), m_header_field_generation_time(1000 * f_getCurrentTime()), m_header_field_its_aid_CAM }, payload_field := m_payload_signed('DEEDBEEF01'O), trailer_fields := { m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ), '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ) ) ), m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O, '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ), 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O ) ) ) } } // End of template m_secureMessageCAMs template (value) SecuredMessage m_secureMessageDENMs modifies m_secureMessage_dummy := { header_fields := { m_header_field_signer_info( m_signerInfo_digest('0102030405060708'O) ), m_header_field_generation_time(1000 * f_getCurrentTime()), m_header_field_generation_location( m_threeDLocation( 12345, 54321, int2oct(1024, 2) ) ), m_header_field_its_aid_DENM }, payload_field := m_payload_signed('DEEDBEEF01'O), trailer_fields := { m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ), '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ) ) ), m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O, '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ), 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O ) ) ) } } // End of template m_secureMessageDENMs template (value) SecuredMessage m_secureMessageOthers modifies m_secureMessage_dummy := { header_fields := { m_header_field_signer_info( m_signerInfo_digest('0102030405060708'O) ), m_header_field_generation_time(1000 * f_getCurrentTime()), m_header_field_generation_location( m_threeDLocation( 12345, 54321, int2oct(1024, 2) ) ) }, payload_field := m_payload_signed('DEEDBEEF01'O), trailer_fields := { m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ), '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ) ) ), m_trailer_field_signature( m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_uncompressed( '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O, '00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O ), 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O ) ) ) } } // End of template m_secureMessageOthers testcase tc_SecuredMessage_02() runs on TCType system TCType { test_PDU( m_secureMessage_02 ); } // End of testcase tc_SecuredMessage_02 testcase tc_SecuredMessage_03() runs on TCType system TCType { test_PDU( m_secureMessageCAMs ); if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_CAMs) == true) { setverdict(pass, "Basic"); } if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_CAMs(mw_header_field_signer_info_digest)) == true) { setverdict(pass, "With digest"); } if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_CAMs(mw_header_field_signer_info_certificate)) == false) { setverdict(pass, "With certificate mismatch"); } if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_DENMs) == true) { setverdict(fail, "Shall not match with DENM template"); stop; } if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_Others) == true) { setverdict(fail, "Shall not match with Other template"); stop; } } // End of testcase tc_SecuredMessage_03 testcase tc_SecuredMessage_04() runs on TCType system TCType { test_PDU( m_secureMessageDENMs ); if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_DENMs) == true) { setverdict(pass, "Basic"); } if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_DENMs(mw_header_field_signer_info_digest)) == true) { setverdict(pass, "With digest"); } if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_DENMs(mw_header_field_signer_info_certificate)) == false) { setverdict(pass, "With certificate mismatch"); } if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_CAMs) == true) { setverdict(fail, "Shall not match with CAM template"); stop; } if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_Others) == true) { setverdict(fail, "Shall not match with Other template"); stop; } } // End of testcase tc_SecuredMessage_04 testcase tc_SecuredMessage_05() runs on TCType system TCType { test_PDU( m_secureMessageOthers ); if (match(valueof(m_secureMessageOthers), mdw_securedMessage_Others) == true) { setverdict(pass, "Basic"); } if (match(valueof(m_secureMessageOthers), mdw_securedMessage_Others(mw_header_field_signer_info_digest)) == true) { setverdict(pass, "With digest"); } if (match(valueof(m_secureMessageOthers), mdw_securedMessage_Others(mw_header_field_signer_info_certificate)) == false) { setverdict(pass, "With certificate mismatch"); } if (match(valueof(m_secureMessageOthers), mdw_securedMessage_CAMs) == true) { setverdict(fail, "Shall not match with CAM template"); stop; } if (match(valueof(m_secureMessageOthers), mdw_securedMessage_CAMs) == true) { setverdict(fail, "Shall not match with CAM template"); stop; } if (match(valueof(m_secureMessageOthers), mdw_securedMessage_DENMs) == true) { setverdict(fail, "Shall not match with DENM template"); stop; } } // End of testcase tc_SecuredMessage_05 } // End of group securityHeader group certificates { testcase tc_SubjectInfo_01() runs on TCType system TCType { test_PDU( m_subject_info_root_ca('DEADBEEF'O) ); } // End of testcase tc_SubjectInfo_01 testcase tc_SubjectInfo_02() runs on TCType system TCType { test_PDU( m_subject_info_revocation('DE5EA5ED'O) ); } // End of testcase tc_SubjectInfo_02 testcase tc_SubjectAttribute_01() runs on TCType system TCType { test_PDU( m_subject_attribute_verification_key( m_publicKey_eccPoint( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ) ) ) ); } // End of testcase tc_SubjectAttribute_01 testcase tc_SubjectAttribute_02() runs on TCType system TCType { test_PDU( m_subject_attribute_encryption_key( m_publicKey_eccPoint( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ) ) ) ); } // End of testcase tc_SubjectAttribute_02 testcase tc_SubjectAttribute_03() runs on TCType system TCType { test_PDU( m_subject_attribute_reconstruction_value( m_eccPointecdsa_nistp256_with_sha256_uncompressed( 'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O, '639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O ) ) ); } // End of testcase tc_SubjectAttribute_03 testcase tc_SubjectAttribute_04() runs on TCType system TCType { test_PDU( m_subject_attribute_assurance_level( m_subjectAssurance( '101'B, '11'B ) ) ); } // End of testcase tc_SubjectAttribute_04 testcase tc_SubjectAttribute_05() runs on TCType system TCType { test_PDU( m_subject_attribute_its_aid_list( { 9 * 2184, 7 * 2184, 5 * 2184, 3 * 2184, 2184 } ) ); } // End of testcase tc_SubjectAttribute_05 testcase tc_SubjectAttribute_06() runs on TCType system TCType { test_PDU( m_subject_attribute_its_aid_ssp_list( { { 9 * 2184, m_sspTest }, { 7 * 2184, m_sspTest }, { 5 * 2184, m_sspTest }, { 3 * 2184, m_sspTest }, { 2184, m_sspTest } } ), true, oct2bit('2115C04CC80100BBB80100AAA801009998010088880100'O) ); } // End of testcase tc_SubjectAttribute_06 testcase tc_SubjectAttribute_07() runs on TCType system TCType { test_PDU( m_subject_attribute_its_aid_ssp_list( { { 16512, { version := '00'O, sspContainer := omit } }, { 16513, { version := '00'O, sspContainer := omit } } } ), true, oct2bit('210AC040800100C040810100'O) ); } // End of testcase tc_SubjectAttribute_07 testcase tc_SubjectAttribute_08() runs on TCType system TCType { test_PDU( m_subject_attribute_its_aid_ssp_list( { { 16512, m_sspDENM_vehicle }, { 16513, m_sspDENM_vehicle } } ), true, oct2bit('2110C04080040101F8DFC04081040101F8DF'O) ); } // End of testcase tc_SubjectAttribute_08 testcase tc_SubjectAssurance_01() runs on TCType system TCType { test_PDU( m_subjectAssurance( '101'B, '11'B ) ); } // End of testcase tc_SubjectAssurance_01 testcase tc_ValidityRestriction_01() runs on TCType system TCType { test_PDU( m_validity_restriction_time_end( 12345 ) ); } // End of testcase tc_ValidityRestriction_01 testcase tc_ValidityRestriction_02() runs on TCType system TCType { test_PDU( m_validity_restriction_time_start_and_end( 12345, 12378 ) ); } // End of testcase tc_ValidityRestriction_02 testcase tc_ValidityRestriction_03() runs on TCType system TCType { test_PDU( m_validity_restriction_time_start_and_duration( 12345, m_duration_in_seconds( 456 ) ) ); } // End of testcase tc_ValidityRestriction_03 testcase tc_ValidityRestriction_04() runs on TCType system TCType { test_PDU( m_validity_restriction_region( m_geographicRegion_identifiedRegion( m_identifiedRegion_02 ) ) ); } // End of testcase tc_ValidityRestriction_04 /** * @desc Root certificate self signed * @verdict */ testcase tc_Certificate_01() runs on TCType system TCType { test_PDU( m_certificate( m_signerInfo_self, m_subject_info_root_ca('455453495f506c7567746573745f526f6f74'O), // ETSI_Plugtest_Root { m_subject_attribute_verification_key( m_publicKey_eccPoint( m_eccPointecdsa_nistp256_with_sha256_uncompressed( '63eb5c4ea82bc6a6b27e5857a075dce18f0e3cdc01d42896418b23f68872e41a'O, 'd04f5dfcdc2be224986e15147840ff21f709dcb6503a416207e1b8e1ce395c2a'O ) ) ), m_subject_attribute_verification_key( m_publicKey_aesccm( m_aesccm( m_eccPointecdsa_nistp256_with_sha256_uncompressed( '4dff56b92fcf680ee694ee58473f9f7d37516c3708f108a5185c185c5f159f02'O, 'f47aa5d2514f593245dd6575613114182dc83ec67ac2a7b6726421d94c55184b'O ) ) ) ) }, // End of field subject_attributes { }, // End of field validity_restrictions m_signature( m_ecdsaSignature( m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only( 'd06ff2baf762e9618cac21bd110f271ea2a7c91355dca14753fc9a0dded1ab34'O ), '71db2dd2ba840126e2904297f34386ccdfe86a0ebe0e585748517a5da49808b4'O ) ) ) // End of template m_certificate ); } // End of testcase tc_Certificate_01 template (value) octetstring m_rootCertificate := '02000412455453495f506c7567746573745f526f6f748091000004a0ce08d329fd7be6b5af8fde7dad64e57fa5ff54dfaf9ec42b7443193c1f9d9d48e3c03250e59f895b17ca1e68cd8f5f1e9b1b06eddd0b98dfde91e88fa1199501010004e82c1957b1da51b5a00f29e51db151b30bd6ef29bd0c2f3e8e5cf457826f8660e59e4783e9b4b2a5b455263183ea88b18ae7e2d90ec805260213978014d1b2bf02202006c04080c0408124011464b4031a5617030303181db9cf7c052616001db9566e0526872a1d53f0d0052783500000a83ef7af9f3509189db625cd2e30eaefaf4f5b604d36389ece4f06b37a3923cf13ce5734485e25e360a7cf386eee795debbe9c61586de56b4fbd46d704109956'O; template (value) octetstring m_aaCertificate := '02016da94961ba3e28810210455453495f506c7567746573745f41418091000004c368a797aa7943e4176aa5004d37eec5e12b92fea6b9630a9e197a10702f0f495c775d0e12bdbb21eb18648409443072ff2a383d51b5f7a5a7dca88434b5bb8801010004b244be4855cbb05cc7302903d043fe36d5abaa1b331b8c4de3e74c212cfac113b244be4855cbb05cc7302903d043fe36d5abaa1b331b8c4de3e74c212cfac11302202006c04080c0408124011464b4031a5617030303181db9cf7c052616001db9566e0526872a1d53f0d00527835000004c004618e92921341bcded2f15c58f50aa3590e59a3a798fe1a3b2364d66d8823b855859920f3e7f96e66f85ce90cee26ac71cb2ee9fbeecb64747ce19c50804'O; template (value) octetstring m_atCertificate := '0201ebdb26e96a88ea1b01008095000004ceb7c449075ce00c1e7e1f997d443194dcf904f01f6149d4287bdcdb3bad251aa882d59fe8747108e2980c663353967a152c5b27cd83e055f93bc9b9da265859010100044d1c988453d69cae826f8a14f46d672d000b777c606a05b1b622a11f356fb2facba1fa6f2fb2ba44d47765dc6062966ded39161a5222799af887508767b657ec0220210ac040800100c04081010024011464b4031a5617030303181db9cf7c052616001db9566e0526872a1d53f0d005278350000050804677f295dbd99a64aaec8d100f07efd14234a6152012fd1371c32ff1e4479543df14c2de7d744c8526ed330bca75f05e30361a25c11dd2c83bbdf495f81f'O; testcase tc_Certificate_02() runs on TCType system TCType { test_decodePDU( mw_certificate_dummy, m_rootCertificate ); } // End of testcase tc_Certificate_02 testcase tc_Certificate_03() runs on TCType system TCType { test_decodePDU( mw_certificate_dummy, m_aaCertificate ); } // End of testcase tc_Certificate_03 testcase tc_Certificate_04() runs on TCType system TCType { test_decodePDU( mw_certificate_dummy, m_atCertificate ); } // End of testcase tc_Certificate_04 testcase tc_Certificate_05() runs on TCType system TCType { var Certificate v_ca; var Certificate v_aa; var Certificate v_at; var bitstring v_encMsg; var integer v_res; var HashedId8 v_hashedId8; var HashedId3 v_hashedId3; // AT certificate v_res := decvalue(oct2bit(m_atCertificate), v_at); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } // AA certificate v_res := decvalue(oct2bit(m_aaCertificate), v_aa); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } // CA certificate v_res := decvalue(oct2bit(m_rootCertificate), v_ca); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } // AT-AA certificates v_hashedId8 := f_calculateDigestFromCertificate(v_aa); if (v_hashedId8 != v_at.signer_info.signerInfo.digest) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_at.signer_info.signerInfo.digest)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } // AA-CA certificate v_hashedId8 := f_calculateDigestFromCertificate(v_ca); log("ca v_hashedId8=", v_hashedId8); log("aa digest=", v_aa.signer_info.signerInfo.digest); if (v_hashedId8 != v_aa.signer_info.signerInfo.digest) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_aa.signer_info.signerInfo.digest)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } // CA-CA certificate v_hashedId8 := f_calculateDigestFromCertificate(v_ca); if (v_hashedId8 != '6DA94961BA3E2881'O) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8('6DA94961BA3E2881'O)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } setverdict(pass, "All Digests match."); } // End of testcase tc_Certificate_05 testcase tc_Certificate_06() runs on TCType system TCType { const octetstring c_rootCertificate := '02000412455453495F506C7567746573745F526F6F748091000004D901D55569384486DD3304FCFD89A970011A66A5F18BC2BB1D492E2BF19B56C3EEEAE3795D67E398081AD6A7E276147F97902C87811B565E302928141AF3EF61010100043B3D45D5DB2F9540BA3EB2644F5920DCB365FDA9F572817DC1FE1EBBB54CD8B51CFF642167EB4492F953655F80007E51569369F3A95EC045CF4D4743E80E1C6602202006C04080C0408124011464B4031A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000FEEBD0AEC2ACB4C20553000190C8874894239446A6949C5421D67C297EC8D2E1DCB4316C5E01B59D6965AE7007F6694821498215D1FB4D3A48BB56F6C21F4D85'O; const octetstring c_aaCertificate := '0201BCEC64124B3681F70210455453495F506C7567746573745F41418091000004B47B1576C9752B022B81CC89319D1F60F833F5F8CBF47EC8DC1E5557E5628BAEDD779C0CBD524911A21EDD6DEAE510BBA782D0F023D4A0AC6FCC239BF8CF0A98010100046EE4A2877E59CE258EDDEEA154F9491D6894E13D491128E1BF414CBE66E43EBD6EE4A2877E59CE258EDDEEA154F9491D6894E13D491128E1BF414CBE66E43EBD02202006C04080C0408124011464B4031A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D005278350000001F386CA0B4B468A83154547AF33ED3B62B706B3A2F39AA00F00C55C13056CC5C6D037B0E51BB41DBC2B6A999CF04012FE34D3C12E32B8AACCF43F690B6613D4'O; const octetstring c_atCertificate := '02016280AF8B397B202A01008095000004AD05720B46FD03AD21544B3F05924E45924F3D2D82C63259B3646309D00A40705B8A36BAA5E14172E38BDE9E1E974130D042A996B90E5BAE6765665452A17A65010100042EF8A6DD5E650B7A31A628B471380E1C2D73E1A33586D08590F667D95123F53CEE26883D1B3C066A388D43DA5A9396FB75C73309A0D50D0A6BF43C315ED42B9E0220210AC040800100C04081010024011464B4031A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D005278350000049EC38CE35F28DE07D3CC922C6DED74EF8514F422D076C0282E8BDFB95564A6C885BE5C7259AC3EAB497D6D9BB7EB4FA84005616A4E0FE4374513F1A9CFD55B7'O; var Certificate v_ca; var Certificate v_aa; var Certificate v_at; var bitstring v_encMsg; var integer v_res; var HashedId8 v_hashedId8; var HashedId3 v_hashedId3; // AT certificate v_res := decvalue(oct2bit(c_atCertificate), v_at); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } // AA certificate v_res := decvalue(oct2bit(c_aaCertificate), v_aa); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } // CA certificate v_res := decvalue(oct2bit(c_rootCertificate), v_ca); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } // AT-AA certificates v_hashedId8 := f_calculateDigestFromCertificate(v_aa); if (v_hashedId8 != v_at.signer_info.signerInfo.digest) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_at.signer_info.signerInfo.digest)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } // AA-CA certificate v_hashedId8 := f_calculateDigestFromCertificate(v_ca); if (v_hashedId8 != v_aa.signer_info.signerInfo.digest) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_aa.signer_info.signerInfo.digest)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } // CA-CA certificate v_hashedId8 := f_calculateDigestFromCertificate(v_ca); if (v_hashedId8 != 'bcec64124b3681f7'O) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8('bcec64124b3681f7'O)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } setverdict(pass, "All Digests match."); } // End of testcase tc_Certificate_06 testcase tc_Certificate_07() runs on TCType system TCType { const octetstring c_rootCertificate := '02000412455453495F506C7567746573745F526F6F748091000004B0280BAABCD2C785974EB25239B6933AA1AF70C2D75190B7B7B53D1E573788F4B41F81BCFF61C8C73D0FCCD602A894C63BF21221E83F015FF1BBD86C92FFE384010100040DC17DEF569DB90C3E4E26B103343E341B328FCFC62B7D169FE9DDD8B7C11448E228BA6A15BB433C03DCAD1F26CAF0FD5773CE25B6C02B82D4AB83CAF70547B902202006C04080C040812401146B4B831A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D00527835000005D052E72F7B299EEB17D20EA1017B490EBA59641ADCE278D8D096D2FA2F91D87A215199038D7717A3F398669ACEAB375B0374585A06D72E4161AD5BB3ADEE400'O; const octetstring c_aaCertificate := '0201071464374303551A0210455453495F506C7567746573745F41418091000004445C581921F79D72A55107984375641C446DFD2A74EB524DB4E00D6C3ADCE038217319C66433EE802632B2EA3B40552541711A092DE2CA59CB7AA8FD8E8EB819010100043B29698A6F21AD6BF17E5E397B85D404846BA7E5B813BF0CFE761649127B40653B29698A6F21AD6BF17E5E397B85D404846BA7E5B813BF0CFE761649127B406502202006C04080C040812401146B4B831A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000CC73A819EE49906B5A27F9EECF94BA74599A834A6A8DCBE0D6F2D1EC3BB79B622596F07B5D0C777CB4478E8D3F34854F69859EF5D0F0C976800BD57571B13A71'O; const octetstring c_atCertificate := '020130734784EEE700B70100809500000478A4897E6AC66EF68AE98839F05038D926661D0130EDD65B1EA733824FA4E606B223240C3CF3697EF2C1EC2F3E5D35875D120C5A27E4DDB7C87E01C236A7CF5201010004CF9EDB415860E74350607D809CD1D1EF0CD072E08DED4537F8E27D9583331910EC79523076F5B530926F0CD35EF48E668BCE3A8FB23930BFCFE438745799D8CD0220210AC040800100C0408101002401146B4B831A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000DD8EE9C52CD6AA87C565781D9C299C7057C6322E0815C4428411CDCE2374293EE9E24B5462CA603DC69278A47707191D1F9A6F0EB166C88569F70451C55EEED4'O; var Certificate v_ca; var Certificate v_aa; var Certificate v_at; var bitstring v_encMsg; var integer v_res; var HashedId8 v_hashedId8; var HashedId3 v_hashedId3; // AT certificate v_res := decvalue(oct2bit(c_atCertificate), v_at); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } v_hashedId8 := f_calculateDigestFromCertificate(v_at); log("AT hashedId8=", v_hashedId8); // AA certificate v_res := decvalue(oct2bit(c_aaCertificate), v_aa); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } // CA certificate v_res := decvalue(oct2bit(c_rootCertificate), v_ca); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } // AT-AA certificates v_hashedId8 := f_calculateDigestFromCertificate(v_aa); if (v_hashedId8 != v_at.signer_info.signerInfo.digest) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_at.signer_info.signerInfo.digest)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } // AA-CA certificate v_hashedId8 := f_calculateDigestFromCertificate(v_ca); if (v_hashedId8 != v_aa.signer_info.signerInfo.digest) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_aa.signer_info.signerInfo.digest)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } // CA-CA certificate v_hashedId8 := f_calculateDigestFromCertificate(v_ca); if (v_hashedId8 != '071464374303551a'O) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8('071464374303551a'O)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } setverdict(pass, "All Digests match."); } // End of testcase tc_Certificate_07 testcase tc_Certificate_V2X_Pilot_PKI_08() runs on TCType system TCType { const octetstring c_rootCertificate := '010100040d50696c6f74504b495f526f6f74808900000410c1b6c130e84711b558e69ce0fbc17de6b9a6c42bb7e1b962ef4cd5b07dadf8d214c65d8b7bd24acce01edfe5f186a94217de25e454763f5d83a1161860d6fc010100049b7d10065669dfe403ceb43e2a57b8061c86b9b8a0adf2ece2fefd5a09872525b89f1d8732a4d761e68446c23fb845cd5c8172d3067b9c61cdefbd6923c1fbc002e00b0105a4ec0110ec21010300000008610502f11fc54ca9d198de0177dd571f12e5945a771e20ceda080a00fbfc0d00b0b38f6ac60c18f2cd79d90c2afe45bd76349e0454817e184f92bf87d7c9b4'O; const octetstring c_rootCertId := '83CA2168B784FC6C'O; const octetstring c_rootCrlCertificate := '010102b98efc434cffbe83ca2168b784fc6c000000010000002308e8352a08e8352a08faaa2a0000000058ed8b300faccc408d68408da414c251f1f922927c3bfa1d35d4cdbec5e2294e7145eb6b673153c7f2311e3ab79183850aee7395b773c628dfbd5fab283695db'O; var Certificate v_decMsg; var HashedId8 v_hashedId8; var integer v_res; // CA certificate v_res := decvalue(oct2bit(c_rootCertificate), v_decMsg); if (v_res != 0) { setverdict(fail, "Decoding failed."); stop; } log("v_rootCertificate: ", v_decMsg); v_hashedId8 := f_calculateDigestFromCertificate(v_decMsg); if (v_hashedId8 != c_rootCertId) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(c_rootCertId)) { setverdict(fail, "HashedId3 digest does not match."); stop; } else { setverdict(pass, "HashedId3 digest match."); } log("v_hashedId8: ", v_hashedId8); // CA CRL certificate // v_res := decvalue(oct2bit(c_rootCrlCertificate), v_decMsg); // if (v_res != 0) { // setverdict(fail, "Decoding failed."); // stop; // } // log("c_rootCrlCertificate: ", v_decMsg); setverdict(pass, "All Digests match."); } // End of testcase tc_Certificate_08 } // End of group certificates group profileCertificates { /** * @desc Validate 'verify signature' external function */ testcase tc_profileCertificates_01() runs on TCType system TCType { var boolean v_result; v_result := f_verifyWithEcdsaNistp256WithSha256( '020130734784EEE700B70100809500000478A4897E6AC66EF68AE98839F05038D926661D0130EDD65B1EA733824FA4E606B223240C3CF3697EF2C1EC2F3E5D35875D120C5A27E4DDB7C87E01C236A7CF5201010004CF9EDB415860E74350607D809CD1D1EF0CD072E08DED4537F8E27D9583331910EC79523076F5B530926F0CD35EF48E668BCE3A8FB23930BFCFE438745799D8CD0220210AC040800100C0408101002401146B4B831A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000DD8EE9C52CD6AA87C565781D9C299C7057C6322E0815C4428411CDCE2374293EE9E24B5462CA603DC69278A47707191D1F9A6F0EB166C88569F70451C55EEED4'O, '0000DD8EE9C52CD6AA87C565781D9C299C7057C6322E0815C4428411CDCE2374293EE9E24B5462CA603DC69278A47707191D1F9A6F0EB166C88569F70451C55EEED4'O, '78A4897E6AC66EF68AE98839F05038D926661D0130EDD65B1EA733824FA4E606'O, 'B223240C3CF3697EF2C1EC2F3E5D35875D120C5A27E4DDB7C87E01C236A7CF52'O ); if (v_result == true) { setverdict(pass, "Certificate verification match"); } else { setverdict(fail, "Certificate verification mismatch"); } } // End of testcase tc_profileCertificates_01 /** * @desc Verify AT certificate signature */ testcase tc_profileCertificates_02() runs on TCType system TCType { var boolean v_result; f_loadCertificates("cfg01"); v_result := f_verifyCertificateSignatureWithIssuingCertificate( vc_atCertificate, vc_aaCertificate ); if (v_result == true) { setverdict(pass, "Certificate verification match"); } else { setverdict(fail, "Certificate verification mismatch"); } } // End of testcase tc_profileCertificates_02 } // End of group profileCertificates } // End of group test_LibItsSecurity_TypesAndValues } // End of module test_LibItsSecurity_TypesAndValues