Loading ePassport/ttcn/ePassport_Altsteps.ttcn +8 −5 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ var octetstring v_rndIcc; var octetstring v_dstCAR, v_atCAR; var charstring v_chr; var octetstring v_certificate, v_signature; var octetstring v_certificate, v_signature, v_publicKey; // reading of the certificate chain [] mrtdport.receive(mw_mseSetDST) -> value v_mseCommand { Loading Loading @@ -182,12 +182,15 @@ // FIXME : ifpresent, ifchosen v_certificate := bit2oct(encvalue(v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate .psoVerifyCertificateOverFullTemplate.cvCertificateBody.tlvValue)); v_publicKey := v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate .psoVerifyCertificateOverFullTemplate.cvCertificateBody.tlvValue.cvPublicKey.tlvValue; v_signature := v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate .psoVerifyCertificateOverFullTemplate.cvDigitalSignature.tlvValue; if (f_verifyCertificate(v_signature, f_getDstCertificate())) { if (f_verifyCertificate(v_signature, f_getDstPublickey())) { // store certificate v_chr := ""; //FIXME f_addTrustedCertificate(v_chr, v_certificate); v_chr := oct2char(v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate .psoVerifyCertificateOverFullTemplate.cvCertificateBody.tlvValue.cvCertificateHolderReference.tlvValue); f_addTrustedCertificate(v_chr, v_publicKey); mrtdport.send(m_responseOK); } Loading ePassport/ttcn/ePassport_Functions.ttcn +19 −12 Original line number Diff line number Diff line Loading @@ -522,7 +522,9 @@ function f_initializeMRTD(in charstring p_configurationId) runs on MRTD { var octetstring v_mrz; var octetstring v_cvcaCert; var octetstring v_cvcaData; var CvCertificate v_cvcaCvCertificate; var integer v_decodeResult; // Load filesystem f_loadPassportConfiguration(p_configurationId); Loading @@ -538,8 +540,13 @@ // FIXME: only in case of terminal authentication // FIXME: read from EF.CVCA f_readFileData(c_fileCvcaCert01, 0, -1, v_cvcaCert); f_addTrustedCertificate("DETESTCVCA00001", v_cvcaCert); f_readFileData(c_fileCvcaCert01, 0, -1, v_cvcaData); v_decodeResult := decvalue(oct2bit(v_cvcaData), v_cvcaCvCertificate); log("v_cvcaCvCertificate: ", v_cvcaCvCertificate); // FIXME check v_decodeREsiult + ispresent f_addTrustedCertificate( oct2char(v_cvcaCvCertificate.tlvValue.cvCertificateBody.tlvValue.cvCertificateHolderReference.tlvValue), v_cvcaCvCertificate.tlvValue.cvCertificateBody.tlvValue.cvPublicKey.tlvValue); } // end f_initializeMRTD Loading Loading @@ -628,7 +635,7 @@ } } // end f_getDst function f_getDstCertificate() runs on MRTD return octetstring { function f_getDstPublickey() runs on MRTD return octetstring { var Chr v_dst := f_getDst(); Loading @@ -636,11 +643,11 @@ return null; } return f_getTrustedCertificate(v_dst); return f_getTrustedPublicKey(v_dst); } // end f_getDstCertificate } // end f_getDstPublickey function f_getTrustedCertificate(in Chr p_chr) runs on MRTD return octetstring { function f_getTrustedPublicKey(in Chr p_chr) runs on MRTD return octetstring { var integer i; Loading @@ -650,22 +657,22 @@ 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; return vc_simu.trustedCertificates[i].publicKey; } } // end f_isTrustedCertificate } // end f_getTrustedPublicKey return null; } // end f_getTrustedCertificate function f_addTrustedCertificate(in Chr p_chr, in octetstring p_certificate) function f_addTrustedCertificate(in Chr p_chr, in octetstring p_publicKey) runs on MRTD { if(not ispresent(vc_simu.trustedCertificates)) { vc_simu.trustedCertificates := {{p_chr, p_certificate}}; vc_simu.trustedCertificates := {{p_chr, p_publicKey}}; } else { vc_simu.trustedCertificates[sizeof(vc_simu.trustedCertificates)] := {p_chr, p_certificate}; vc_simu.trustedCertificates[sizeof(vc_simu.trustedCertificates)] := {p_chr, p_publicKey}; } } // end f_addTrustedCertificate Loading ePassport/ttcn/ePassport_Testcases.ttcn +0 −5 Original line number Diff line number Diff line Loading @@ -819,9 +819,4 @@ module ePassport_Testcases { } // end debug testcase blah() runs on MRTD { var CvCertificateBodyValue v := { cvCertificateProfileIdentifier := { tlvType := '5F29'O, tlvLength := 1, tlvValue := '00'O }, cvCertificationAuthorityReference := { tlvType := '42'O, tlvLength := 15, tlvValue := '444554455354435643413030303031'O }, cvPublicKey := { tlvType := '7F49'O, tlvLength := 79, tlvValue := '060A04007F0007020202020386410442B5527445EEBBA28487542097512BCAA7728C719061FD1586C3A6872CD1BB0CA44F91760A9C9D0769AF050C0A67185EEAF69C9B29A084EBDAF88763A95E49E7'O }, cvCertificateHolderReference := { tlvType := '5F20'O, tlvLength := 13, tlvValue := '44455445535444563030303031'O }, cvCertificateHolderAuthorizationTemplate := { tlvType := '7F4C'O, tlvLength := 14, tlvValue := '060904007F000703010201530183'O }, cvCertificateEffectiveDate := { tlvType := '5F25'O, tlvLength := 6, tlvValue := '010000040105'O }, cvCertificateExpirationDate := { tlvType := '5F24'O, tlvLength := 6, tlvValue := '010000050105'O } }; log(encvalue('AAEE'O)); log(encvalue(v)); } } // end ePassport_Testcases ePassport/ttcn/ePassport_Types.ttcn +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ module ePassport_Types { type charstring Chr; type record Certificate { Chr chr, octetstring certificate octetstring publicKey } } // end simuParamsGroup Loading Loading
ePassport/ttcn/ePassport_Altsteps.ttcn +8 −5 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ var octetstring v_rndIcc; var octetstring v_dstCAR, v_atCAR; var charstring v_chr; var octetstring v_certificate, v_signature; var octetstring v_certificate, v_signature, v_publicKey; // reading of the certificate chain [] mrtdport.receive(mw_mseSetDST) -> value v_mseCommand { Loading Loading @@ -182,12 +182,15 @@ // FIXME : ifpresent, ifchosen v_certificate := bit2oct(encvalue(v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate .psoVerifyCertificateOverFullTemplate.cvCertificateBody.tlvValue)); v_publicKey := v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate .psoVerifyCertificateOverFullTemplate.cvCertificateBody.tlvValue.cvPublicKey.tlvValue; v_signature := v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate .psoVerifyCertificateOverFullTemplate.cvDigitalSignature.tlvValue; if (f_verifyCertificate(v_signature, f_getDstCertificate())) { if (f_verifyCertificate(v_signature, f_getDstPublickey())) { // store certificate v_chr := ""; //FIXME f_addTrustedCertificate(v_chr, v_certificate); v_chr := oct2char(v_psoCommand.payload.performSecurityOperationData.psoVerifyCertificate .psoVerifyCertificateOverFullTemplate.cvCertificateBody.tlvValue.cvCertificateHolderReference.tlvValue); f_addTrustedCertificate(v_chr, v_publicKey); mrtdport.send(m_responseOK); } Loading
ePassport/ttcn/ePassport_Functions.ttcn +19 −12 Original line number Diff line number Diff line Loading @@ -522,7 +522,9 @@ function f_initializeMRTD(in charstring p_configurationId) runs on MRTD { var octetstring v_mrz; var octetstring v_cvcaCert; var octetstring v_cvcaData; var CvCertificate v_cvcaCvCertificate; var integer v_decodeResult; // Load filesystem f_loadPassportConfiguration(p_configurationId); Loading @@ -538,8 +540,13 @@ // FIXME: only in case of terminal authentication // FIXME: read from EF.CVCA f_readFileData(c_fileCvcaCert01, 0, -1, v_cvcaCert); f_addTrustedCertificate("DETESTCVCA00001", v_cvcaCert); f_readFileData(c_fileCvcaCert01, 0, -1, v_cvcaData); v_decodeResult := decvalue(oct2bit(v_cvcaData), v_cvcaCvCertificate); log("v_cvcaCvCertificate: ", v_cvcaCvCertificate); // FIXME check v_decodeREsiult + ispresent f_addTrustedCertificate( oct2char(v_cvcaCvCertificate.tlvValue.cvCertificateBody.tlvValue.cvCertificateHolderReference.tlvValue), v_cvcaCvCertificate.tlvValue.cvCertificateBody.tlvValue.cvPublicKey.tlvValue); } // end f_initializeMRTD Loading Loading @@ -628,7 +635,7 @@ } } // end f_getDst function f_getDstCertificate() runs on MRTD return octetstring { function f_getDstPublickey() runs on MRTD return octetstring { var Chr v_dst := f_getDst(); Loading @@ -636,11 +643,11 @@ return null; } return f_getTrustedCertificate(v_dst); return f_getTrustedPublicKey(v_dst); } // end f_getDstCertificate } // end f_getDstPublickey function f_getTrustedCertificate(in Chr p_chr) runs on MRTD return octetstring { function f_getTrustedPublicKey(in Chr p_chr) runs on MRTD return octetstring { var integer i; Loading @@ -650,22 +657,22 @@ 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; return vc_simu.trustedCertificates[i].publicKey; } } // end f_isTrustedCertificate } // end f_getTrustedPublicKey return null; } // end f_getTrustedCertificate function f_addTrustedCertificate(in Chr p_chr, in octetstring p_certificate) function f_addTrustedCertificate(in Chr p_chr, in octetstring p_publicKey) runs on MRTD { if(not ispresent(vc_simu.trustedCertificates)) { vc_simu.trustedCertificates := {{p_chr, p_certificate}}; vc_simu.trustedCertificates := {{p_chr, p_publicKey}}; } else { vc_simu.trustedCertificates[sizeof(vc_simu.trustedCertificates)] := {p_chr, p_certificate}; vc_simu.trustedCertificates[sizeof(vc_simu.trustedCertificates)] := {p_chr, p_publicKey}; } } // end f_addTrustedCertificate Loading
ePassport/ttcn/ePassport_Testcases.ttcn +0 −5 Original line number Diff line number Diff line Loading @@ -819,9 +819,4 @@ module ePassport_Testcases { } // end debug testcase blah() runs on MRTD { var CvCertificateBodyValue v := { cvCertificateProfileIdentifier := { tlvType := '5F29'O, tlvLength := 1, tlvValue := '00'O }, cvCertificationAuthorityReference := { tlvType := '42'O, tlvLength := 15, tlvValue := '444554455354435643413030303031'O }, cvPublicKey := { tlvType := '7F49'O, tlvLength := 79, tlvValue := '060A04007F0007020202020386410442B5527445EEBBA28487542097512BCAA7728C719061FD1586C3A6872CD1BB0CA44F91760A9C9D0769AF050C0A67185EEAF69C9B29A084EBDAF88763A95E49E7'O }, cvCertificateHolderReference := { tlvType := '5F20'O, tlvLength := 13, tlvValue := '44455445535444563030303031'O }, cvCertificateHolderAuthorizationTemplate := { tlvType := '7F4C'O, tlvLength := 14, tlvValue := '060904007F000703010201530183'O }, cvCertificateEffectiveDate := { tlvType := '5F25'O, tlvLength := 6, tlvValue := '010000040105'O }, cvCertificateExpirationDate := { tlvType := '5F24'O, tlvLength := 6, tlvValue := '010000050105'O } }; log(encvalue('AAEE'O)); log(encvalue(v)); } } // end ePassport_Testcases
ePassport/ttcn/ePassport_Types.ttcn +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ module ePassport_Types { type charstring Chr; type record Certificate { Chr chr, octetstring certificate octetstring publicKey } } // end simuParamsGroup Loading