Commit ca5e93e5 authored by berge's avatar berge
Browse files

Added all ISO7816* TCs.

/!\ 3 TODOs /!\
parent eca30c6e
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -15,15 +15,32 @@ module ePassport_MainModule {

    control {    
    	execute(TC_ISO7816_A02());  
    	
    	execute(TC_ISO7816_B07());
    	execute(TC_ISO7816_B08());
    	
    	execute(TC_ISO7816_C02());
    	execute(TC_ISO7816_C03());
    	
    	execute(TC_ISO7816_D02());
    	execute(TC_ISO7816_D04());
    	execute(TC_ISO7816_D11());  
    	
    	execute(TC_ISO7816_E06());   
    	execute(TC_ISO7816_E08());  
    	execute(TC_ISO7816_E11());
    	execute(TC_ISO7816_E12());   
    	execute(TC_ISO7816_E18());
    	execute(TC_ISO7816_E28());  
    	
    	execute(TC_ISO7816_F05());  
    	
    	execute(TC_LDS_B25());   
    	
    	execute(TC_LDS_D12());  
    	
    	execute(TC_LDS_F04());    
    	
    	execute(TC_LDS_H37());       	
    }
}
+346 −0
Original line number Diff line number Diff line
@@ -67,6 +67,176 @@ module ePassport_Testcases {
        
	} // end groupISO7816_A
	
	group groupISO7816_B {

        // ISO7816_B07 : SM failure – secured status bytes missing
        // This test verifies that the inspection system recognizes an incorrect R-APDU in
		// first secure messaging command. Perform standard inspection procedure and
		// read BAC protected data groups from the lower tester.
        // Profile: SIP
        // Configuration file: default BAC
        // Expected results: "ePassport inspection procedure failed"
        // Interface: BAC: FAIL, PA: NP, AA: NP, TA: NP, CA: NP, COM: FAIL
        testcase TC_ISO7816_B07() runs on MRTD system MRTD_System {
        	
            var template IsVerdictList vt_expectedFailResults := {e_aisBacAuthentication, e_aisCommunication};
        	var template IsVerdictList vt_expectedPassResults := {};
    
    		// Preamble
    	   	f_cfUp();
        	f_initializeMRTD("CFG.DFLT.BAC");
        	f_initializeIS(""); 
    	
    		// TODO: The simulator SHALL NOT not return the status bytes (tag 99) in the secured R-APDU
    	
    		// Test Body
    		t_ac.start(PXT_TWAIT);
        	alt {
        		[] a_standardInspectionProcedure();
        
        		[PXT_AUTOMATIC_TEST_INTERFACE] a_aisReports();
         		
        		[] t_ac.timeout {
        			log("**** TC_ISO7816_B07: Timeout: No more communication ****");
        		}
        	}       	    
        	
			f_establishVerdict("TC_ISO7816_B07", vt_expectedFailResults, vt_expectedPassResults);  
			
			// Postamble
			f_cleanUp();
        	
        } // end TC_ISO7816_B07

        // ISO7816_B08 : SM failure – incorrect MAC
        // This test verifies that the inspection system recognizes an SM failure in the R-APDU.
		// Perform standard inspection procedure and read BAC protected data
		// groups from the lower tester.
        // Profile: SIP
        // Configuration file: default BAC
        // Expected results: "ePassport inspection procedure failed"
        // Interface: BAC: FAIL, PA: NP, AA: NP, TA: NP, CA: NP, COM: FAIL
        testcase TC_ISO7816_B08() runs on MRTD system MRTD_System {
        	
            var template IsVerdictList vt_expectedFailResults := {e_aisBacAuthentication, e_aisCommunication};
        	var template IsVerdictList vt_expectedPassResults := {};
    
    		// Preamble
    	   	f_cfUp();
        	f_initializeMRTD("CFG.DFLT.BAC");
        	f_initializeIS(""); 
    	    	
    	    // TODO: The simulator SHALL NOT increase the SSC for the computation
            //of a MAC, which forces a secure messaging failure in the first RAPDU
            //because
            //the MAC data object is incorrect. The SSC is not increased when the first
            //command while reading the EF.DG1 is executed.
    	    	
    		// Test Body
    		t_ac.start(PXT_TWAIT);
        	alt {
        		[] a_standardInspectionProcedure();
        
        		[PXT_AUTOMATIC_TEST_INTERFACE] a_aisReports();
         		
        		[] t_ac.timeout {
        			log("**** TC_ISO7816_B08: Timeout: No more communication ****");
        		}
        	}       	    
        	
			f_establishVerdict("TC_ISO7816_B08", vt_expectedFailResults, vt_expectedPassResults);  
			
			// Postamble
			f_cleanUp();
        	
        } // end TC_ISO7816_B08
	    
	} // end groupISO7816_B
	
	group groupISO7816_C {

        // ISO7816_C02 : Reading large files
        // This test verifies that the inspection system is capable of reading large binary
		// files. Perform standard inspection procedure and read BAC protected data groups
		// from the lower tester. DG2 contains a face image of size larger than 32k.
        // Profile: SIP
        // Configuration file: default BAC + DG2 bigger than 32k
        // Expected results: "ePassport inspection procedure successful"
        // Interface: BAC: PASS, PA: PASS, AA: NP, TA: NP, CA: NP, COM: PASS
        testcase TC_ISO7816_C02() runs on MRTD system MRTD_System {
        	
            var template IsVerdictList vt_expectedFailResults := {};
        	var template IsVerdictList vt_expectedPassResults := {
        		e_aisNoFailure,
        	    e_aisBacAuthentication,
        	    e_aisPassiveAuthentication,
        	    e_aisCommunication
        	};
    
    		// Preamble
    	   	f_cfUp();
        	f_initializeMRTD("CFG.BAC.ISO7816.C02");
        	f_initializeIS(""); 
    	    	
    		// Test Body
    		t_ac.start(PXT_TWAIT);
        	alt {
        		[] a_standardInspectionProcedure();
        
        		[PXT_AUTOMATIC_TEST_INTERFACE] a_aisReports();
         		
        		[] t_ac.timeout {
        			log("**** TC_ISO7816_C02: Timeout: No more communication ****");
        		}
        	}       	    
        	
			f_establishVerdict("TC_ISO7816_C02", vt_expectedFailResults, vt_expectedPassResults);  
			
			// Postamble
			f_cleanUp();
        	
        } // end TC_ISO7816_C02

        // ISO7816_C03 : Reading beyond EOF
        // This test verifies that the inspection system recognizes the end of a binary file.
		// Perform standard inspection procedure and read BAC protected data groups from
  		// the lower tester. DG2 contains parts of a face image stored in a binary file that is
		// too small for the whole image data.
        // Profile: SIP
        // Configuration file: default BAC + DG2 truncated to 200 bytes
        // Expected results: "ePassport inspection procedure failed"
        // Interface: BAC: PASS, PA: NP, AA: NP, TA: NP, CA: NP, COM: FAIL
        testcase TC_ISO7816_C03() runs on MRTD system MRTD_System {
        	
            var template IsVerdictList vt_expectedFailResults := {e_aisCommunication};
        	var template IsVerdictList vt_expectedPassResults := {e_aisBacAuthentication};
    
    		// Preamble
    	   	f_cfUp();
        	f_initializeMRTD("CFG.BAC.ISO7816.C03");
        	f_initializeIS(""); 
    	    	
    		// Test Body
    		t_ac.start(PXT_TWAIT);
        	alt {
        		[] a_standardInspectionProcedure();
        
        		[PXT_AUTOMATIC_TEST_INTERFACE] a_aisReports();
         		
        		[] t_ac.timeout {
        			log("**** TC_ISO7816_C03: Timeout: No more communication ****");
        		}
        	}       	    
        	
			f_establishVerdict("TC_ISO7816_C03", vt_expectedFailResults, vt_expectedPassResults);  
			
			// Postamble
			f_cleanUp();
        	
        } // end TC_ISO7816_C03
	
	} // end groupISO7816_C

	// Tests of Chip Authentication
	group groupISO7816_D {
           
@@ -113,6 +283,92 @@ module ePassport_Testcases {
			               
        } // end TC_ISO7816_D02

        // ISO7816_D04 : DG14 with two key references
        // This test case verifies that the inspection system performs chip authentication
		// successfully if there are two key references in data group 14. Every key
		// referenced in DG14 MUST be accepted.
        // Profile: AIP
        // Configuration file: default EAC + DG14 with two references
        // Expected results: "ePassport inspection procedure successful"
        // Interface: BAC: PASS, PA: PASS, AA: NP, TA: NP, CA: PASS, COM: PASS
        testcase TC_ISO7816_D04() runs on MRTD system MRTD_System {
        		
            var template IsVerdictList vt_expectedFailResults := {};
        	var template IsVerdictList vt_expectedPassResults := {
        	    e_aisNoFailure,
        	    e_aisBacAuthentication,
        	    e_aisPassiveAuthentication,
        	    e_aisChipAuthentication,
        	    e_aisCommunication
        	};
    
    		// Preamble
    	   	f_cfUp();
        	f_initializeMRTD("CFG.EAC.ISO7816.D04");
        	f_initializeIS(""); 
    	
    		// Test Body
    		t_ac.start(PXT_TWAIT);
        	alt {
        		[] a_advancedInspectionProcedure();
        
        		[PXT_AUTOMATIC_TEST_INTERFACE] a_aisReports();
         		
        		[] t_ac.timeout {
        			log("**** TC_ISO7816_D04: Timeout: No more communication ****");
        		}
        	}       	    
        	
			f_establishVerdict("TC_ISO7816_D04", vt_expectedFailResults, vt_expectedPassResults);
			
			// Postamble
			f_cleanUp();
			               
        } // end TC_ISO7816_D04

        // ISO7816_D11 : DG14 with invalid DH public key specification
        // This test case verifies that chip authentication fails if there is an invalid DH key
		// specification in data group 14.
        // Profile: AIP
        // Configuration file: default EAC + DG14 with invalid OID in SubjectPublicKeyInfo
        // Expected results: "ePassport inspection procedure failed"
        // Interface: BAC: PASS, PA: PASS, AA: NP, TA: NP, CA: FAIL, COM: PASS, DG14: FAIL
        testcase TC_ISO7816_D11() runs on MRTD system MRTD_System {
        		
            var template IsVerdictList vt_expectedFailResults := {
                e_aisChipAuthentication,
                e_aisDg14
            };
        	var template IsVerdictList vt_expectedPassResults := {
        	    e_aisBacAuthentication,
        	    e_aisPassiveAuthentication,
        	    e_aisCommunication
        	};
    
    		// Preamble
    	   	f_cfUp();
        	f_initializeMRTD("CFG.EAC.ISO7816.D11");
        	f_initializeIS(""); 
    	
    		// Test Body
    		t_ac.start(PXT_TWAIT);
        	alt {
        		[] a_advancedInspectionProcedure();
        
        		[PXT_AUTOMATIC_TEST_INTERFACE] a_aisReports();
         		
        		[] t_ac.timeout {
        			log("**** TC_ISO7816_D11: Timeout: No more communication ****");
        		}
        	}       	    
        	
			f_establishVerdict("TC_ISO7816_D11", vt_expectedFailResults, vt_expectedPassResults);
			
			// Postamble
			f_cleanUp();
			               
        } // end TC_ISO7816_D11

	} // end groupISO7816_D
	
	// Tests of Terminal Authentication
