Loading ePassport/ttcn/ePassport_Functions.ttcn +32 −33 Original line number Diff line number Diff line /* /** * @author ETSI * @version $URL: $ * $Id: $ * @version $URL$ * $Id$ * @desc This module contains message definitions related to the test cases for testing ePassport devices. * * Loading @@ -22,8 +22,7 @@ const octetstring c_rnd_icc:='81d989f97303f9c6'O; group externalFunctions { // The Test Adapter should have filled an array of hexstring with the content of the file // The TTCN requests here datalength hexstring values of the file=filename, from pointer pt Loading @@ -37,7 +36,7 @@ external function fx_verify_Certificate( in octetstring p_psodata ) return boole external function fx_verify_Signature( in octetstring p_signature ) return boolean; } //function for initializing the system and start the ePassport procedure Loading Loading @@ -115,8 +114,8 @@ function f_waitRead(inout template EFfile p_file) runs on MRTD var charstring v_activefile:= "000000"; var Oct2 v_offset:='0000'O; var integer v_size:=0; var ResponseData v_data; var octetstring v_datalength; var PlainTextResponseData v_data; var LengthE v_datalength; var Oct2 w1w2:='6400'O; // must be initialized to right value !!! Loading @@ -137,10 +136,10 @@ function f_waitRead(inout template EFfile p_file) runs on MRTD { v_offset:=bit2oct('00000000'B & v_command.p2); // the offset must be 256 bytes max. it needs to be defined in the typing !!! v_datalength:=v_command.lengthE; v_datalength:=v_command.payload.plainText.lengthE; v_activefile:=v_file.filename; v_size:= oct2int(v_offset) + oct2int(v_datalength); v_size:= oct2int(v_offset) + v_datalength; Loading Loading @@ -172,7 +171,7 @@ function f_waitRead(inout template EFfile p_file) runs on MRTD v_offset:=bit2oct((v_command.p1) & (v_command.p2)); v_datalength:=v_command.lengthE; v_datalength:=v_command.payload.plainText.lengthE; v_data := fx_findstring(v_activefile, v_offset, v_datalength); Loading Loading @@ -340,9 +339,9 @@ function f_bac () runs on MRTD { var boolean SecureMessage:=false; var Command v_command; var ResponseData v_data; var PlainTextResponseData v_data; var LengthE datalength:='00'O; var LengthE datalength:= 0; //'00'O; // var octetstring v_rnd_ifd; var octetstring v_ifd; var Oct16 Kicc:='000102030405060708090a0b0c0d0e0f'O; // Keying material of MRTD Loading Loading @@ -399,7 +398,7 @@ function f_bac () runs on MRTD // the IS sends the encrypted challenge generated with its keying material // Kpcd and RND of IS and the rnd of the mrtd,then derived form Kenc and Kmac { v_ifd:=v_command.command_data; v_ifd:=v_command.payload.plainText.commandData; // The ICC performs the following operations: // a) Check the checksum M_IFD of the cryptogram E_IFD. Loading Loading @@ -472,14 +471,14 @@ function f_activeAuth (inout template EFfile p_file) runs on MRTD var Command v_command; var Oct2 w1w2:='6300'O; var octetstring v_rnd_ifd; var ResponseData v_data; var PlainTextResponseData v_data; // f_waitRead(v_file); // here a template of EF.DG15 alt { [] mrtdport.receive(mw_intauthenticate) -> value v_command { v_rnd_ifd:=v_command.command_data; v_rnd_ifd:=v_command.payload.plainText.commandData; // see Supplement 9303 Annex B for a worked example of MRTD signature calculation v_data:= fx_activeauth (v_rnd_ifd); Loading Loading @@ -522,7 +521,7 @@ function f_chipAuth (inout template EFfile p_file) runs on MRTD alt { [] mrtdport.receive(mw_mse_SetKAT) -> value v_command { v_keyreference:=v_command.command_data; v_keyreference:=v_command.payload.plainText.commandData; // Both the MRTD chip and the inspection system compute the following: // a) The shared secret K = KA(SKPICC;^PKPCD;DPICC) = KA(^SKPCD;PKPICC;DPICC) Loading Loading @@ -564,7 +563,7 @@ function f_terminalAuth (inout template EFfile p_file) runs on MRTD { var EFfile v_file:=valueof(p_file); var Command v_command; var ResponseData v_data; var PlainTextResponseData v_data; var octetstring v_keyreference; var Oct2 w1w2:='6300'O; var octetstring v_signature; Loading @@ -585,7 +584,7 @@ function f_terminalAuth (inout template EFfile p_file) runs on MRTD alt { [] mrtdport.receive(mw_mse_SetAT) -> value v_command { v_keyreference:=v_command.command_data; v_keyreference:=v_command.payload.plainText.commandData; mrtdport.send(m_responseOK); }// end of mse_SetAT Loading Loading @@ -626,7 +625,7 @@ function f_terminalAuth (inout template EFfile p_file) runs on MRTD // the correct Certificate must be passed as parameter in the external function // in order to verify signature. if (fx_verify_Signature(v_command.command_data)) if (fx_verify_Signature(v_command.payload.plainText.commandData)) {mrtdport.send(m_responseOK);} Loading Loading @@ -663,7 +662,7 @@ function f_mse_SetDST() runs on MRTD { [] mrtdport.receive(mw_mse_SetDST) -> value v_command { v_keyreference:=v_command.command_data; v_keyreference:=v_command.payload.plainText.commandData; mrtdport.send(m_responseOK); } Loading @@ -687,7 +686,7 @@ function f_mse_SetDST() runs on MRTD // the correct Certificate must be passed as parameter in the external function // in order to verify IS and DV and link CAVA certificates. if (fx_verify_Certificate(v_command.command_data)) if (fx_verify_Certificate(v_command.payload.plainText.commandData)) {mrtdport.send(m_responseOK);} else {f_error(w1w2);} } Loading ePassport/ttcn/ePassport_MainModule.ttcn +13 −6 Original line number Diff line number Diff line /** * @author ETSI * @version $URL$ * $Id$ * @desc Main module for testing ePassport devices. * * */ module ePassport_MainModule { Loading ePassport/ttcn/ePassport_Pics.ttcn +3 −3 Original line number Diff line number Diff line /** * @author * @version $URL: $ * $Id: $ * @author ETSI * @version $URL$ * $Id$ * @desc This module contains PICS parameters related to the test cases for testing ePassport devices. * */ Loading ePassport/ttcn/ePassport_Pixits.ttcn +3 −3 Original line number Diff line number Diff line /** * @author * @version $URL: $ * $Id: $ * @author ETSI * @version $URL$ * $Id$ * @desc This module contains PIXIT parameters related to the test cases for testing ePassport devices * When Testing a ePassport Reader device (Inspection System), the operator shall complete the PICS/PIXIT parameters contained in: * - the Common_parameters group Loading ePassport/ttcn/ePassport_Templates.ttcn +411 −443 Original line number Diff line number Diff line /* * @author * @version $URL: $ * $Id: $ /** * @author ETSI * @version $URL$ * $Id$ * @desc Collection of templates and constants. * */ Loading @@ -13,6 +13,7 @@ module ePassport_Templates { //Ats import from ePassport_Types all; import from ePassport_Values all; import from ePassport_Pixits all; // fake variable need to be declared later with the test mode Loading @@ -20,117 +21,143 @@ module ePassport_Templates { // It may contain the certificate for the IS // TEMPLATES m_start template Response m_start := { response_data:=omit, w1w2:='9999'O responseData := omit, w1w2 := '9999'O // ??? } template Payload mw_payload( template CommandData p_commandData, template LengthE p_lengthE) := { plainText := { commandData := p_commandData, lengthE := p_lengthE } } template Class mw_class_00 := { first := { chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := 0 } } template Class mw_class_01 := { first := { chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := 1 } } // TEMPLATES m_get_data_certificate see Automatic Interface Proposal template Command mw_getdata_cert := { class:='01'O, ins:='ca'O, class := mw_class_01, ins := e_getData, p1 := '00000001'B, // values for Certificate reference ID p2 := '11110001'B, lengthC:=omit, command_data:=omit, lengthE:='00'O payload := mw_payload(omit, 0) } // TEMPLATES m_setdata_cert template Response m_setdata_cert := { // to be change later by defining a real function to provide certificate to the IS !!! response_data:=omit, w1w2:='9999'O responseData := omit, w1w2 := '9999'O // ??? } // TEMPLATES m_get_data_MRZ template Command mw_getdata_mrz := { class:='01'O, ins:='ca'O, class := mw_class_01, ins := e_getData, p1 := '00000001'B, p2 := '11110010'B, lengthC:=omit, command_data:=omit, lengthE:='00'O payload := mw_payload(omit, 0) } template ResponseData m_responseData(template PlainTextResponseData p_responseData) := { plainTextResponseData := p_responseData } // TEMPLATES m_start template Response m_setdata_mrz := { response_data:=char2oct(PXT_MRZ), // to be change later by providing real data !!! w1w2:='9000'O responseData := m_responseData(char2oct(PXT_MRZ)), // to be change later by providing real data !!! w1w2 := c_normalProcessing } // TEMPLATES mw_report template Command mw_report(Oct2 v_failCode) := { class:='01'O, ins:='da'O, class := mw_class_01, ins := e_putDataWithDataBytes, //'da'O, p1 := '00001111'B, p2 := ?, lengthC:='02'O, command_data:=v_failCode, lengthE:=omit payload := mw_payload(v_failCode, 0) } group Simple_files_templates { group Simple_files_templates { // TEMPLATES EF.COM file template EFfile m_EF_COM := { filename := "EF.COM", shortFID := '1e'O, fileID := '011e'O, filesize:=PXT_SIZE_EFCOM} filesize := PXT_SIZE_EFCOM } // TEMPLATES EF.SOD file template EFfile m_EF_SOD := { filename := "EF.SOD", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES DG1 file template EFfile m_DG1 := { filename := "EF.DG1", shortFID := '01'O, fileID := '0101'O, filesize:=PXT_SIZE_DG1} filesize := PXT_SIZE_DG1 } // TEMPLATES DG2 file template EFfile m_DG2 := { filename := "EF.DG2", shortFID := '02'O, fileID := '0102'O, filesize:=PXT_SIZE_DG2} filesize := PXT_SIZE_DG2 } // TEMPLATES DG3 file template EFfile m_DG3 := { filename := "EF.DG3", shortFID := '03'O, fileID := '0103'O, filesize:=PXT_SIZE_DG3} filesize := PXT_SIZE_DG3 } // TEMPLATES DG4 file template EFfile m_DG4 := { filename := "EF.DG4", shortFID := '04'O, fileID := '0104'O, filesize:=PXT_SIZE_DG4} filesize := PXT_SIZE_DG4 } // TEMPLATES DG14 file template EFfile m_DG14 := { filename := "EF.DG14", shortFID := '0e'O, fileID := '010e'O, filesize:=PXT_SIZE_DG14} filesize := PXT_SIZE_DG14 } // TEMPLATES DG15 file template EFfile m_DG15 := { filename := "EF.DG15", shortFID := '0f'O, fileID := '010f'O, filesize:=PXT_SIZE_DG15} filesize := PXT_SIZE_DG15 } // TEMPLATES EF.CVCA file Loading @@ -138,9 +165,8 @@ group Simple_files_templates filename := "EF.CVCA", shortFID := '1c'O, fileID := '011c'O, filesize:=PXT_SIZE_EFCVCA} filesize := PXT_SIZE_EFCVCA } }//group Simple_files_templates Loading @@ -152,82 +178,86 @@ group Modified_files_templates filename := "EF.CVCA.E06", shortFID := '1c'O, fileID := '011c'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES EF.CVCA_E08 file template EFfile m_EF_CVCA_E08 := { filename := "EF.CVCA.E08", shortFID := '1c'O, fileID := '011c'O, filesize:=PXT_SIZE_EFCVCA} filesize := PXT_SIZE_EFCVCA } // TEMPLATES EF.SOD_E08 file template EFfile m_EF_SOD_E08 := { filename := "EF.SOD.E08", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES DG1_LDS_B25 file template EFfile m_DG1_LDS_B25 := { filename := "EF.DG1.LDS_B25", shortFID := '01'O, fileID := '0101'O, filesize:=PXT_SIZE_DG1} filesize := PXT_SIZE_DG1 } // TEMPLATES EF.SOD file template EFfile m_EF_SOD_LDS_B25 := { filename := "EF.SOD.LDS_B25", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES DG3_LDS_D12 file template EFfile m_DG3_LDS_D12 := { filename := "EF.DG3.LDS_D12", shortFID := '01'O, fileID := '0101'O, filesize:=PXT_SIZE_DG3} filesize := PXT_SIZE_DG3 } // TEMPLATES EF.SOD file LDS_D12 template EFfile m_EF_SOD_LDS_D12 := { filename := "EF.SOD.LDS_D12", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES DG3_LDS_F04 file template EFfile m_DG14_LDS_F04 := { filename := "EF.DG14.LDS_F04", shortFID := '01'O, fileID := '0101'O, filesize:=PXT_SIZE_DG14} filesize := PXT_SIZE_DG14 } // TEMPLATES EF.SOD file LDS_F04 template EFfile m_EF_SOD_LDS_F04 := { filename := "EF.SOD.LDS_F04", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES EF.SOD file LDS_H37 template EFfile m_EF_SOD_LDS_H37 := { filename := "EF.SOD.LDS_H37", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } } group ConfigSet_templates { // TEMPLATES Configuration set group ConfigSet_templates { // TEMPLATES Configuration set template ConfigurationSet m_cfg_plain := { efcom := m_EF_COM, efsod := m_EF_SOD, Loading @@ -244,8 +274,6 @@ template ConfigurationSet m_cfg_plain := { mrz := PXT_MRZ }; template ConfigurationSet m_cfg_bac := { efcom := m_EF_COM, efsod := m_EF_SOD, Loading @@ -262,9 +290,6 @@ template ConfigurationSet m_cfg_bac := { mrz := PXT_MRZ }; template ConfigurationSet m_cfg_eac := { efcom := m_EF_COM, efsod := m_EF_SOD, Loading Loading @@ -297,8 +322,6 @@ template ConfigurationSet m_cfg_eac_aa := { trustPoint := omit, mrz := PXT_MRZ }; } Loading @@ -306,220 +329,165 @@ group Command_templates { //SELECT TEMPLATES : Send APDU to the passport 00 a4 04 0c 07 a0 00 00 02 47 10 01 template Command mw_application := { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := '00000100'B, p2 := '00001100'B, lengthC:='07'O, command_data:='a0000002471001'O, lengthE:=omit payload := mw_payload('a0000002471001'O, omit) } //SELECT TEMPLATES 00 a4 02 0c 02 01 1e template Command mw_selectfile := { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := ?, p2 := ?, lengthC:=?, command_data:=?, lengthE:=omit payload := mw_payload(?, omit) } //SELECT TEMPLATES 00 a4 02 0c 02 01 1e template Command mw_selectByFileID (Oct2 v_fileID) := { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := '000000??'B, p2 := '000011??'B, lengthC:='02'O, command_data:=v_fileID, lengthE:=omit payload := mw_payload(v_fileID, omit) } //SELECT TEMPLATES 00 a4 02 0c 02 01 1e template Command mw_selectByFileName:= { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := '00000100'B, p2 := '000011??'B, lengthC:=?, command_data:=?, lengthE:=omit payload := mw_payload(?, omit) } //SELECT TEMPLATES 00 a4 02 0c 02 01 1e template Command mw_selectfile_EF_COM:= { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := '00000100'B, p2 := '000011??'B, lengthC:='02'O, command_data:='011e'O, lengthE:=omit payload := mw_payload('011e'O, omit) } template Command mw_readbinary := { class:='00'O, ins:='b0'O, class := mw_class_00, ins := e_readBinary, //'b0'O, p1 := ?, p2 := ?, lengthC:=?, command_data:=omit, lengthE:=? payload := mw_payload(omit, ?) } template Command mw_readActiveEF := { class:='00'O, ins:='b0'O, class := mw_class_00, ins := e_readBinary, //'b0'O, p1 := '0???????'B, p2 := ?, lengthC:=?, command_data:=omit, lengthE:=? payload := mw_payload(omit, ?) } template Command mw_readShortEF (Oct1 v_shortFID) := { class:='00'O, ins:='b0'O, class := mw_class_00, ins := e_readBinary, //'b0'O, p1 := (oct2bit(v_shortFID) or4b '10000000'B), // '100?????'B, p2 := ?, lengthC:=omit, command_data:=omit, lengthE:=? payload := mw_payload(omit, ?) } template Command mw_readbinary_EF_COM := { //00 b0 9e 00 06 class:='00'O, ins:='b0'O, class := mw_class_00, ins := e_readBinary, //'b0'O, p1 := '10011110'B, // '100?????'B, p2 := '00000000'B, lengthC:=omit, command_data:=omit, lengthE:=? payload := mw_payload(omit, ?) } template Command mw_getchallenge := { class:='00'O, ins:='84'O, class := mw_class_00, ins := e_getChallenge, //'84'O, p1 := '00000000'B, //to change p2 := '00000000'B, //to change lengthC:=omit, command_data:=omit, lengthE:='08'O payload := mw_payload(omit, ?) //8? } template Command mw_extauthenticate:= { class:='00'O, ins:='82'O, class := mw_class_00, ins := e_externalOrMutualAuthenticate, //'82'O, p1 := '00000000'B, //to change p2 := '00000000'B, //to change lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_mse_SetDST:= { class:='00'O, ins:='22'O, class := mw_class_00, ins := e_manageSecurityEnvironment, //'22'O, p1 := '1??????1'B, //to change p2 := '10110110'B, //to change //p1p2:= '81b6 'O, //meaning Set DST b8 of P1 and P2=B6 lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_mse_SetKAT:= { class:='00'O, ins:='22'O, class := mw_class_00, ins := e_manageSecurityEnvironment, //'22'O, p1 := '01000001'B, //meaning Set DST defined by bit7 of P1 and P2=A6 means KAT p2 := '10100110'B, //meaning Set DST defined by bit7 of P1 and P2=A6 means KAT lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_intauthenticate:= { ////// to modify : wrong template class:='00'O, ins:='82'O, class := mw_class_00, ins := e_externalOrMutualAuthenticate, //'82'O, p1 := '00000000'B, //to change p2 := '00000000'B, //to change lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_mse_SetAT:= { class:='00'O, ins:='22'O, class := mw_class_00, ins := e_manageSecurityEnvironment, //'22'O, p1 := '10000001'B, // need to define correct P1 !!!! p2 := '10100100'B, //need to define correct P2 !!! lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_pso_VerifyCertificate:= { class:='00'O, ins:='2a'O, class := mw_class_00, ins := e_performSecurityOperation, //'2a'O, p1 := '00000000'B, //need to define correct P1 !!! p2 := '10111110'B, //need to define correct P2 !!! lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } } group Response_templates { group Response_templates { // Response OK template Response m_responseOK :={ template Response m_responseOK := { responseData := omit, w1w2:='9000'O w1w2 := c_normalProcessing } // Response Data Template template Response m_responseNOK(W1W2status v_w1w2) :={ template Response m_responseNOK(W1W2Status v_w1w2) := { responseData := omit, w1w2 := v_w1w2 } // Response Data Template template Response m_response_read(ResponseData v_data) :={ responseData:= v_data, w1w2:='9000'O template Response m_response_read(template PlainTextResponseData v_data) := { responseData := {PlainTextResponseData := v_data}, w1w2 := c_normalProcessing } // Response Data Template template Response m_response(ResponseData v_data, W1W2status v_w1w2) :={ template Response m_response(ResponseData v_data, W1W2Status v_w1w2) := { responseData := v_data, w1w2 := v_w1w2 } } } // end ePassport_Templates Loading
ePassport/ttcn/ePassport_Functions.ttcn +32 −33 Original line number Diff line number Diff line /* /** * @author ETSI * @version $URL: $ * $Id: $ * @version $URL$ * $Id$ * @desc This module contains message definitions related to the test cases for testing ePassport devices. * * Loading @@ -22,8 +22,7 @@ const octetstring c_rnd_icc:='81d989f97303f9c6'O; group externalFunctions { // The Test Adapter should have filled an array of hexstring with the content of the file // The TTCN requests here datalength hexstring values of the file=filename, from pointer pt Loading @@ -37,7 +36,7 @@ external function fx_verify_Certificate( in octetstring p_psodata ) return boole external function fx_verify_Signature( in octetstring p_signature ) return boolean; } //function for initializing the system and start the ePassport procedure Loading Loading @@ -115,8 +114,8 @@ function f_waitRead(inout template EFfile p_file) runs on MRTD var charstring v_activefile:= "000000"; var Oct2 v_offset:='0000'O; var integer v_size:=0; var ResponseData v_data; var octetstring v_datalength; var PlainTextResponseData v_data; var LengthE v_datalength; var Oct2 w1w2:='6400'O; // must be initialized to right value !!! Loading @@ -137,10 +136,10 @@ function f_waitRead(inout template EFfile p_file) runs on MRTD { v_offset:=bit2oct('00000000'B & v_command.p2); // the offset must be 256 bytes max. it needs to be defined in the typing !!! v_datalength:=v_command.lengthE; v_datalength:=v_command.payload.plainText.lengthE; v_activefile:=v_file.filename; v_size:= oct2int(v_offset) + oct2int(v_datalength); v_size:= oct2int(v_offset) + v_datalength; Loading Loading @@ -172,7 +171,7 @@ function f_waitRead(inout template EFfile p_file) runs on MRTD v_offset:=bit2oct((v_command.p1) & (v_command.p2)); v_datalength:=v_command.lengthE; v_datalength:=v_command.payload.plainText.lengthE; v_data := fx_findstring(v_activefile, v_offset, v_datalength); Loading Loading @@ -340,9 +339,9 @@ function f_bac () runs on MRTD { var boolean SecureMessage:=false; var Command v_command; var ResponseData v_data; var PlainTextResponseData v_data; var LengthE datalength:='00'O; var LengthE datalength:= 0; //'00'O; // var octetstring v_rnd_ifd; var octetstring v_ifd; var Oct16 Kicc:='000102030405060708090a0b0c0d0e0f'O; // Keying material of MRTD Loading Loading @@ -399,7 +398,7 @@ function f_bac () runs on MRTD // the IS sends the encrypted challenge generated with its keying material // Kpcd and RND of IS and the rnd of the mrtd,then derived form Kenc and Kmac { v_ifd:=v_command.command_data; v_ifd:=v_command.payload.plainText.commandData; // The ICC performs the following operations: // a) Check the checksum M_IFD of the cryptogram E_IFD. Loading Loading @@ -472,14 +471,14 @@ function f_activeAuth (inout template EFfile p_file) runs on MRTD var Command v_command; var Oct2 w1w2:='6300'O; var octetstring v_rnd_ifd; var ResponseData v_data; var PlainTextResponseData v_data; // f_waitRead(v_file); // here a template of EF.DG15 alt { [] mrtdport.receive(mw_intauthenticate) -> value v_command { v_rnd_ifd:=v_command.command_data; v_rnd_ifd:=v_command.payload.plainText.commandData; // see Supplement 9303 Annex B for a worked example of MRTD signature calculation v_data:= fx_activeauth (v_rnd_ifd); Loading Loading @@ -522,7 +521,7 @@ function f_chipAuth (inout template EFfile p_file) runs on MRTD alt { [] mrtdport.receive(mw_mse_SetKAT) -> value v_command { v_keyreference:=v_command.command_data; v_keyreference:=v_command.payload.plainText.commandData; // Both the MRTD chip and the inspection system compute the following: // a) The shared secret K = KA(SKPICC;^PKPCD;DPICC) = KA(^SKPCD;PKPICC;DPICC) Loading Loading @@ -564,7 +563,7 @@ function f_terminalAuth (inout template EFfile p_file) runs on MRTD { var EFfile v_file:=valueof(p_file); var Command v_command; var ResponseData v_data; var PlainTextResponseData v_data; var octetstring v_keyreference; var Oct2 w1w2:='6300'O; var octetstring v_signature; Loading @@ -585,7 +584,7 @@ function f_terminalAuth (inout template EFfile p_file) runs on MRTD alt { [] mrtdport.receive(mw_mse_SetAT) -> value v_command { v_keyreference:=v_command.command_data; v_keyreference:=v_command.payload.plainText.commandData; mrtdport.send(m_responseOK); }// end of mse_SetAT Loading Loading @@ -626,7 +625,7 @@ function f_terminalAuth (inout template EFfile p_file) runs on MRTD // the correct Certificate must be passed as parameter in the external function // in order to verify signature. if (fx_verify_Signature(v_command.command_data)) if (fx_verify_Signature(v_command.payload.plainText.commandData)) {mrtdport.send(m_responseOK);} Loading Loading @@ -663,7 +662,7 @@ function f_mse_SetDST() runs on MRTD { [] mrtdport.receive(mw_mse_SetDST) -> value v_command { v_keyreference:=v_command.command_data; v_keyreference:=v_command.payload.plainText.commandData; mrtdport.send(m_responseOK); } Loading @@ -687,7 +686,7 @@ function f_mse_SetDST() runs on MRTD // the correct Certificate must be passed as parameter in the external function // in order to verify IS and DV and link CAVA certificates. if (fx_verify_Certificate(v_command.command_data)) if (fx_verify_Certificate(v_command.payload.plainText.commandData)) {mrtdport.send(m_responseOK);} else {f_error(w1w2);} } Loading
ePassport/ttcn/ePassport_MainModule.ttcn +13 −6 Original line number Diff line number Diff line /** * @author ETSI * @version $URL$ * $Id$ * @desc Main module for testing ePassport devices. * * */ module ePassport_MainModule { Loading
ePassport/ttcn/ePassport_Pics.ttcn +3 −3 Original line number Diff line number Diff line /** * @author * @version $URL: $ * $Id: $ * @author ETSI * @version $URL$ * $Id$ * @desc This module contains PICS parameters related to the test cases for testing ePassport devices. * */ Loading
ePassport/ttcn/ePassport_Pixits.ttcn +3 −3 Original line number Diff line number Diff line /** * @author * @version $URL: $ * $Id: $ * @author ETSI * @version $URL$ * $Id$ * @desc This module contains PIXIT parameters related to the test cases for testing ePassport devices * When Testing a ePassport Reader device (Inspection System), the operator shall complete the PICS/PIXIT parameters contained in: * - the Common_parameters group Loading
ePassport/ttcn/ePassport_Templates.ttcn +411 −443 Original line number Diff line number Diff line /* * @author * @version $URL: $ * $Id: $ /** * @author ETSI * @version $URL$ * $Id$ * @desc Collection of templates and constants. * */ Loading @@ -13,6 +13,7 @@ module ePassport_Templates { //Ats import from ePassport_Types all; import from ePassport_Values all; import from ePassport_Pixits all; // fake variable need to be declared later with the test mode Loading @@ -20,117 +21,143 @@ module ePassport_Templates { // It may contain the certificate for the IS // TEMPLATES m_start template Response m_start := { response_data:=omit, w1w2:='9999'O responseData := omit, w1w2 := '9999'O // ??? } template Payload mw_payload( template CommandData p_commandData, template LengthE p_lengthE) := { plainText := { commandData := p_commandData, lengthE := p_lengthE } } template Class mw_class_00 := { first := { chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := 0 } } template Class mw_class_01 := { first := { chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := 1 } } // TEMPLATES m_get_data_certificate see Automatic Interface Proposal template Command mw_getdata_cert := { class:='01'O, ins:='ca'O, class := mw_class_01, ins := e_getData, p1 := '00000001'B, // values for Certificate reference ID p2 := '11110001'B, lengthC:=omit, command_data:=omit, lengthE:='00'O payload := mw_payload(omit, 0) } // TEMPLATES m_setdata_cert template Response m_setdata_cert := { // to be change later by defining a real function to provide certificate to the IS !!! response_data:=omit, w1w2:='9999'O responseData := omit, w1w2 := '9999'O // ??? } // TEMPLATES m_get_data_MRZ template Command mw_getdata_mrz := { class:='01'O, ins:='ca'O, class := mw_class_01, ins := e_getData, p1 := '00000001'B, p2 := '11110010'B, lengthC:=omit, command_data:=omit, lengthE:='00'O payload := mw_payload(omit, 0) } template ResponseData m_responseData(template PlainTextResponseData p_responseData) := { plainTextResponseData := p_responseData } // TEMPLATES m_start template Response m_setdata_mrz := { response_data:=char2oct(PXT_MRZ), // to be change later by providing real data !!! w1w2:='9000'O responseData := m_responseData(char2oct(PXT_MRZ)), // to be change later by providing real data !!! w1w2 := c_normalProcessing } // TEMPLATES mw_report template Command mw_report(Oct2 v_failCode) := { class:='01'O, ins:='da'O, class := mw_class_01, ins := e_putDataWithDataBytes, //'da'O, p1 := '00001111'B, p2 := ?, lengthC:='02'O, command_data:=v_failCode, lengthE:=omit payload := mw_payload(v_failCode, 0) } group Simple_files_templates { group Simple_files_templates { // TEMPLATES EF.COM file template EFfile m_EF_COM := { filename := "EF.COM", shortFID := '1e'O, fileID := '011e'O, filesize:=PXT_SIZE_EFCOM} filesize := PXT_SIZE_EFCOM } // TEMPLATES EF.SOD file template EFfile m_EF_SOD := { filename := "EF.SOD", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES DG1 file template EFfile m_DG1 := { filename := "EF.DG1", shortFID := '01'O, fileID := '0101'O, filesize:=PXT_SIZE_DG1} filesize := PXT_SIZE_DG1 } // TEMPLATES DG2 file template EFfile m_DG2 := { filename := "EF.DG2", shortFID := '02'O, fileID := '0102'O, filesize:=PXT_SIZE_DG2} filesize := PXT_SIZE_DG2 } // TEMPLATES DG3 file template EFfile m_DG3 := { filename := "EF.DG3", shortFID := '03'O, fileID := '0103'O, filesize:=PXT_SIZE_DG3} filesize := PXT_SIZE_DG3 } // TEMPLATES DG4 file template EFfile m_DG4 := { filename := "EF.DG4", shortFID := '04'O, fileID := '0104'O, filesize:=PXT_SIZE_DG4} filesize := PXT_SIZE_DG4 } // TEMPLATES DG14 file template EFfile m_DG14 := { filename := "EF.DG14", shortFID := '0e'O, fileID := '010e'O, filesize:=PXT_SIZE_DG14} filesize := PXT_SIZE_DG14 } // TEMPLATES DG15 file template EFfile m_DG15 := { filename := "EF.DG15", shortFID := '0f'O, fileID := '010f'O, filesize:=PXT_SIZE_DG15} filesize := PXT_SIZE_DG15 } // TEMPLATES EF.CVCA file Loading @@ -138,9 +165,8 @@ group Simple_files_templates filename := "EF.CVCA", shortFID := '1c'O, fileID := '011c'O, filesize:=PXT_SIZE_EFCVCA} filesize := PXT_SIZE_EFCVCA } }//group Simple_files_templates Loading @@ -152,82 +178,86 @@ group Modified_files_templates filename := "EF.CVCA.E06", shortFID := '1c'O, fileID := '011c'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES EF.CVCA_E08 file template EFfile m_EF_CVCA_E08 := { filename := "EF.CVCA.E08", shortFID := '1c'O, fileID := '011c'O, filesize:=PXT_SIZE_EFCVCA} filesize := PXT_SIZE_EFCVCA } // TEMPLATES EF.SOD_E08 file template EFfile m_EF_SOD_E08 := { filename := "EF.SOD.E08", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES DG1_LDS_B25 file template EFfile m_DG1_LDS_B25 := { filename := "EF.DG1.LDS_B25", shortFID := '01'O, fileID := '0101'O, filesize:=PXT_SIZE_DG1} filesize := PXT_SIZE_DG1 } // TEMPLATES EF.SOD file template EFfile m_EF_SOD_LDS_B25 := { filename := "EF.SOD.LDS_B25", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES DG3_LDS_D12 file template EFfile m_DG3_LDS_D12 := { filename := "EF.DG3.LDS_D12", shortFID := '01'O, fileID := '0101'O, filesize:=PXT_SIZE_DG3} filesize := PXT_SIZE_DG3 } // TEMPLATES EF.SOD file LDS_D12 template EFfile m_EF_SOD_LDS_D12 := { filename := "EF.SOD.LDS_D12", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES DG3_LDS_F04 file template EFfile m_DG14_LDS_F04 := { filename := "EF.DG14.LDS_F04", shortFID := '01'O, fileID := '0101'O, filesize:=PXT_SIZE_DG14} filesize := PXT_SIZE_DG14 } // TEMPLATES EF.SOD file LDS_F04 template EFfile m_EF_SOD_LDS_F04 := { filename := "EF.SOD.LDS_F04", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } // TEMPLATES EF.SOD file LDS_H37 template EFfile m_EF_SOD_LDS_H37 := { filename := "EF.SOD.LDS_H37", shortFID := '1d'O, fileID := '011d'O, filesize:=PXT_SIZE_EFSOD} filesize := PXT_SIZE_EFSOD } } group ConfigSet_templates { // TEMPLATES Configuration set group ConfigSet_templates { // TEMPLATES Configuration set template ConfigurationSet m_cfg_plain := { efcom := m_EF_COM, efsod := m_EF_SOD, Loading @@ -244,8 +274,6 @@ template ConfigurationSet m_cfg_plain := { mrz := PXT_MRZ }; template ConfigurationSet m_cfg_bac := { efcom := m_EF_COM, efsod := m_EF_SOD, Loading @@ -262,9 +290,6 @@ template ConfigurationSet m_cfg_bac := { mrz := PXT_MRZ }; template ConfigurationSet m_cfg_eac := { efcom := m_EF_COM, efsod := m_EF_SOD, Loading Loading @@ -297,8 +322,6 @@ template ConfigurationSet m_cfg_eac_aa := { trustPoint := omit, mrz := PXT_MRZ }; } Loading @@ -306,220 +329,165 @@ group Command_templates { //SELECT TEMPLATES : Send APDU to the passport 00 a4 04 0c 07 a0 00 00 02 47 10 01 template Command mw_application := { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := '00000100'B, p2 := '00001100'B, lengthC:='07'O, command_data:='a0000002471001'O, lengthE:=omit payload := mw_payload('a0000002471001'O, omit) } //SELECT TEMPLATES 00 a4 02 0c 02 01 1e template Command mw_selectfile := { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := ?, p2 := ?, lengthC:=?, command_data:=?, lengthE:=omit payload := mw_payload(?, omit) } //SELECT TEMPLATES 00 a4 02 0c 02 01 1e template Command mw_selectByFileID (Oct2 v_fileID) := { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := '000000??'B, p2 := '000011??'B, lengthC:='02'O, command_data:=v_fileID, lengthE:=omit payload := mw_payload(v_fileID, omit) } //SELECT TEMPLATES 00 a4 02 0c 02 01 1e template Command mw_selectByFileName:= { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := '00000100'B, p2 := '000011??'B, lengthC:=?, command_data:=?, lengthE:=omit payload := mw_payload(?, omit) } //SELECT TEMPLATES 00 a4 02 0c 02 01 1e template Command mw_selectfile_EF_COM:= { class:='00'O, ins:='a4'O, class := mw_class_00, ins := e_select, //'a4'O, p1 := '00000100'B, p2 := '000011??'B, lengthC:='02'O, command_data:='011e'O, lengthE:=omit payload := mw_payload('011e'O, omit) } template Command mw_readbinary := { class:='00'O, ins:='b0'O, class := mw_class_00, ins := e_readBinary, //'b0'O, p1 := ?, p2 := ?, lengthC:=?, command_data:=omit, lengthE:=? payload := mw_payload(omit, ?) } template Command mw_readActiveEF := { class:='00'O, ins:='b0'O, class := mw_class_00, ins := e_readBinary, //'b0'O, p1 := '0???????'B, p2 := ?, lengthC:=?, command_data:=omit, lengthE:=? payload := mw_payload(omit, ?) } template Command mw_readShortEF (Oct1 v_shortFID) := { class:='00'O, ins:='b0'O, class := mw_class_00, ins := e_readBinary, //'b0'O, p1 := (oct2bit(v_shortFID) or4b '10000000'B), // '100?????'B, p2 := ?, lengthC:=omit, command_data:=omit, lengthE:=? payload := mw_payload(omit, ?) } template Command mw_readbinary_EF_COM := { //00 b0 9e 00 06 class:='00'O, ins:='b0'O, class := mw_class_00, ins := e_readBinary, //'b0'O, p1 := '10011110'B, // '100?????'B, p2 := '00000000'B, lengthC:=omit, command_data:=omit, lengthE:=? payload := mw_payload(omit, ?) } template Command mw_getchallenge := { class:='00'O, ins:='84'O, class := mw_class_00, ins := e_getChallenge, //'84'O, p1 := '00000000'B, //to change p2 := '00000000'B, //to change lengthC:=omit, command_data:=omit, lengthE:='08'O payload := mw_payload(omit, ?) //8? } template Command mw_extauthenticate:= { class:='00'O, ins:='82'O, class := mw_class_00, ins := e_externalOrMutualAuthenticate, //'82'O, p1 := '00000000'B, //to change p2 := '00000000'B, //to change lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_mse_SetDST:= { class:='00'O, ins:='22'O, class := mw_class_00, ins := e_manageSecurityEnvironment, //'22'O, p1 := '1??????1'B, //to change p2 := '10110110'B, //to change //p1p2:= '81b6 'O, //meaning Set DST b8 of P1 and P2=B6 lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_mse_SetKAT:= { class:='00'O, ins:='22'O, class := mw_class_00, ins := e_manageSecurityEnvironment, //'22'O, p1 := '01000001'B, //meaning Set DST defined by bit7 of P1 and P2=A6 means KAT p2 := '10100110'B, //meaning Set DST defined by bit7 of P1 and P2=A6 means KAT lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_intauthenticate:= { ////// to modify : wrong template class:='00'O, ins:='82'O, class := mw_class_00, ins := e_externalOrMutualAuthenticate, //'82'O, p1 := '00000000'B, //to change p2 := '00000000'B, //to change lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_mse_SetAT:= { class:='00'O, ins:='22'O, class := mw_class_00, ins := e_manageSecurityEnvironment, //'22'O, p1 := '10000001'B, // need to define correct P1 !!!! p2 := '10100100'B, //need to define correct P2 !!! lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } template Command mw_pso_VerifyCertificate:= { class:='00'O, ins:='2a'O, class := mw_class_00, ins := e_performSecurityOperation, //'2a'O, p1 := '00000000'B, //need to define correct P1 !!! p2 := '10111110'B, //need to define correct P2 !!! lengthC:=?, command_data:=?, lengthE:=? payload := mw_payload(?, ?) } } group Response_templates { group Response_templates { // Response OK template Response m_responseOK :={ template Response m_responseOK := { responseData := omit, w1w2:='9000'O w1w2 := c_normalProcessing } // Response Data Template template Response m_responseNOK(W1W2status v_w1w2) :={ template Response m_responseNOK(W1W2Status v_w1w2) := { responseData := omit, w1w2 := v_w1w2 } // Response Data Template template Response m_response_read(ResponseData v_data) :={ responseData:= v_data, w1w2:='9000'O template Response m_response_read(template PlainTextResponseData v_data) := { responseData := {PlainTextResponseData := v_data}, w1w2 := c_normalProcessing } // Response Data Template template Response m_response(ResponseData v_data, W1W2status v_w1w2) :={ template Response m_response(ResponseData v_data, W1W2Status v_w1w2) := { responseData := v_data, w1w2 := v_w1w2 } } } // end ePassport_Templates