Loading ePassport/ttcn/ePassport_Altsteps.ttcn +6 −2 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ var CommandExternalOrMutualAuthenticate v_extAuthcommand; var octetstring v_rndIcc; var octetstring v_dstCAR, v_atCAR; var charstring v_chr; var octetstring v_certificate, v_signature; // reading of the certificate chain Loading Loading @@ -172,8 +173,11 @@ // FIXME v_certificate := f_getCertificate(v_psoCommand.payload.genericData.data); v_signature := f_getSignature(v_psoCommand.payload.genericData.data); if (f_verifySignature(v_signature, v_dstCAR)) { //TODO store certificate and CAR if (f_verifyCertificate(v_signature, f_getDstCertificate())) { // store certificate v_chr := ""; //FIXME f_addTrustedCertificate(v_chr, v_certificate); mrtdport.send(m_responseOK); } else { Loading ePassport/ttcn/ePassport_Functions.ttcn +52 −4 Original line number Diff line number Diff line Loading @@ -248,10 +248,21 @@ function f_verifySignature(in octetstring p_signature, in octetstring p_car) return boolean { // TODO return true; } // end f_verifySignature function f_verifyCertificate(in octetstring p_candidateCert, in octetstring p_trustedCert) return boolean { if(p_trustedCert == null) { return false; } return fx_verifyCertificate(p_candidateCert, p_trustedCert); } // end f_verifyCertificate function f_digest(in HashAlgorithm p_algorithm, in octetstring p_data) return octetstring { return fx_digest(p_algorithm, p_data); } //end f_digest Loading Loading @@ -534,7 +545,7 @@ } for(i:=0; i<sizeof(vc_simu.trustedCertificates); i:=i+1) { if(p_chr == vc_simu.trustedCertificates[i]) { if(p_chr == vc_simu.trustedCertificates[i].chr) { return true; } } // end f_isTrustedCertificate Loading @@ -544,7 +555,7 @@ function f_setDst(in Chr p_chr) runs on MRTD { vc_simu.dst := p_chr; } } // end f_setDst function f_getDst() runs on MRTD return Chr { if(ispresent(vc_simu.dst)) { Loading @@ -553,8 +564,45 @@ else { return null; } } // end f_getDst function f_getDstCertificate() runs on MRTD return octetstring { var Chr v_dst := f_getDst(); if(v_dst == null) { return null; } return f_getTrustedCertificate(v_dst); } // end f_getDstCertificate function f_getTrustedCertificate(in Chr p_chr) runs on MRTD return octetstring { var integer i; if(not ispresent(vc_simu.trustedCertificates)) { return null; } for(i:=0; i<sizeof(vc_simu.trustedCertificates); i:=i+1) { if(p_chr == vc_simu.trustedCertificates[i].chr) { return vc_simu.trustedCertificates[i].certificate; } } // end f_isTrustedCertificate return null; } // end f_getTrustedCertificate function f_addTrustedCertificate(in Chr p_chr, in octetstring p_certificate) runs on MRTD { vc_simu.trustedCertificates[sizeof(vc_simu.trustedCertificates)] := {p_chr, p_certificate}; } // end f_addTrustedCertificate } // end simuParamsFunctions } // end ePassport_Functions Loading ePassport/ttcn/ePassport_Templates.ttcn +3 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ module ePassport_Templates { template Class mw_class(integer p_channelNumber) := { first := { tag := c_firstInterindustryClass, chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := p_channelNumber Loading @@ -91,6 +92,7 @@ module ePassport_Templates { template Class mw_class_00 := { first := { tag := c_firstInterindustryClass, chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := 0 Loading @@ -99,6 +101,7 @@ module ePassport_Templates { template Class mw_class_01 := { first := { tag := c_firstInterindustryClass, chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := 1 Loading ePassport/ttcn/ePassport_TestSystem.ttcn +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ module ePassport_TestSystem { octetstring dhPrivateKey optional, // DH Private Key - Chip Authentication octetstring aaPrivateKey optional, // KPrAA - Active Authentication ChrList trustedCAs optional, // list of trusted CAs - derived from EF.CVCA ChrList trustedCertificates optional, // list of trusted certificates CertList trustedCertificates optional, // list of trusted certificates // Security Environment Chr dst optional Loading ePassport/ttcn/ePassport_Types.ttcn +7 −2 Original line number Diff line number Diff line Loading @@ -53,8 +53,13 @@ module ePassport_Types { group simuParamsGroup { type set of Chr ChrList; type set of Certificate CertList; type charstring Chr; type record Certificate { Chr chr, octetstring certificate } } // end simuParamsGroup Loading Loading
ePassport/ttcn/ePassport_Altsteps.ttcn +6 −2 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ var CommandExternalOrMutualAuthenticate v_extAuthcommand; var octetstring v_rndIcc; var octetstring v_dstCAR, v_atCAR; var charstring v_chr; var octetstring v_certificate, v_signature; // reading of the certificate chain Loading Loading @@ -172,8 +173,11 @@ // FIXME v_certificate := f_getCertificate(v_psoCommand.payload.genericData.data); v_signature := f_getSignature(v_psoCommand.payload.genericData.data); if (f_verifySignature(v_signature, v_dstCAR)) { //TODO store certificate and CAR if (f_verifyCertificate(v_signature, f_getDstCertificate())) { // store certificate v_chr := ""; //FIXME f_addTrustedCertificate(v_chr, v_certificate); mrtdport.send(m_responseOK); } else { Loading
ePassport/ttcn/ePassport_Functions.ttcn +52 −4 Original line number Diff line number Diff line Loading @@ -248,10 +248,21 @@ function f_verifySignature(in octetstring p_signature, in octetstring p_car) return boolean { // TODO return true; } // end f_verifySignature function f_verifyCertificate(in octetstring p_candidateCert, in octetstring p_trustedCert) return boolean { if(p_trustedCert == null) { return false; } return fx_verifyCertificate(p_candidateCert, p_trustedCert); } // end f_verifyCertificate function f_digest(in HashAlgorithm p_algorithm, in octetstring p_data) return octetstring { return fx_digest(p_algorithm, p_data); } //end f_digest Loading Loading @@ -534,7 +545,7 @@ } for(i:=0; i<sizeof(vc_simu.trustedCertificates); i:=i+1) { if(p_chr == vc_simu.trustedCertificates[i]) { if(p_chr == vc_simu.trustedCertificates[i].chr) { return true; } } // end f_isTrustedCertificate Loading @@ -544,7 +555,7 @@ function f_setDst(in Chr p_chr) runs on MRTD { vc_simu.dst := p_chr; } } // end f_setDst function f_getDst() runs on MRTD return Chr { if(ispresent(vc_simu.dst)) { Loading @@ -553,8 +564,45 @@ else { return null; } } // end f_getDst function f_getDstCertificate() runs on MRTD return octetstring { var Chr v_dst := f_getDst(); if(v_dst == null) { return null; } return f_getTrustedCertificate(v_dst); } // end f_getDstCertificate function f_getTrustedCertificate(in Chr p_chr) runs on MRTD return octetstring { var integer i; if(not ispresent(vc_simu.trustedCertificates)) { return null; } for(i:=0; i<sizeof(vc_simu.trustedCertificates); i:=i+1) { if(p_chr == vc_simu.trustedCertificates[i].chr) { return vc_simu.trustedCertificates[i].certificate; } } // end f_isTrustedCertificate return null; } // end f_getTrustedCertificate function f_addTrustedCertificate(in Chr p_chr, in octetstring p_certificate) runs on MRTD { vc_simu.trustedCertificates[sizeof(vc_simu.trustedCertificates)] := {p_chr, p_certificate}; } // end f_addTrustedCertificate } // end simuParamsFunctions } // end ePassport_Functions Loading
ePassport/ttcn/ePassport_Templates.ttcn +3 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ module ePassport_Templates { template Class mw_class(integer p_channelNumber) := { first := { tag := c_firstInterindustryClass, chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := p_channelNumber Loading @@ -91,6 +92,7 @@ module ePassport_Templates { template Class mw_class_00 := { first := { tag := c_firstInterindustryClass, chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := 0 Loading @@ -99,6 +101,7 @@ module ePassport_Templates { template Class mw_class_01 := { first := { tag := c_firstInterindustryClass, chaining := e_lastOrOnlyCommand, sm := e_noSM, channelNumber := 1 Loading
ePassport/ttcn/ePassport_TestSystem.ttcn +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ module ePassport_TestSystem { octetstring dhPrivateKey optional, // DH Private Key - Chip Authentication octetstring aaPrivateKey optional, // KPrAA - Active Authentication ChrList trustedCAs optional, // list of trusted CAs - derived from EF.CVCA ChrList trustedCertificates optional, // list of trusted certificates CertList trustedCertificates optional, // list of trusted certificates // Security Environment Chr dst optional Loading
ePassport/ttcn/ePassport_Types.ttcn +7 −2 Original line number Diff line number Diff line Loading @@ -53,8 +53,13 @@ module ePassport_Types { group simuParamsGroup { type set of Chr ChrList; type set of Certificate CertList; type charstring Chr; type record Certificate { Chr chr, octetstring certificate } } // end simuParamsGroup Loading