@@ -252,6 +508,52 @@ module ePassport_Testcases {

    	} // end TC_ISO7816_E11
    
        // ISO7816_E_12 : External authenticate command with shorter challenge (7 bytes)
        // Purpose : This test case verifies that the inspection system shows the correct behaviour if
		// GET CHALLENGE command delivers only 7 bytes.
        // Profile: AIP
        // Configuration file: default EAC 
        // Expected results: "ePassport inspection procedure failed"
        // Interface: BAC: PASS, PA: PASS, AA: NP, TA: FAIL, CA: PASS, COM: PASS                	
        testcase TC_ISO7816_E12() runs on MRTD system MRTD_System {
    	
            var template IsVerdictList vt_expectedFailResults := {
        	    e_aisTerminalAuthentication
           	};
        	var template IsVerdictList vt_expectedPassResults := {
        	    e_aisBacAuthentication,
        	    e_aisPassiveAuthentication,        	                   
        	    e_aisChipAuthentication,
        	    e_aisCommunication
        	};
    
    		// Preamble
    	   	f_cfUp();
        	f_initializeMRTD("CFG.DFLT.EAC");
        	
        	f_initializeIS("");
        	
        	// TODO: The simulator SHALL return a 7 byte challenge in secure
			// messaging mode. For BAC, the simulator SHALL return 8 bytes.
    		    	
    		// Test Body
    		t_ac.start(PXT_TWAIT);
        	alt {
        		[] a_advancedInspectionProcedure();
        
        		[PXT_AUTOMATIC_TEST_INTERFACE] a_aisReports();
         		
        		[] t_ac.timeout {
        			log("**** TC_ISO7816_E12: Timeout: No more communication ****");
        		}
        	}       	    
        	
			f_establishVerdict("TC_ISO7816_E12", vt_expectedFailResults, vt_expectedPassResults);    
			
			// Postamble
			f_cleanUp();

    	} // end TC_ISO7816_E12
    
        // ISO7816_E18: Verify certificates with wrong signature in IS certificate
        // Purpose: This test case verifies that the inspection system shows the correct behaviour if
