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" ), false ); } } // 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_SubjectAttribute_09() runs on TCType system TCType { test_PDU( m_subject_attribute_its_aid_list( { 1631, 1632 } ), true, oct2bit('2004865F8660'O) ); } // End of testcase tc_SubjectAttribute_09 testcase tc_SubjectAttribute_10() runs on TCType system TCType { test_PDU( m_subject_attribute_its_aid_ssp_list( { { 1631, { '00'O, omit } }, { 1632, { '00'O, omit } } } ), true, oct2bit('2108865F010086600100'O) ); } // End of testcase tc_SubjectAttribute_10 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 testcase tc_ValidityRestriction_05() runs on TCType system TCType { test_PDU( m_validity_restriction_region( m_geographicRegion_circle( { 43616908, 7052847 }, 10000 ) ) ); } // End of testcase tc_ValidityRestriction_05 /** * @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; var boolean isSignatureOk; // 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."); } isSignatureOk := f_verifyCertificateSignatureWithIssuingCertificate( v_at, v_aa ); log("Signature AA/AT: ", isSignatureOk); // 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 /** * Test certificate from Denis tool * @desc * @verdict */ testcase tc_Certificate_07() runs on TCType system TCType { const octetstring c_rootCertificate := '020004004B000004966296BF6D47B5ED66DB32605D1074BCBAC97B5A73FE0D4413F6A1818D6D7E9A966296BF6D47B5ED66DB32605D1074BCBAC97B5A73FE0D4413F6A1818D6D7E9A02E02004865F866009014A9618814C774C0100004337D4953FCEBC99FD481A103514CE23B0E85511D2FC55B8CF98941A5436843ACA9B85949F2DF85F9D4D3E8A150EAB3D5004DF0B3DE3972216328615E5A7F816'O; const octetstring c_aaCertificate := '0201e76042b201a5435502004b000004b80fbbf4b87fdc12ebd7f3dcb689ec1bd2f2ab4c76c158ae7cf5cefbd5a65bb8b80fbbf4b87fdc12ebd7f3dcb689ec1bd2f2ab4c76c158ae7cf5cefbd5a65bb802e02004865f866015014a9618814c774c01030119ff697804342dd62710000016852db5022a8799bfe0bd9b0226c87a83e3df70557e27b759119550d5273674b42a7e5586af5d61098dabc7785ac3b4189bad28a9fa7f430824fcd0f464b548'O; const octetstring c_atCertificate := '02012a83ff49822ac92d01004b000004b7e7eab1eb9046831e9b0e868aefb6475b0a6ee8bcd7eadbcb80883f53ae1c51b7e7eab1eb9046831e9b0e868aefb6475b0a6ee8bcd7eadbcb80883f53ae1c5102802104865f010015014a9618814c774c01030119ff697804342dd627100000bcb445ceccdea6b38f196aaab2050d300b966a884a4ac653984b4a3104fbb97cab0d808608cafbb22753d90b0cce256f46830075b6653e973fd56daf99bc4535'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 != 'e76042b201a54355'O) { setverdict(fail, "Digest does not match."); stop; } else { setverdict(pass, "Digest match."); } if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8('e76042b201a54355'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 := '01090183CA2168B784FC6C021050696C6F74504B495F5043415F5349548089000004732CA0163B0E3CD6DE8789FED98DE772F3D54EBFF1D44ED556B683B0D8AE837C8B1EB52F25377244298655CDCB3D3CCEA8CEDA1AA5E57920C97FEC38F2237B0B0101000412FD16EA68D73575651CD7AED08023CFDC38AEE3CCAA178D672AB30A6FE7803CAEFCF1F79A373C7D77D84AE2DD079229D50E5745CD73398FB69D902617A6AAB602E00B0105A4EC0110EC210103000000A9A8140518E0C66DED7568E103C9D3927CF83B6D4692B7FA013BE586FB6BA7A17F0DD28FE14317E2B9F141084166F24F0CBD06AB926197F5F6A39C6003640E6400'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 Verify AT certificate signature */ testcase tc_profileCertificates_01() runs on TCType system TCType { var boolean v_result; f_loadCertificates("cfg01"); log (vc_aaCertificate); log (vc_atCertificate); 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_01 } // End of group profileCertificates } // End of group test_LibItsSecurity_TypesAndValues } // End of module test_LibItsSecurity_TypesAndValues