@@ -296,6 +598,50 @@ module ePassport_Testcases {
			
    	} // end TC_ISO7816_E18

        // ISO7816_E28: Switch between different algorithms key sizes in CA and TA (EC, CA with 224 and TA with 256)
        // Purpose: This test case verifies that the inspection system performs chip authentication
		// and terminal authentication successfully if there are same algorithms but
		// different key sizes used in CA and TA.
        // Profile: AIP
        // Configuration file: default EAC + diffetent key size in DG14
        // Expected results: "ePassport inspection procedure successful"
        // Interface: BAC: PASS, PA: PASS, AA: NP, TA: PASS, CA: PASS, COM: PASS        
        testcase TC_ISO7816_E28() runs on MRTD system MRTD_System {
    
            var template IsVerdictList vt_expectedFailResults := {};
        	var template IsVerdictList vt_expectedPassResults := {
        	    e_aisNoFailure,
        	    e_aisBacAuthentication,
        	    e_aisPassiveAuthentication,        	                   
        	    e_aisChipAuthentication,
        	    e_aisTerminalAuthentication,
        	    e_aisCommunication
        	};
    
    		// Preamble
    	   	f_cfUp();
        	f_initializeMRTD("CFG.EAC.ISO7816.E28");        	  	
        	f_initializeIS("WARNING: Ensure that IS uses IS_Cert_11");
    	
    		// Test Body
    		t_ac.start(PXT_TWAIT);
        	alt {
        		[] a_advancedInspectionProcedure();
        
        		[PXT_AUTOMATIC_TEST_INTERFACE] a_aisReports();
         		
        		[] t_ac.timeout {
        			log("**** TC_ISO7816_E28: Timeout: No more communication ****");
        		}
        	}       	    
        	
			f_establishVerdict("TC_ISO7816_E28", vt_expectedFailResults, vt_expectedPassResults);
			
			// Postamble
			f_cleanUp();
			
    	} // end TC_ISO7816_E28
    	
	} // end groupISO7816_E
	
	group groupISO7816_F {